Compare commits

..
Author SHA1 Message Date
a955757cd7 Refactor: Replace Ae2Reflect usages with direct method calls (#326)
Co-authored-by: Martin Robertz <[email protected]>
Co-authored-by: Kogepan229 <[email protected]>
Co-authored-by: Kogepan229 <[email protected]>
2025-10-01 19:02:48 +02:00
Martin Robertz 855fe03f75 fix 2025-10-01 18:43:50 +02:00
Martin Robertz 9a7630bdfa update 2025-10-01 18:29:07 +02:00
Kogepan229andboubou19 8c2bd3ceef Adapted to AE2 GuiAmount changes (#338)
Co-authored-by: boubou19 <[email protected]>
2025-09-27 17:59:42 +02:00
lc-1337 0d58fe01b2 make nbt match item after forming press rename (#337) 2025-09-27 17:37:41 +02:00
Martin Robertz 550e3b2bab update 2025-09-15 21:00:18 +02:00
Martin Robertz d6ae1cf144 update 2025-09-09 07:59:47 +02:00
SKProCH de2f625577 Disable hotbar keys handling in terminals (#331) 2025-09-08 17:05:59 +02:00
Martin Robertz 029b479297 merge conflic fix 2025-09-07 13:24:35 +02:00
lc-1337andUltraProdigy 446920485a fix item duplication when cant inject (#334)
Co-authored-by: UltraProdigy <[email protected]>
2025-09-07 12:35:10 +02:00
Dream Master a48914c55c update 2025-09-05 16:18:39 +02:00
lc-1337 f5bdb35783 Fix Auto Filler crash (#335) 2025-09-03 18:29:53 +02:00
Martin Robertz 99822efb6d update 2025-08-31 11:07:13 +02:00
JakubandMartin Robertz 4c19501f38 Fix duping and voiding bug on network changes in p2p interface (#333)
Co-authored-by: Martin Robertz <[email protected]>
2025-08-31 09:03:14 +00:00
Martin Robertz ec26b6a372 update 2025-08-25 18:36:39 +02:00
SKProCHandKogepan229 697217c5cd Middle click craft ordering inserts a proper count (#329)
Co-authored-by: Kogepan229 <[email protected]>
2025-08-25 16:35:20 +00:00
SKProCH 80bcb3bdf3 Force save search text in the wireless terminal on any button press (#330) 2025-08-18 07:45:31 +07:00
Dream Master 8fe16e87bc update 2025-08-08 23:11:48 +07:00
NeOzay e471c1b38c shows Items|Fluids storage disks with NEI search inventories mode of Search Field (#324) 2025-08-08 16:10:04 +00:00
Niclas Klugmann 81c975ce12 German translation (#325) 2025-08-08 12:15:08 +00:00
Kogepan229 17d9ae47c0 Fix dreamcraft mod ID specification (#328) 2025-08-06 14:49:14 +07:00
Dream Master bbcea46300 update 2025-08-04 10:23:06 +07:00
01b08897d2 fix autofiller wont work after boot (#323)
Co-authored-by: NeOzay <[email protected]>
Co-authored-by: NeOzay <[email protected]>
2025-08-01 22:03:34 +07:00
lc-1337andNeOzay 64ecb14e96 reduce p2p interface lags on bind and on pattern change (#322)
Co-authored-by: NeOzay <[email protected]>
2025-07-27 11:57:21 +02:00
Eldrinn-Elantey 12bdd5ebfc Update ru_RU.lang (#318) 2025-07-27 08:59:08 +07:00
Alexdoru 10ee6f40ca fix event handler SPacketMEUpdateBuffer not being registered (#320) 2025-07-20 08:30:21 +00:00
Alexdoru 1e66772abc Cache Tessellator#instance in local var (#321) 2025-07-18 11:51:16 -07:00
NeOzay ae7af4e712 Use new localization message system from AE2 (#319) 2025-07-14 20:28:34 +00:00
Maya f9566ce891 update 2025-07-05 09:54:43 -06:00
8267150fa6 extend level maintainer feedback (#316)
Co-authored-by: Nikolay S. <[email protected]>
Co-authored-by: Maya <[email protected]>
2025-07-05 15:53:35 +00:00
Kogepan229 22b73f9fbf Use CraftingID to check CraftingLink equivalence in Level Maintainer (#317) 2025-07-05 09:49:50 -06:00
Martin Robertz 4669a1e4ed update 2025-07-02 18:21:47 +02:00
c86370caf9 implement pins (#315)
Co-authored-by: Maya <[email protected]>
Co-authored-by: Martin Robertz <[email protected]>
2025-07-01 20:40:42 +02:00
Martin Robertz 10fefc7996 update 2025-07-01 13:19:41 +02:00
8a086d714a Make P2P Tunnel - ME Dual Interface share storage slot contents between input and outputs (#302)
Co-authored-by: Ruling-0 <[email protected]>
Co-authored-by: Martin Robertz <[email protected]>
Co-authored-by: lordIcocain <[email protected]>
2025-06-29 17:51:17 +02:00
zyf051520 25abc806df Fix FluidExportBus NPE (#314) 2025-06-24 07:31:59 +00:00
Martin Robertz 04558b6913 update 2025-06-22 18:22:29 +02:00
0499adcc6f Add Super Stock Replenisher (#278)
Co-authored-by: Maya <[email protected]>
Co-authored-by: boubou19 <[email protected]>
Co-authored-by: lordIcocain <[email protected]>
2025-06-22 17:49:44 +02:00
Martin Robertz 35136c31ee update 2025-06-20 21:56:28 +02:00
lc-1337andboubou19 dffd8e07e0 always use fluid packet for partition (#310)
Co-authored-by: boubou19 <[email protected]>
2025-06-19 08:45:08 +00:00
Ethryanandgithub-actions[bot] 88c5b6be72 Hide EC stuff if EC is not loaded. (#312)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-06-17 16:24:33 +02:00
lc-1337 0095f69da2 fix player null crash magnet (#309) 2025-06-15 00:24:25 -05:00
Alexdoru bfba45e796 Account for client /server desync when teleporting items with magnet (#305) 2025-06-11 06:26:00 +02:00
Michael Doyle dee1277753 Fix Universal Terminal restock hotkey chat message saying the opposite of the current state (#308) 2025-06-10 20:36:14 -05:00
Kogepan229andboubou19 6ac5ea30f0 Rewrite Level Maintainer/Terminal Logic (#294)
Co-authored-by: boubou19 <[email protected]>
2025-06-09 20:12:08 +00:00
Martin Robertz 1ffcea9dd9 update 2025-06-09 15:35:46 +02:00
RecursivePineapple 3428c86f64 Fix div by zero (#306) 2025-06-09 12:25:06 +02:00
Alexdoru c504dbb28a Magnet improvements (#303) 2025-06-08 19:42:19 +02:00
Martin Robertz fe3168ed6e update 2025-05-31 14:55:00 +02:00
c5cea9eb19 Add magnet and restock to Universal terminal (#275)
Co-authored-by: Maya <[email protected]>
Co-authored-by: Caedis <[email protected]>
Co-authored-by: Ruling-0 <[email protected]>
2025-05-30 21:35:35 -06:00
Martin Robertz 5cc8534ba2 update 2025-05-25 21:10:05 +02:00
Kogepan229andMaya 410e33faa0 Fix fluid import/export bus GUI when WAILA is disabled (#298)
Co-authored-by: Maya <[email protected]>
2025-05-25 18:36:05 +00:00
Martin Robertz f235a68266 update 2025-05-25 15:10:33 +02:00
Kogepan229 47e41751df Fix NEI search always showing void cell (#300) 2025-05-24 21:02:42 -05:00
Martin Robertz df1384a7ee update 2025-05-24 22:27:58 +02:00
Kogepan229andboubou19 a70854c832 Restore NEI highlighting when searching for fluid in cells (#299)
Co-authored-by: boubou19 <[email protected]>
2025-05-24 18:09:11 +00:00
Martin Robertz a57cb5db52 update 2025-05-23 22:59:21 +02:00
Kogepan229 c0d438f774 Use long stack size in NEI CellView (#297) 2025-05-23 21:46:16 +02:00
lordIcocain 830ac91521 make baubles optional (#296) 2025-05-23 05:14:36 -04:00
Martin Robertz 1a959b5b8d update 2025-05-16 21:33:36 +02:00
Caedis f629b3a7da Update dependencies.gradle (#292) 2025-05-13 22:00:56 +08:00
lordIcocainandMaya c9cf92ca4a Fix cell math for distribution card (#291)
Co-authored-by: Maya <[email protected]>
2025-05-12 14:21:33 +00:00
Martin Robertz 6e613b33af update 2025-05-12 09:31:48 +02:00
Maya 3af7873882 update 2025-05-11 12:16:20 -05:00
lordIcocain 412c6d9cf2 fix player inventory position in interface terminal (#290) 2025-05-11 12:15:24 -05:00
lordIcocainandMaya ddd046fa15 item renamer (#288)
Co-authored-by: Maya <[email protected]>
2025-05-06 22:47:25 +00:00
lordIcocainandMaya f72dde88e6 order from crafting status (#287)
Co-authored-by: Maya <[email protected]>
2025-05-06 17:43:48 -05:00
lordIcocainandMaya aecddfb94a Use interface terminal gui from ae2, instead of copy code from ae2 (#286)
Co-authored-by: Maya <[email protected]>
2025-05-06 17:39:49 -05:00
Martin Robertz 3bc871e541 update 2025-05-04 13:35:55 +02:00
glowredman 452f9d9620 Artificial universe cell recipe (#289) 2025-05-04 10:03:39 +02:00
Martin Robertz bd67f35f36 update 2025-04-21 10:21:36 +02:00
lordIcocainandMaya a03db709ba copy of fix interface terminal crash (#285)
Co-authored-by: Maya <[email protected]>
2025-04-21 05:55:27 +00:00
lordIcocainandMaya 56703bf498 Fix math when cell restricted and new fluid added (#284)
Co-authored-by: Maya <[email protected]>
2025-04-21 05:51:46 +00:00
Maya d222b00de2 update 2025-04-19 10:43:04 -05:00
Kogepan229 a4a5dcd9d8 Small improvements to the Level Maintainer GUI (#283) 2025-04-19 10:41:29 -05:00
Maya c724875af6 update 2025-04-08 23:49:04 -05:00
Guillaume MercierandMaya 3952557fa2 Make the fluid handler more resilient. (#272)
Co-authored-by: Maya <[email protected]>
2025-04-09 04:48:22 +00:00
lordIcocainandMaya be8457d829 Fix isConduit check (#281)
Co-authored-by: Maya <[email protected]>
2025-04-09 04:44:48 +00:00
Kogepan229andMaya 3bcbed7c44 Backport NEI Cell View (#282)
Co-authored-by: Maya <[email protected]>
2025-04-09 04:40:48 +00:00
Maya 64a17f61f4 update 2025-04-02 17:53:11 -05:00
Kogepan229andMaya 613ca10f74 Allow math expression in Fluid Level Emitter GUI (#279)
Co-authored-by: Maya <[email protected]>
2025-04-02 22:52:55 +00:00
cdfe803f16 Partition gregtech fluids (#273)
Co-authored-by: Jurre Groenendijk <[email protected]>
Co-authored-by: Maya <[email protected]>
2025-04-02 22:47:31 +00:00
Guido de HartandMaya 3b66cab727 made ItemBaseWirelessTerminal.canHandle null-safe (#274)
Co-authored-by: Maya <[email protected]>
2025-04-02 22:41:17 +00:00
lordIcocainandMaya e90c29413d Fix pattern multi (#277)
Co-authored-by: Maya <[email protected]>
2025-04-02 22:36:05 +00:00
StaffiX 77cfc0ba64 Change Creative Cell Capacity (#276) 2025-04-02 10:53:16 -05:00
Maya a7f00c1830 update 2025-03-22 09:42:35 -05:00
Kogepan229andMaya 2f8d51183d Fix terminal key bindings for mouse (#270)
Co-authored-by: Maya <[email protected]>
2025-03-22 14:41:57 +00:00
Martin Robertz 21794f5a9f update 2025-03-20 15:24:04 +01:00
Kogepan229 a4bf54f1b9 Fix an issue that GT and AE2FC fluids could not be used with Creative Fluid Cell (#271) 2025-03-20 10:49:31 +00:00
Maya 546d2f504b update 2025-02-28 13:08:01 -06:00
Maya 23e80c7dd9 Fix fluid containers with null empty items not deleting in fluid terminal (#267) 2025-02-28 13:07:11 -06:00
Maya 8b61980087 update 2025-02-22 22:30:29 -06:00
Zoltán Szepesi d78618d950 Read NBT tags combine and beSubstitute from ItemStack when converting them to FluidPattern (#268) 2025-02-22 22:30:19 -06:00
Martin Robertz e88af75f40 update 2025-02-14 12:23:25 +01:00
Martin Robertz 7b8d87477b convert to long like in ae2 code 2025-02-14 12:22:38 +01:00
Maya 149b9e36ba update 2025-02-14 00:26:30 -06:00
JuliaandJulia Dijkstra b14bded93c Improve ME Fluid Auto Filler Performance (#266)
Co-authored-by: Julia Dijkstra <[email protected]>
2025-02-14 06:24:26 +00:00
lordIcocainandMaya bedb2c25e1 No more drop drops from interface (#265)
Co-authored-by: Maya <[email protected]>
2025-01-26 19:01:35 +00:00
0908e906d2 Option to restrict fluid cell (#263)
Co-authored-by: Martin Robertz <[email protected]>
Co-authored-by: Maya <[email protected]>
2025-01-25 22:13:40 +00:00
Martin Robertz 3ff53243da update 2025-01-24 21:16:57 +01:00
lordIcocain c853dbc30d Allow exotic cells use upgrade cards (#264) 2025-01-23 17:26:37 -06:00
Martin Robertz 188d1ff4c1 update 2025-01-18 22:23:44 +01:00
lordIcocain 31a5decaeb Add Support Void and Distribution card for cells and increase card limit for cells (#262) 2025-01-17 11:48:52 -06:00
Dream Master d184c30d1f update 2025-01-15 12:17:01 +01:00
9fbea64d8d Fixed essentia level maintaining (#245)
Co-authored-by: Martin Robertz <[email protected]>
Co-authored-by: Maya <[email protected]>
Co-authored-by: lailani-f <[email protected]>
2025-01-14 11:15:13 +01:00
lordIcocain 353b9a4191 Add fluid pattern support to fake crafting card (#260) 2025-01-13 17:04:45 -06:00
1d5abe027c Fix/same network multiple extract only storage buses (#244)
Co-authored-by: Martin Robertz <[email protected]>
Co-authored-by: Maya <[email protected]>
2025-01-13 00:47:55 -06:00
49402e3474 [Feature] Shift to pause terminal view movement (#256)
Co-authored-by: Caedis <[email protected]>
Co-authored-by: Martin Robertz <[email protected]>
Co-authored-by: Maya <[email protected]>
2025-01-13 00:43:56 -06:00
Maya b690089c68 update 2025-01-13 00:39:37 -06:00
Martin Robertz 5079ba1d70 update 2025-01-12 12:28:27 +01:00
Maya 4a5e763170 Add cell + pattern disassemble recipes like AE2 (#257) 2025-01-10 11:19:06 -06:00
Martin Robertz f931911381 update 2025-01-09 21:08:24 +01:00
5b0d356fe5 x2 button funtional for fluid pattern terminals. And varions fixes. (#252)
Co-authored-by: Martin Robertz <[email protected]>
Co-authored-by: Alexdoru <[email protected]>
Co-authored-by: Maya <[email protected]>
2025-01-09 11:47:53 +00:00
Martin Robertz 3489be7d54 update 2025-01-05 12:48:12 +01:00
0b67a8a4e7 Scalable Walrus (#248)
Co-authored-by: Martin Robertz <[email protected]>
Co-authored-by: Maya <[email protected]>
2025-01-04 15:48:13 -07:00
Martin Robertz d8de0e8f27 update 2025-01-04 16:13:07 +01:00
03538d3338 Add class dump args (#239)
Co-authored-by: Martin Robertz <[email protected]>
Co-authored-by: Maya <[email protected]>
2025-01-04 04:34:09 +00:00
Martin Robertz b84ed01a02 update 2025-01-03 21:41:52 +01:00
lordIcocain 6acffd220e Fix npe on fluid conduit connected check (#255) 2025-01-02 22:45:18 +01:00
Martin Robertz 954f5eec37 update 2024-12-31 14:01:51 +01:00
lordIcocainandMaya 319dcc95df Prevent Universal Wireless crafting terminal void items. (#254)
Co-authored-by: Maya <[email protected]>
2024-12-30 21:16:00 -06:00
Martin Robertz b663d87801 update 2024-12-30 20:56:51 +01:00
glowredman 0df88f2305 Cleanup (#253) 2024-12-29 19:51:31 -06:00
Martin Robertz 4a39cf4ece update 2024-12-27 10:16:39 +01:00
lordIcocainandMartin Robertz e0aed44bcf Skip this side check if fluid conduit not connected. (#249)
Co-authored-by: Martin Robertz <[email protected]>
2024-12-26 16:11:02 -06:00
Maya 55f48a98f4 update 2024-12-26 12:13:41 -06:00
lordIcocainandMartin Robertz d85e09dda3 Add Fluid Void Cell (#234)
Co-authored-by: Martin Robertz <[email protected]>
2024-12-26 12:11:43 -06:00
Martin Robertz 71d820eacb update 2024-12-17 19:26:58 +01:00
EnderProyects 02ee43b04e Add new texture for infinite water cell (#251) 2024-12-17 15:45:17 +00:00
Martin Robertz 170bf2099a update 2024-12-07 20:14:47 +01:00
AlexdoruandMartin Robertz 8b1dff3f21 Fix pattern dividing (#246)
Co-authored-by: Martin Robertz <[email protected]>
2024-12-06 19:30:11 +01:00
boubou19 be6dfac4d0 retain the priority setting of the fluid storage buses when wrenched (#247) 2024-11-24 21:59:46 +01:00
Martin Robertz 9fb8baef7b update 2024-11-23 16:40:15 +01:00
hiroschoandMartin Robertz 3314e31bdc Fix fluid is registered twice in crafting CPU (#237)
Co-authored-by: Martin Robertz <[email protected]>
2024-11-23 00:27:51 +01:00
Martin Robertz e9804a1538 update 2024-11-18 08:26:03 +01:00
Alexdoru adc2a1f2fd fix changing size of the interface terminal switching to a different GUI entirely (#242) 2024-11-17 22:35:04 +00:00
Alexdoruandboubou19 8a37e085c1 Hide P2P outputs from interface terminal (#241)
Co-authored-by: boubou19 <[email protected]>
2024-11-17 22:26:00 +00:00
AlexdoruandMCTBL 8b4ab1ba61 Fix clearing the current search when clicking the change terminal size button (#240)
Co-authored-by: MCTBL <[email protected]>
2024-11-17 12:51:48 +00:00
AlexdoruandMCTBL e48073976d fix the search strings resetting when changing the terminal size in the interface terminal (#243)
Co-authored-by: MCTBL <[email protected]>
2024-11-17 13:48:36 +01:00
Martin Robertz d699539bd0 update 2024-11-16 15:44:30 +01:00
hiroscho 91542f3d68 Fix that the clicked slot in a level maintainer is not determined correctly (#236) 2024-11-16 15:20:06 +01:00
Martin Robertz 12ebe0b55a update
(cherry picked from commit 5934a8b886)
2024-10-27 16:06:52 +01:00
lordIcocain 311210fc4a another fix (#235) 2024-10-27 16:06:27 +01:00
Martin Robertz b09615f982 update 2024-10-25 16:12:52 +02:00
lordIcocain 25133d8c3f fail (#233) 2024-10-22 16:07:58 +02:00
Martin Robertz dbbdf72230 update 2024-10-20 15:58:07 +02:00
lordIcocainandMartin Robertz 25da378a51 Fix: Adv blocking card for omni. False positive when getAdaptor() return null. (#231)
* fix_getadaptor

* spotless

* allow certus tank & buffers

* better check

* spotless

* better blocking behavior

---------

Co-authored-by: Martin Robertz <[email protected]>
2024-10-20 15:00:14 +02:00
lordIcocain f8e7aba55a Add Smart Blocking Mode GUI for DualInterface (#232) 2024-10-19 10:03:07 -05:00
Martin Robertz d68adac1cc update 2024-10-05 12:28:43 +02:00
hiroscho d411d4f18a Fix fluid storage bus does full reset on every neighbor change (#230) 2024-10-05 12:16:24 +02:00
Martin Robertz eda554a200 update 2024-10-02 15:25:58 +02:00
hiroscho c7f2ea5797 Fix isAutoCraftingInventory returns false (#229) 2024-09-29 18:47:27 +02:00
Martin Robertz e27a8de392 update 2024-09-10 17:30:33 +02:00
MCTBL 9448540466 add blue light for drive and ME chest (#228) 2024-09-08 16:15:15 +02:00
NotAPenguin 41963430dd rename (#227) 2024-09-03 11:37:40 +02:00
Martin Robertz 7deb868713 update 2024-09-02 21:47:56 +02:00
Martin Robertz 5e723f4813 Update dependencies.gradle 2024-09-02 21:09:19 +02:00
Demiu b2e74d8ea0 Complete crafting jobs on networks without discretizer (#225) 2024-08-27 11:30:49 +02:00
Martin Robertz a3eee96d75 update 2024-08-27 10:50:59 +02:00
hiroscho 6bba29a007 Fix inverter card for fluid storage bus (#224) 2024-08-27 10:50:07 +02:00
Martin Robertz 437bb60af3 update 2024-08-27 10:22:56 +02:00
MCTBL 9ca192722b add ignore crafting mode button for wireless terminal (#226) 2024-08-27 07:48:32 +02:00
Martin Robertz 1546f5f505 update 2024-08-23 22:49:05 +02:00
Thomasandhiroscho b4bc6fa0ff add fluid storage bus extract filter (#223)
Co-authored-by: hiroscho <[email protected]>
2024-08-23 22:47:48 +02:00
Martin Robertz 767c6e99da update 2024-08-18 14:31:00 +02:00
c6c5d162a1 Fix fluid autocrafting (#221)
* Fix fluid autocrafting

Depends on https://github.com/GTNewHorizons/Applied-Energistics-2-Unofficial/pull/545

* update

* update

* rename

* Add FluidCraftingInventoryHandler so that fluid crafting isn't handled in Pass 2

* update deps

---------

Co-authored-by: hiroscho <[email protected]>
Co-authored-by: Dream Master <[email protected]>
2024-08-18 14:29:36 +02:00
Thomasandhiroscho e09525bc88 Fix fluid storage bus that undergoes a full reset returns amount 0 (#222)
Co-authored-by: hiroscho <[email protected]>
2024-08-18 10:11:35 +02:00
Dream Master 131747335f update 2024-08-04 19:06:50 +07:00
Pasha BouzarjomehriandMartin Robertz 6f05a1dd42 setItemToCraft (crash fix) (#219)
Fixes GTNewHorizons/GT-New-Horizons-Modpack#16769 for change GTNewHorizons/Applied-Energistics-2-Unofficial#523

Co-authored-by: Martin Robertz <[email protected]>
2024-08-04 19:04:58 +07:00
DemiuandDream Master e983a5e87c Adjust to AE2 api changes (#220)
* Adjust to AE2 api changes

* update

* update

---------

Co-authored-by: Dream Master <[email protected]>
2024-07-31 00:39:16 +07:00
Dream Master f63435403b update 2024-07-28 19:40:24 +07:00
MCTBL a0db8e38e6 Add Fluid Artificial Universe Cell (#218)
* Add Fluid Artificial Universe Cell

* reduce type from 63 to 5

* change the internal name of cell
2024-07-28 19:32:26 +07:00
Dream Master 386884ccb0 update 2024-07-20 18:08:41 +07:00
Martin Robertz 8e62be4638 fix (#217)
* fix

* fix
2024-07-20 18:05:17 +07:00
Fox_white 27e0610042 fix: add back universal terminal addon recipe (#215) 2024-07-20 17:51:09 +07:00
tth05andDream Master fb7508263f Remove blinkCell override (#216)
* Remove blinkCell override

* update

* Update dependencies.gradle

* fix?

---------

Co-authored-by: Dream Master <[email protected]>
2024-07-20 11:02:02 +07:00
Dream Master 7a72ee28b3 update 2024-07-17 17:26:24 +07:00
RealSilverMoon 4d5b8d9b47 Fix Fluid export bus void liquids (#214) 2024-07-17 17:23:24 +07:00
Dream Master 57edd12466 update 2024-07-17 16:17:39 +07:00
Martin Robertz a9f2edd488 update 2024-07-02 23:18:54 +02:00
Quetz4landZereff06 5d2b8eec85 add infinity water cell (#212)
* add infinity water cell

* code improvement for water cell

* code improvement for water cell 2
* changed Integer.MAX_VALUE to Integer.MAX_VALUE * 1000L for creative cells

* code improvement for water cell 3
* changed value to Integer.MAX_VALUE * 1_000_000L for creative cells

---------

Co-authored-by: Zereff06 <[email protected]>
2024-07-02 00:15:02 +02:00
Martin Robertz 402fdedf07 update 2024-06-28 22:47:15 +02:00
glowredman 08c75f9406 Disable useDependencyInformation 2024-06-25 20:44:35 +02:00
Martin Robertz f86046081e update 2024-06-18 11:39:43 +02:00
Quetz4landZereff06 d80127933a add energy and quantum bridge cards (#210)
Co-authored-by: Zereff06 <[email protected]>
2024-06-18 11:38:37 +02:00
HoleFish 75c8f55bb9 Add null check (#211) 2024-06-17 23:27:29 +02:00
Martin Robertz 04cd7ed0b2 update 2024-06-07 11:59:58 +02:00
Smile Yik c1c6a03146 Remove 'setInterfacePattern' method (#209)
The 'setInterfacePattern' method can use OpenComputer to directly generate items in the game.
2024-06-07 05:46:04 +02:00
Martin Robertz 72ce3a0e2f update 2024-05-31 19:00:07 +02:00
Martin Robertz 0135a11ea1 Update dependencies.gradle 2024-05-31 11:29:07 +02:00
slprimeandslprime 6fc5951dbc Fix ScrollBar Position in Empty Terminal (#208)
Co-authored-by: slprime <[email protected]>
2024-05-31 10:38:35 +02:00
Martin Robertz afe7338b83 update 2024-05-29 17:06:17 +02:00
chochem f7b15d0283 fix divide by zero (#207) 2024-05-29 12:31:17 +02:00
Martin Robertz 84d5546758 update 2024-05-03 22:28:56 +02:00
Martin Robertz 90f586e55a update 2024-05-01 23:13:15 +02:00
Caedis 4ef743bb29 Revert "hold the shift to stop sort items (#188)" + update deps (#206)
* Revert "hold the shift to stop sort items (#188)"

This reverts commit 0bf904f2a4.

* update deps

* remove extra file
2024-05-01 08:58:42 -05:00
Martin Robertz 7a0656d0c3 update 2024-04-18 21:22:49 +02:00
slprimeandslprime b9b4211809 Optimize interface terminal gui (#205)
Co-authored-by: slprime <[email protected]>
2024-04-18 21:07:40 +02:00
Martin Robertz 8dbeee2f53 update 2024-04-09 16:50:11 +02:00
Glease d609bf3651 fix incorrect fluid caching (#204) 2024-04-09 14:34:02 +08:00
Martin Robertz 0a03bd99ae update 2024-03-27 16:06:55 +01:00
Alex Bee f7d25c6daa Level Maintainer: don't queue jobs when all CPUs are busy. (#203) 2024-03-27 15:59:20 +01:00
Abdiel Kavash f175d70f0c Use MathExpressionParser from GTNHLib. (#202)
* Use MathExpressionParser from GTNHLib.

* Defer to AE2 implementation + cache GTNHLib loaded.

* Reuse pattern.

* spotless
2024-03-24 08:40:07 +01:00
Martin Robertz 958393a4fe update 2024-03-23 12:32:09 +01:00
SKProCH 130626343b Fix wireless terminal gui (#201)
* Remove some space in NEI enabled

* Fix changing from small terminal to tall terminal also changes the terminal type if cursor over the terminal type button
2024-03-23 09:38:04 +01:00
Martin Robertz 3d3b842923 update 2024-03-22 18:31:43 +01:00
claimg 300f01be8b Fixed fluid emitter when there is no filter in it (#199) 2024-03-22 18:02:26 +01:00
Jakub a231e67167 Add full pattern optimizer support to dual interface and wireless terminal (#200)
* New buttons in dual interface + wireless terminal fix

* Update dependencies.gradle
2024-03-22 17:05:44 +01:00
Martin Robertz 960b8b43bf update 2024-03-21 20:21:05 +01:00
SKProCH 9668cffe59 Adds the sticky card support for fluid storage bus (#198)
* Adds the sticky card support for fluid storage bus

* Replace wildcard imports with regular one

* Apply spotless
2024-03-20 17:54:12 +01:00
Martin Robertz b6b110b63d update 2024-03-13 19:18:38 +01:00
Jason Mitchell 8ca32457d0 Remove Useless GL11 calls (#196)
* Remove Useless GL11 calls

Fixes compat with angelica.
2024-03-13 07:30:42 -07:00
Martin Robertz e095a6018a update 2024-03-12 19:13:06 +01:00
CaedisGitHub GTNH Actionsgithub-actions[bot]
29cb32b6ee Fix GT circuit detection with dual interfaces (#194)
* Also check machine if gt5nh

* Spotless apply for branch fixGTBlocking for #194 (#195)

Co-authored-by: GitHub GTNH Actions <>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2024-03-10 19:34:25 -05:00
Michael Doyle 5cc8488928 FIX: Use correct priority increment amounts (#192)
Adds an overridable method to FCGuiAmount to allow subclasses to specify
increment values other than the default.

AE2 has config values to set how much each button in the priority screen
should increment a fluid storage bus's (or other's) priorty by. Prior to this
change, the priority interface on fluid storage bus' were using the
increment values for crafting, instead of those for priority.
2024-02-28 20:16:50 -06:00
Martin Robertz 3e6ea173fc update 2024-02-28 08:13:51 +01:00
slprimeandslprime 198f7cb3e8 Fix Dynamic Font Size (#193)
Co-authored-by: slprime <[email protected]>
2024-02-28 07:16:21 +01:00
Martin Robertz 8a179dd206 update 2024-02-17 10:50:12 +01:00
Raven Szewczyk 6ebb3220dd [ci skip] upgraded build system 2024-02-04 19:56:16 +00:00
slprimeandslprime 0caf89e539 Use GT and ae2fс fluids in ME inputs/outputs and storagе (#191)
* use of GT and ae2fс fluids in inputs/outputs and storagе

* remove unused imports

---------

Co-authored-by: slprime <[email protected]>
2024-02-01 11:40:55 +01:00
Martin Robertz e3cc9352b1 update deps 2024-01-12 23:19:17 +01:00
Ryan Nasers b3e480a6cb Adding fluids to sticky card (#190)
* Adding sticky support for AE2-FC

* Spotless whoopsies
2024-01-12 22:18:05 +01:00
Martin Robertz 891fef6585 update deps+bs 2024-01-10 08:41:12 +01:00
Raven Szewczyk a81841bdfd [ci skip] upgraded build system 2024-01-08 21:23:17 +00:00
Martin Robertz 9fc2160965 update deps+bs 2024-01-02 11:46:12 +01:00
asdfljandzy 0bf904f2a4 hold the shift to stop sort items (#188)
Co-authored-by: zy <[email protected]>
2024-01-02 11:45:23 +01:00
Abdiel Kavash 6187a7306d Level Maintainer fulfills requests in a round robin pattern. (#187) 2024-01-01 11:25:01 +01:00
Martin Robertz 5b867c531f update deps 2023-12-29 12:41:34 +01:00
Caedis 745ef0841f Add null check to level terminal middle click (#186) 2023-12-29 11:48:19 +01:00
7dedef21fe Fix ability to configure TileLevelMaintainer using OC (#184)
* Fix ability to configure `TileLevelMaintainer` using OC

* Spotless apply for branch fix/tlm-oc-integration for #184 (#185)

Co-authored-by: Andrei Laiff <[email protected]>
Co-authored-by: GitHub GTNH Actions <>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-12-26 11:11:40 +01:00
Martin Robertz 20ebc18f6a update deps 2023-12-23 15:05:16 +01:00
Andrei Laiff 6e96cba6fe Correct split client-server code 2023-12-23 14:39:11 +02:00
TechnicianLP db8aee2c25 Implement Interface Locking for Dual Interfaces (#182)
* Implement Interface Locking for Dual Interfaces

* Update AE2
2023-12-20 13:03:50 +01:00
Andrei Antropov 90e4eb0366 Respect setting preserveSearchBar in InterfaceTerminal (#180)
Closes: GTNewHorizons/GT-New-Horizons-Modpack#15122
2023-12-20 01:40:44 +01:00
Martin Robertz b0a2e6e274 update deps 2023-12-19 11:52:24 +01:00
Andrei Antropov e621da2082 Support to show p2p outputs in interface terminal (#179)
Closes: GTNewHorizons/GT-New-Horizons-Modpack#15124
2023-12-19 09:17:17 +01:00
Martin Robertz f7ea2e9243 update deps 2023-12-18 16:40:05 +01:00
Andrei Antropov a55e699210 Correct stackSize z order (#178)
Closes: GTNewHorizons/GT-New-Horizons-Modpack#15120
2023-12-18 16:33:59 +01:00
TechnicianLP 1372804bc9 Optimize CPacketFluidUpdate (#177) 2023-12-14 17:06:26 +01:00
Martin Robertz 4e3c073fef update deps 2023-12-04 13:55:39 +01:00
Martin Robertz 9d76815744 Update dependencies.gradle 2023-12-04 09:12:08 +01:00
miozuneandMartin Robertz d790afc047 Compat with GT change (#175)
* Compat with GT change

* update gradle+bs+deps

---------

Co-authored-by: Martin Robertz <[email protected]>
2023-12-04 00:09:20 +01:00
MCTBL 3b1b1af852 Add thousandth mark for cell tooltips. (#174)
* Add millennials to cell tooltips, make it more readable

* Update build.gradle
2023-12-03 14:29:03 +00:00
MCTBLandMartin Robertz 3077326c16 Implement the new interface in AE2 for network bytes informations. (#173)
* implement the interface

* sa

* Implements the new interface

---------

Co-authored-by: Martin Robertz <[email protected]>
2023-11-20 19:25:54 +01:00
Martin Robertz 2536488e53 update deps 2023-11-13 13:37:34 +01:00
Dariusz Komosinski 6770a9fe6f Increase maintainer digit limit to 16. 2023-11-13 10:56:14 +01:00
miozune f24694680e Fix loading order again 2023-11-10 19:47:13 +01:00
Martin Robertz 8db0ea3f34 update deps 2023-11-10 17:02:57 +01:00
miozune 8775fbb9c4 Fix items and blocks being registered too late on dedicated server 2023-11-10 17:00:11 +01:00
Martin Robertz 7732cebf68 update deps 2023-10-29 11:28:37 +01:00
Батьків Нестор-Євген Васильович 79dc0eb5bc Add dual interface p2p copy paste (#169)
* update deps

* add dualt interface p2p copy pasting
2023-10-29 11:25:08 +01:00
Martin Robertz ef5efd2e8b update deps 2023-10-27 14:11:01 +02:00
f5912ef2e3 Add LevelMaintainerTerminal rework logic inside TileLevelMaintainer (#162)
* Use new interface terminal API

* Update dependencies.gradle

* feat: Update core hooks and integrations

* api: Add `LevelTerminalRegistry` functionality

* feat: Use `customName` to display in `GuiFluidLevelEmitter`

* feat: Rework scheduling and data storage in `TileLevelMaintainer` functionality

* feat: Add new item `LevelTerminal`

* feat: Support back navigation functionality

* feat: add back navigation in `LevelMaintainer` from terminal

* use `IGuiTooltipHandler` directly from ae2

include #160

* fix correct `InterfaceTerminalSupportedClassProvider` deprecation

* Implement new version of `InterfaceWireless` based on `InterfaceTerminal`

* Fix `LevelTerminal` data recursion and few in fixes gui

* Use `aeRenderItem` directly and fix `zIndex` in custom slots

* Fix rendering numbers bigger than 2.1G through `aeRenderItem`

* Fix fails on `getCraftingItem`

no root cause was found

* Fix add packet logging and try to not fail after receive corrupted packet

* Fix add logging around empty configuration

* Fix packet corruption and log invalid data

* Fix packet corruption with level emitters

* Correct handle overwrite packet

* Fix intercept dnd click from GT5 hook for `AppEngGuiHandler`

keyword `net.bdew.neiaddons.appeng.AppEngGuiHandler`

* update be+deps

* Update dependencies.gradle

* Update dependencies.gradle

* Fix `zIndexes` for compatability with `DuraDisplay`

* Update AE2 and fix compatability

* Change `ForgeDirection` side serialization to `byte`

* Fix tooltip zIndexes

* Rename all rest parts related to `Level terminal`

* Code cleanup after review

* Remove duplicated dependency declaration

---------

Co-authored-by: Firenoo <[email protected]>
Co-authored-by: Martin Robertz <[email protected]>
2023-10-27 14:10:07 +02:00
Martin Robertz 1515ebe33f update deps
add gradlew bat
2023-10-25 19:15:40 +02:00
miozune 567b1dbce5 Move DefaultExtractorLoader to FMLLoadCompleteEvent (#168) 2023-10-25 23:02:07 +09:00
miozune 1efa92adad Fix stacksize overflow when overlaying recipe (#167) 2023-10-25 23:01:56 +09:00
Eldrinn-Elantey bd0e7fabca Fix translation ME Dual Interface on RU (#165) 2023-10-16 11:37:43 +02:00
Martin Robertz c6d11305bb update bs+deps 2023-10-13 12:28:38 +02:00
Alexdoru a4892aee06 fix NPE in FluidPatternDetails (#163) 2023-10-13 02:16:18 +02:00
Dream-MasterXXL 8186653910 update bs+deps 2023-10-09 22:49:23 +02:00
Glease 25ab0916a7 add fluid pattern blame (#161) 2023-10-07 10:59:40 +08:00
Martin Robertz cc6959eb03 update deps 2023-09-27 16:07:11 +02:00
miozune 861791f4fb Fix GUIs not accepting numpad enter key (#159)
* updateBuildScript

* updateDependencies

* Fix GUIs not accepting numpad enter key

* Fix wildcard import
2023-09-27 16:03:59 +02:00
miozune 5b6540f637 Fix Wireless Pattern Terminal not saving stack size change to blank pattern slot (#158) 2023-08-28 21:49:03 +02:00
miozune 1f55def09f Revert fluid animation fix for Quartz Tank to mitigate FPS issue (#157) 2023-08-27 17:58:49 +02:00
firenoo 4de0ee4b1a Fix gt++ fluid cells not extracting properly (#156)
* Fix gt++ fluid cells not extracting properly

If GT++ fluid tank item sees a stacksize > 1, it refuses to fill/drain the
tank item, so we need to set the tank size to 1 before performing tests.

* Fix GT cells not working with fluid terminal

GT cells use IFluidContainerItem, despite the fact that they act like
FluidContainerRegistry items. Unfortunately this threw off the test code;
need to extract the entire container at a time for the test.
2023-08-19 12:34:36 +02:00
Fox_white bcdd765870 Fix Crafting Input Bus Compatibility & fix general bugs (#154)
* fix: uses IInterfaceTerminalSupport for interface terminal

fix custom target not registered in ae2fc wireless interface terminal

* fix: empty string caused channel crash && check if custom name exist before getting

* fix: Fluid interface not registered

* Revert "fix: Fluid interface not registered"

This reverts commit bc21ee2673.

* fix: remove ASM in favor of the new API

* fix: remove zero size character bypass as checking hasCustomName is enough
2023-08-11 21:18:57 +02:00
firenoo 98ff754306 Fix doubling fluids for real now (#153)
If condition was inverted
2023-08-07 23:50:39 +02:00
firenoo 1ed32d46dc A collection of fixes (#152)
* Fix the adv blocking mode setting shown w/o upgrade

* Use else ifs instead of ifs when looking for button

* Register dual p2p interface to interface term

* Fix moving inventory region when space is held

* Fix scrollbars not initialized when terminal is empty

* Fix fluid handling for the 3rd time

Rearranges the steps to insertion and validates whether the tank can be
drained.

* Fix fluid extraction for the 3rd time
2023-08-07 09:28:11 +02:00
firenoo 3d01f50100 Fix fluid stack not doubling (#151) 2023-08-05 17:15:07 +02:00
Raven Szewczyk 64977b87a9 Lazy monitor updates (#150)
* Update buildscript and dependencies

* Implement getAvailableItem for faster network updates

* Use findPrecise
2023-08-05 09:39:12 +02:00
firenoo dd842a182c Save search string when search unfocuses (#149) 2023-08-02 18:02:12 +02:00
DancingSnow 3fa1b1e0e2 Update zh_CN.lang (#147) 2023-07-30 19:25:53 +02:00
firenoo 3fce70a406 Add pattern doubling to ae2fc terminals (#148)
* Brings pattern doubling to ae2fc pattern terms

Literally copied and pasted the code over

* Update dep
2023-07-30 12:59:03 +02:00
StrangeMan1580 3df15eae97 Update ru_RU.lang (#146) 2023-07-29 15:47:41 +02:00
firenoo 0374c1c521 Add null check for retrieving tank info (#145)
ThaumicTinkerer returns null for sides. Normally this is handled when
it is directly adjacent to the dual interface via a null check, but for
p2ps it is not checked, leading to a NPE. Adds a check for it
2023-07-28 13:35:52 +02:00
firenoo b0d67ac917 Render drops as fluids in GuiCraftConfirm (#144)
* Render drops as fluids in GuiCraftConfirm

The crafting tree feature changed where the itemstacks were being drawn
from `drawFG` to `drawListFG`. This changes the ASM to include that in
its visit.

* Render drops as fluid in GuiCraftingTree

Now look for fluid drops in crafting tree.
Temporarily permanent ASM.
2023-07-24 08:26:39 -07:00
firenoo f51f09845a Register dual p2p interface for pattern capacity upgrade (#143) 2023-07-24 09:14:18 +02:00
firenooandGitHub GTNH Actions c94876b02e Add the dual P2P interface (#139)
* Add the dual P2P interface

- Can be disabled in the config
- Updated dependencies
- We now require a hard inheritance dependency on beta-238+.
- CANNOT BE ATTUNED.

* Dependency cleanup (don't use pre)

* Fix dual interface background

* Fix null icon for p2p dual interface

BetterP2P needs this to properly display the icon.

* spotlessApply

---------

Co-authored-by: GitHub GTNH Actions <unknown>
2023-07-22 17:00:43 +02:00
miozune e8f069375f Fix another typo (#142) 2023-07-22 17:18:39 +09:00
Eraldoe b50fd74e9c Fix typo "encoded" pattern 2023-07-22 17:18:28 +09:00
firenooGitHub GTNH Actionsgithub-actions[bot]
51229e972b Untangle Baubles hard dependency and skip on unmapped items/blocks (#137)
* Untangle Baubles hard dependency and skip on unmapped items/blocks

Have forge issue the standard "Missing items" screen when updating, so
players are warned before joining the world. Previously we consumed all
missing mapping by mistake.

Remove the hard dependency on baubles by adding Optional.Interface

* spotlessApply (#138)

Co-authored-by: GitHub GTNH Actions <>

* Update dependencies and fix wrong gui channel

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-07-14 21:08:20 +02:00
miozune 95a72f0e08 Fix fluid texture animation (#136) 2023-07-13 19:37:54 +09:00
firenoo 6afa01da74 Fix modulate/sim bug (#135)
Actionable.SIMULATE gives faulty results. Using Actionable.MODULATE will
force the AE system to extract the correct amount, which fixes a dupe bug
with the previous implementation.
2023-07-12 13:39:40 +02:00
Maxim 7895fce275 Changed craft amount config ref from priority to crafting amount (#134) 2023-06-28 19:29:45 +02:00
chill d5b8ef6ea9 Code cleanup (#133)
* gradle updateBuildScript

* fix comments and commented-out code

Code deletion, converting comments into javadocs, and refactoring code to not
need comments.

* remove redundant suppressions

* replace C-style array declaration with Java-style

* make private field final

* remove unnecessary semicolon

* extract a common part from an if

* simplify boolean expression

* simplify ternary if

* remove unused imports

* convert escaped characters for clarity

* replace while with for

* replace explicit types with diamond operators

* replace anonymous type with lambda

* enable modern Java syntax

* migrate to enhanced switch

* migrate to pattern variables for instanceof

* remove empty javadoc

* add Nonnull annotation to overrides of Nonnull methods

* replace wailaStack with null

When wailaStack is not null, the flow breaks out of the loop,
so there's no need to confuse the reader with putting wailaStack
both as the result and the parameter of the call - there's no
recursion.

* int cannot be bigger than its max value

* suppress dataflow warning

* remove redundant initializer

The default value of int is 0.

* null check is covered by instanceof

* simplify some calls of addVertexWithUV

* fix typos and add TODOs

* make flipState more understandable
2023-06-18 23:29:57 +02:00
firenooandGitHub GTNH Actions f87b76347e Update APIs (#130)
* Add an API to allow other mods to blacklist fluids from this mod.

* Removed Thaumic Energistics config setting. This will be handled by
Thaumic Energistic's side (which also happens to have a config setting).

* Added an API that allows for blacklisting fluids from either the storage
or the display individually.

* Prevent blacklisted fluids from being discretized

* Update API usage

- use AE2's new API

- use ThE's config setting for aspect -> gas

* spotlessApply

---------

Co-authored-by: GitHub GTNH Actions <unknown>
2023-05-20 19:46:37 +02:00
miozune 14853a2481 Fix NPE with FCStackStringifyHandler (#129) 2023-05-13 19:03:22 +02:00
miozune 2cd049d40e ForgeDirection fix & update dependencies (#128) 2023-05-09 07:39:00 +02:00
miozune f01cde7659 Show detailed fluid amount tooltip for Fluid Drop and Packet item (#127)
* Show detailed fluid amount tooltip for Fluid Drop and Packet item

* Guard against division by zero
2023-05-08 17:57:35 +02:00
miozune 56cda9f9e2 Fix fluid animation with Hodgepodge loaded (#126)
* Fix fluid animation with Hodgepodge loaded

* updateBuildScript
2023-05-07 17:55:46 +02:00
firenooGitHub GTNH Actionsgithub-actions[bot]
3da14b3bbe More ec2 mappings (#124)
* Replace ore dictionary bus

Extra Cells ore dict bus -> export bus w/ ore dict card
(retains ore filter setting, not verified they are 1:1)

* Add OpenComputer migration

Moves migration to postInit, and migrates OC upgrades.

* Remap wireless w/ correct encryption key + power

Basically now works without needing to relink in security term

* Update buildscript

* spotless apply

* spotlessApply (#125)

Co-authored-by: GitHub GTNH Actions <>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-05-06 19:04:59 +02:00
firenoo 97c7533ffb Add support for the Advanced Blocking Card to Dual Interfaces (#123)
* Update ae2 to latest (beta-203)

* Add support for the Advanced Blocking Card to Dual Interfaces

Behavior: The Dual Interface acts in the same way as the regular ME
interface when the advanced blocking card is used, but has an additional
check for fluids on top of items contained in the ME system.
2023-05-05 20:19:55 +02:00
firenoo d2df9beb31 Fix fluid export bus voiding fluids on crafting only mode (#120)
The Fluid Export Bus was voiding fluids on craft only mode because it
tried to craft it, and decided to continue with the normal export logic:
Extract fluid from ME system and fill the tank.

Unfortunately, there was a condition that prevented the extracted fluid
from going anywhere depending on craft only mode, so it got voided.

Commit fixes this by skipping the normal extract logic if set to craft
only.

The amount must be simulated before extracting from the ME system. This
helps prevent a scenario where we cannot insert the fluid back (such as
when we have a fluid storage bus on Extract Only).

Signed-off-by: Firenoo <[email protected]>
2023-05-01 19:43:07 +02:00
firenoo dab5a0dbf3 Add mappings for most important Extra Cells items (#115)
* EC2 deprecation: Part 1 - Items

Laying the groundwork for absorbing EC2 mappings.

* EC2 deprecation: Part 2 - Blocks

* EC2 Deprecation: Part 3 - Parts

Parts are deprecated.

* set config "replaceEC2" to default true

* API changes to make room for Extra Cells fluid placeholder

* Finish basic item replacement code

- parts work
- items are remapped properly, and converted when they enter the player inventory

* Fixed some storage cell conversion issues

The placeholders did not transfer NBT data properly

* Add handlers for deprecated item cells

Now the placeholder should work automatically in a drive.

The void cell is still a WIP.

* Add more tooltip help and cell handler for void cell

* apply spotless

too lazy to rebase
2023-05-01 19:42:52 +02:00
firenoo 6090f198e6 Allow all 63 partition items to be used for fluid cells (#121)
Previously, only one partition item was allowed. This fix will have
the cell consider all 63 slots. If you configure more than 1 or 5
cell slots, it works as expected - up to 1 or 5 of the whitelisted
fluids can be stored at a time.

This will degrade performance slightly.

Signed-off-by: Firenoo <[email protected]>
2023-05-01 19:38:07 +02:00
firenoo c29f8cf846 Fix FluidContainerRegistry interactions w/ Certus Quart Tank (#122)
The Certus Quartz Tank previously did not consider the
FluidContainerRegistry API for fluid containers, so fluid containers
that implemented that (like ic2 cells) were voided when filling the
tank.

Signed-off-by: Firenoo <[email protected]>
2023-05-01 19:37:53 +02:00
firenoo 77ec41812d Add null check for tanks (#118)
* Add null check for tanks

Some IFluidHandlers return null for getTankInfo(), so a null check is needed.

* spotless apply
2023-04-28 19:19:53 +02:00
Martin Robertz 258465a654 fix (#117) 2023-04-26 22:38:09 +02:00
Martin Robertz adbc077736 Update dependencies.gradle 2023-04-26 22:13:49 +02:00
Martin Robertz adf317d6a1 update dep file 2023-04-26 21:36:16 +02:00
firenoo 508f6e5d64 Add null check when determining potential tanks to import (#116)
It seems that implementers of IFluidHandler sometimes return null
in `getTankInfo()`, so this adds a check for that before doing the
bus work.
2023-04-26 21:14:40 +02:00
firenoo c174db3f15 Fix fluid terminal interactions (#111)
Now the math is properly calculated.
2023-04-01 14:54:48 +02:00
firenooandMartin Robertz e1b3f20078 Network throttle: Force ME update packets to be sent once every N ms. (#110)
* Network throttle: Force ME update packets to be sent once every 50ms.

1. Item and fluid packets are separated to their own classes, as they are
not even allowed to be mixed together in the first place. This will enforce a strict
separation of the two.

2. New network worker thread for handling ME inventory updates. Instead of
creating packets directly, classes should schedule packet(s) to be sent at the
next 50ms boundary. The packet has a limit of 256 items to prevent killing the
client, but this can be changed in the config. In fact, the packet send rate is
also configurable.

3. Upon opening a terminal GUI, ME update packets are split. Only the last received
packet will trigger a terminal sorting, so if the ME system is large, it may take
several seconds (!) to load all the items.

* Update SPacketMEFluidInvUpdate.java

---------

Co-authored-by: Martin Robertz <[email protected]>
2023-04-01 14:04:39 +02:00
chochem 54781c290e quantum fluid fix (#114) 2023-03-30 22:21:00 +02:00
firenoo 9c2ef02383 Split packets when sending items over network (#107)
Packets are now split into smaller chunks when sent. The packet
size is adjustable in the config.
2023-03-23 17:14:14 +01:00
371 changed files with 17753 additions and 6766 deletions

No files matched your search

+35 -6
View File
@@ -1,9 +1,38 @@
*.bat
.gradle/
.idea/
out/
.gradle
.settings
/.idea/
/.vscode/
/run/
/build/
/eclipse/
.classpath
.project
/bin/
/config/
/crash-reports/
/logs/
options.txt
/saves/
usernamecache.json
banned-ips.json
banned-players.json
eula.txt
ops.json
server.properties
servers.dat
usercache.json
whitelist.json
/out/
*.iml
*.ipr
*.iws
run/
build/
src/main/resources/mixins.*([!.]).json
*.bat
*.DS_Store
!gradlew.bat
.factorypath
addon.local.gradle
addon.local.gradle.kts
addon.late.local.gradle
addon.late.local.gradle.kts
layout.json
+2 -1531
View File
File diff suppressed because it is too large. Load diff
+56 -20
View File
@@ -1,27 +1,63 @@
// Add your dependencies here
/*
* Add your dependencies here. Supported configurations:
* - api("group:name:version:classifier"): if you use the types from this dependency in the public API of this mod
* Available at runtime and compiletime for mods depending on this mod
* - implementation("g:n:v:c"): if you need this for internal implementation details of the mod, but none of it is visible via the public API
* Available at runtime but not compiletime for mods depending on this mod
* - compileOnly("g:n:v:c"): if the mod you're building doesn't need this dependency during runtime at all, e.g. for optional mods
* Not available at all for mods depending on this mod, only visible at compiletime for this mod
* - compileOnlyApi("g:n:v:c"): like compileOnly, but also visible at compiletime for mods depending on this mod
* Available at compiletime but not runtime for mods depending on this mod
* - runtimeOnlyNonPublishable("g:n:v:c"): if you want to include a mod in this mod's runClient/runServer runs, but not publish it as a dependency
* Not available at all for mods depending on this mod, only visible at runtime for this mod
* - devOnlyNonPublishable("g:n:v:c"): a combination of runtimeOnlyNonPublishable and compileOnly for dependencies present at both compiletime and runtime,
* but not published as Maven dependencies - useful for RFG-deobfuscated dependencies or local testing
* - runtimeOnly("g:n:v:c"): if you don't need this at compile time, but want it to be present at runtime
* Available at runtime for mods depending on this mod
* - annotationProcessor("g:n:v:c"): mostly for java compiler plugins, if you know you need this, use it, otherwise don't worry
* - testCONFIG("g:n:v:c") - replace CONFIG by one of the above (except api), same as above but for the test sources instead of main
*
* - shadowImplementation("g:n:v:c"): effectively the same as API, but the dependency is included in your jar under a renamed package name
* Requires you to enable usesShadowedDependencies in gradle.properties
*
* - compile("g:n:v:c"): deprecated, replace with "api" (works like the old "compile") or "implementation" (can be more efficient)
*
* You can exclude transitive dependencies (dependencies of the chosen dependency) by appending { transitive = false } if needed,
* but use this sparingly as it can break using your mod as another mod's dependency if you're not careful.
*
* To depend on obfuscated jars you can use `devOnlyNonPublishable(rfg.deobf("dep:spec:1.2.3"))` to fetch an obfuscated jar from maven,
* or `devOnlyNonPublishable(rfg.deobf(project.files("libs/my-mod-jar.jar")))` to use a file.
*
* Gradle names for some of the configuration can be misleading, compileOnlyApi and runtimeOnly both get published as dependencies in Maven, but compileOnly does not.
* The buildscript adds runtimeOnlyNonPublishable to also have a runtime dependency that's not published.
*
* For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph
*/
dependencies {
api('com.github.GTNewHorizons:NotEnoughItems:2.3.39-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-180-GTNH:dev')
api('com.github.GTNewHorizons:NotEnoughItems:2.8.0-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-700-GTNH:dev')
api('curse.maven:cofh-core-69162:2388751')
api('com.github.GTNewHorizons:waila:1.5.22:dev')
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.32:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:WirelessCraftingTerminal:1.8.9.3:dev")
api('com.github.GTNewHorizons:waila:1.9.0:dev')
api("com.github.GTNewHorizons:GTNHLib:0.7.0:dev")
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.12.7:dev") {
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
}
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.1.15-GTNH:dev')
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.35:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ForestryMC:4.10.17:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.9.26:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.52.02:dev') {
exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework'
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
}
compileOnly('com.github.GTNewHorizons:ForestryMC:4.5.6:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.3.1.49:dev')
compileOnly('com.github.GTNewHorizons:EnderCore:0.2.11:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.41.216:dev')
compileOnly('com.github.GTNewHorizons:StructureLib:1.2.0-beta.2:dev')
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('com.github.GTNewHorizons:AppleCore:3.2.5:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.28:dev') { transitive = false }
compileOnly('com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:OpenComputers:1.8.0.5-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.3.27-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:GTplusplus:1.7.191:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.19-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.7.14-GTNH:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.6.108:dev") { transitive = false }
compileOnly('com.github.GTNewHorizons:KekzTech:0.6.25:dev')
api('com.github.GTNewHorizons:Baubles:1.0.1.14:dev')
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.3.4:dev")
}
+167 -31
View File
@@ -1,67 +1,203 @@
modName = Fluid Craft For AE2
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
# LOCAL to test local config updates.
gtnh.settings.blowdryerTag = 0.2.0
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
# Human-readable mod name, available for mcmod.info population.
modName = AE2 Fluid Crafting
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
# Conventionally lowercase.
modId = ae2fc
# Root package of the mod, used to find various classes in other properties,
# mcmod.info substitution, enabling assertions in run tasks, etc.
modGroup = com.glodblock.github
# WHY is there no version field?
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
# Whether to use modGroup as the maven publishing group.
# When false, com.github.GTNewHorizons is used.
useModGroupForPublishing = false
# Will update your build.gradle automatically whenever an update is available
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
autoUpdateBuildScript = false
# Version of Minecraft to target
minecraftVersion = 1.7.10
# Version of Minecraft Forge to target
forgeVersion = 10.13.4.1614
# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name each time you
# restart Minecraft in development. Choose this dependent on your mod:
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
channel = stable
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
mappingsVersion = 12
# Defines other MCP mappings for dependency deobfuscation.
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
# Select a default username for testing your mod. You can always override this per-run by running
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
developmentEnvironmentUserName = Developer
# Define a source file of your project with:
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
enableModernJavaSyntax = true
# Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
enableGenericInjection = true
# Generate a class with a String field for the mod version named as defined below.
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
generateGradleTokenClass = com.glodblock.github.FCTags
# Name of the token containing the project's current version to generate/replace.
gradleTokenVersion = VERSION
# [DEPRECATED] Mod ID replacement token.
gradleTokenModId =
# [DEPRECATED] Mod name replacement token.
gradleTokenModName =
# [DEPRECATED] Mod Group replacement token.
gradleTokenGroupName =
# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...])
# Leave these properties empty to skip individual token replacements
replaceGradleTokenInFile = FluidCraft.java
gradleTokenModId = GRADLETOKEN_MODID
gradleTokenModName = GRADLETOKEN_MODNAME
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenGroupName = GRADLETOKEN_GROUPNAME
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...]).
# Leave these properties empty to skip individual token replacements.
replaceGradleTokenInFile =
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
apiPackage =
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
apiPackage = api
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
# Example value: mymodid_at.cfg
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# There can be multiple files in a space-separated list.
# Example value: mymodid_at.cfg nei_at.cfg
accessTransformersFile = ae2fc_at.cfg
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
# Mixin classes will have access to "main" classes, but not the other way around.
separateMixinSourceSet =
# Adds some debug arguments like verbose output and class export.
usesMixinDebug = false
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin =
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatibility only
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
coreModClass = coremod.FluidCraftCore
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly = false
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required.
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
forceEnableMixins = false
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
# responsibility to check the license and request permission for distribution if required.
usesShadowedDependencies = false
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
# projects. New projects should not use this parameter.
#customArchiveBaseName =
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
# their own classes, making the minimization unreliable.
minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
# list of strings, with the acceptable keys being(case does not matter):
# cursemaven
# modrinth
excludeWellKnownRepositories =
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
usesMavenPublishing = true
# Maven repository to publish the mod to.
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
#
# The project's ID on Modrinth. Can be either the slug or the ID.
# Leave this empty if you don't want to publish to Modrinth.
modrinthProjectId =
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
# Syntax: scope1-type1:name1;scope2-type2:name2;...
# Where scope can be one of [required, optional, incompatible, embedded],
# type can be one of [project, version],
# and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
#
# The project's numeric ID on CurseForge. You can find this in the About Project box.
# Leave this empty if you don't want to publish on CurseForge.
curseForgeProjectId =
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
# Syntax: type1:name1;type2:name2;...
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
# and the name is the CurseForge project slug of the other mod.
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
curseForgeRelations =
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
# projects. New projects should not use this parameter.
# customArchiveBaseName =
# Optional parameter to have the build automatically fail if an illegal version is used.
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
# The check is ONLY performed if the version is a git tag.
# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+
# versionPattern =
# Uncomment to prevent the source code from being published.
# noPublishedSources = true
# Uncomment this to disable Spotless checks.
# This should only be uncommented to keep it easier to sync with upstream/other forks.
# That is, if there is no other active fork/upstream, NEVER change this.
# disableSpotless = true
# Uncomment this to disable Checkstyle checks (currently wildcard import check).
# disableCheckstyle = true
# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
# (force use delegated build).
# This is meant to be set in $HOME/.gradle/gradle.properties.
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build.
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
# ideaOverrideBuildType = idea
# Whether IDEA should run spotless checks when pressing the Build button.
# This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true
# Optional parameter to prevent the source code from being published
# noPublishedSources =
Binary file not shown.
+2 -1
View File
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+20 -13
View File
@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -83,10 +85,8 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -133,10 +133,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
@@ -144,7 +147,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -152,7 +155,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -197,11 +200,15 @@ if "$cygwin" || "$msys" ; then
done
fi
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Vendored
+94
View File
@@ -0,0 +1,94 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
+5 -10
View File
@@ -4,10 +4,10 @@ pluginManagement {
maven {
// RetroFuturaGradle
name "GTNH Maven"
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
allowInsecureProtocol = true
url "https://nexus.gtnewhorizons.com/repository/public/"
mavenContent {
includeGroup("com.gtnewhorizons.retrofuturagradle")
includeGroup("com.gtnewhorizons")
includeGroupByRegex("com\\.gtnewhorizons\\..+")
}
}
gradlePluginPortal()
@@ -17,12 +17,7 @@ pluginManagement {
}
plugins {
id 'com.diffplug.blowdryerSetup' version '1.6.0'
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.43'
}
blowdryerSetup {
repoSubfolder 'gtnhShared'
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
//devLocal '.' // Use this when testing config updates locally
}
@@ -2,10 +2,9 @@ package com.glodblock.github;
import net.minecraft.util.ResourceLocation;
import appeng.api.AEApi;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.storage.FluidCellHandler;
import com.glodblock.github.crossmod.extracells.EC2Replacer;
import com.glodblock.github.crossmod.opencomputers.OCDriverInit;
import com.glodblock.github.crossmod.waila.WailaInit;
import com.glodblock.github.inventory.InventoryHandler;
@@ -18,21 +17,28 @@ import com.glodblock.github.network.SPacketMEUpdateBuffer;
import com.glodblock.github.proxy.CommonProxy;
import com.glodblock.github.util.ModAndClassUtil;
import appeng.api.AEApi;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.*;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
import cpw.mods.fml.common.network.NetworkRegistry;
@Mod(
modid = FluidCraft.MODID,
version = FluidCraft.VERSION,
name = FluidCraft.MODNAME,
dependencies = "required-after:appliedenergistics2;required-after:CoFHCore;required-after:Baubles;after:waila;after:thaumicenergistics;after:ae2wct")
dependencies = "required-after:appliedenergistics2@[rv3-beta-238,);required-after:CoFHCore;after:waila;after:thaumicenergistics;after:ae2wct")
public class FluidCraft {
public static final String MODID = "GRADLETOKEN_MODID";
public static final String VERSION = "GRADLETOKEN_VERSION";
public static final String MODNAME = "GRADLETOKEN_MODNAME";
public static final String MODID = "ae2fc";
public static final String VERSION = FCTags.VERSION;
public static final String MODNAME = "AE2 Fluid Crafting";
@Mod.Instance(MODID)
public static FluidCraft INSTANCE;
@@ -51,7 +57,6 @@ public class FluidCraft {
@Mod.EventHandler
public static void init(FMLInitializationEvent event) {
ModAndClassUtil.init();
if (ModAndClassUtil.OC) {
OCDriverInit.run();
}
@@ -71,18 +76,28 @@ public class FluidCraft {
if (!Config.removeRecipe) {
RecipeLoader.INSTANCE.run();
}
if (!ModAndClassUtil.NEW_HORIZONS_CORE_MOD) {
RecipeLoader.addTerminalCards();
RecipeLoader.addInfiniteWaterCell();
}
RecipeLoader.runTerminalRecipe();
RecipeLoader.addDisassembleRecipe();
if (ModAndClassUtil.isV2) {
CalculatorV2PluginLoader.installCalculatorV2Plugins();
}
if (ModAndClassUtil.isTypeFilter) {
FluidFilter.installFilter();
AEApi.instance().registries().itemDisplay().addItemFilter(FluidFilter::filter);
}
proxy.postInit(event);
}
@Mod.EventHandler
public void onLoadComplete(FMLLoadCompleteEvent event) {
proxy.onLoadComplete(event);
}
@Mod.EventHandler
public void onServerStart(FMLServerStartingEvent event) {
SPacketMEUpdateBuffer.init();
@@ -94,7 +109,11 @@ public class FluidCraft {
}
@Mod.EventHandler
public void onLoadComplete(FMLLoadCompleteEvent event) {}
public void missingMappings(FMLMissingMappingsEvent event) {
if (!ModAndClassUtil.EC2 && Config.replaceEC2) {
EC2Replacer.replaceExtraCells(event);
}
}
public static ResourceLocation resource(String path) {
return new ResourceLocation(MODID, path);
@@ -0,0 +1,53 @@
package com.glodblock.github.api;
import java.util.HashSet;
import java.util.Set;
import net.minecraftforge.fluids.Fluid;
import com.glodblock.github.api.registries.ILevelTerminalRegistry;
import com.glodblock.github.coremod.registries.LevelTerminalRegistry;
public final class FluidCraftAPI implements IFluidCraftAPI {
private static final FluidCraftAPI API = new FluidCraftAPI();
/**
* These fluids will not be allowed to be stored in fluid storage cells.
*/
private final Set<Class<? extends Fluid>> blacklistedFluids = new HashSet<>();
/**
* These fluids will not be displayed in a fluid terminal.
*/
private final Set<Class<? extends Fluid>> blacklistedDispFluids = new HashSet<>();
public static FluidCraftAPI instance() {
return API;
}
@Override
public void blacklistFluidInStorage(Class<? extends Fluid> fluid) {
blacklistedFluids.add(fluid);
}
@Override
public void blacklistFluidInDisplay(Class<? extends Fluid> fluid) {
blacklistedDispFluids.add(fluid);
}
@Override
public boolean isBlacklistedInStorage(Class<? extends Fluid> fluid) {
return blacklistedFluids.contains(fluid);
}
@Override
public boolean isBlacklistedInDisplay(Class<? extends Fluid> fluid) {
return blacklistedDispFluids.contains(fluid);
}
@Override
public ILevelTerminalRegistry levelTerminalRegistry() {
return LevelTerminalRegistry.instance();
}
}
@@ -0,0 +1,34 @@
package com.glodblock.github.api;
import net.minecraftforge.fluids.Fluid;
import com.glodblock.github.api.registries.ILevelTerminalRegistry;
@SuppressWarnings("unused")
public interface IFluidCraftAPI {
/**
* Blacklisted fluids will not be allowed to be added to a storage cell.
*/
void blacklistFluidInStorage(Class<? extends Fluid> fluid);
/**
* Blacklisted fluids will not be displayed in fluid terminals.
*/
void blacklistFluidInDisplay(Class<? extends Fluid> fluid);
/**
* Mostly for internal use; queries whether the fluid is blacklisted from storage cells.
*/
boolean isBlacklistedInStorage(Class<? extends Fluid> fluid);
/**
* Mostly for internal use; queries whether the fluid is blacklisted from being displayed.
*/
boolean isBlacklistedInDisplay(Class<? extends Fluid> fluid);
/**
* Get instance of `ILevelTerminalRegistry` to add new supported machines into terminal
*/
ILevelTerminalRegistry levelTerminalRegistry();
}
@@ -0,0 +1,8 @@
package com.glodblock.github.api;
import net.minecraftforge.common.util.ForgeDirection;
public interface ISide {
ForgeDirection getSide();
}
@@ -0,0 +1,20 @@
package com.glodblock.github.api.registries;
import java.util.Set;
import appeng.api.networking.IGridHost;
public interface ILevelTerminalRegistry {
void register(Class<? extends ILevelViewable> clazz);
void register(Class<? extends IGridHost> aeClass, ILevelViewableAdapter adapter);
Set<Class<? extends ILevelViewable>> getSupportedClasses();
boolean isAdopted(Class<? extends ILevelViewable> clazz);
Class<? extends IGridHost> getAdopted(Class<? extends ILevelViewable> clazz);
ILevelViewableAdapter getAdapter(Class<? extends ILevelViewable> clazz);
}
@@ -0,0 +1,59 @@
package com.glodblock.github.api.registries;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import com.glodblock.github.api.ISide;
import appeng.api.implementations.tiles.ISegmentedInventory;
import appeng.api.networking.IGridHost;
import appeng.api.util.DimensionalCoord;
import appeng.helpers.ICustomNameObject;
public interface ILevelViewable extends IGridHost, ISide, ISegmentedInventory, ICustomNameObject {
DimensionalCoord getLocation();
TileEntity getTile();
@Deprecated
default long getSortValue() {
TileEntity te = getTile();
return ((long) te.zCoord << 24) ^ ((long) te.xCoord << 8) ^ te.yCoord;
}
@Deprecated
default boolean shouldDisplay() {
return true;
}
/**
* Number of rows to expect. This is used with {@link #rowSize()} to determine how to render the slots.
*/
default int rows() {
return 1;
};
/**
* Number of slots per row.
*/
default int rowSize() {
return 1;
};
@Deprecated
default ItemStack getSelfItemStack() {
return null;
}
/**
* "Target" Display representation
*/
@Deprecated
default ItemStack getDisplayItemStack() {
return null;
}
LevelItemInfo[] getLevelItemInfoList();
}
@@ -0,0 +1,8 @@
package com.glodblock.github.api.registries;
import appeng.api.networking.IGridHost;
public interface ILevelViewableAdapter extends ILevelViewable {
ILevelViewable adapt(IGridHost gridHost);
}
@@ -0,0 +1,20 @@
package com.glodblock.github.api.registries;
import net.minecraft.item.ItemStack;
import org.jetbrains.annotations.NotNull;
public class LevelItemInfo {
public ItemStack stack;
public long quantity;
public long batchSize;
public LevelState state;
public LevelItemInfo(@NotNull ItemStack stack, long quantity, long batchSize, LevelState state) {
this.stack = stack;
this.quantity = quantity;
this.batchSize = batchSize;
this.state = state;
}
}
@@ -0,0 +1,11 @@
package com.glodblock.github.api.registries;
public enum LevelState {
None,
Idle,
Craft,
Export,
Error,
NotFound,
CantCraft
}
@@ -0,0 +1,87 @@
package com.glodblock.github.client.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
// copy from WirelessCraftingTerminal WCTGuiButton
public class FCGuiBaseButton extends GuiButton {
protected static final ResourceLocation buttonTextures = new ResourceLocation(
"minecraft",
"textures/gui/widgets.png");
public FCGuiBaseButton(int id, int xPosition, int yPosition, int width, int height, String displayString) {
super(id, xPosition, yPosition, width, height, displayString);
this.enabled = true;
this.visible = true;
this.id = id;
this.xPosition = xPosition;
this.yPosition = yPosition;
this.width = width;
this.height = height;
this.displayString = displayString;
}
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
if (this.visible) {
FontRenderer fontrenderer = mc.fontRenderer;
mc.getTextureManager().bindTexture(buttonTextures);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition
&& mouseX < this.xPosition + this.width
&& mouseY < this.yPosition + this.height;
int k = this.getHoverState(this.field_146123_n);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + k * 20, this.width / 2, this.height);
this.drawTexturedModalRect(
this.xPosition + this.width / 2,
this.yPosition,
200 - this.width / 2,
46 + k * 20,
this.width / 2,
this.height - 2);
this.drawTexturedModalRect(
this.xPosition + 2,
this.yPosition + (this.height - 2),
200 - (this.width - 2),
64 + k * 20,
this.width - 2,
2);
this.drawTexturedModalRect(
this.xPosition,
this.yPosition + (this.height - 1),
200 - this.width,
65 + k * 20,
this.width,
1);
this.mouseDragged(mc, mouseX, mouseY);
int l = 14737632;
if (packedFGColour != 0) {
l = packedFGColour;
} else if (!this.enabled) {
l = 10526880;
} else if (this.field_146123_n) {
l = 16777120;
}
this.drawCenteredString(
fontrenderer,
this.displayString,
this.xPosition + this.width / 2,
this.yPosition + (this.height - 8) / 2,
l);
}
}
}
@@ -6,8 +6,6 @@ public class FCGuiLineField extends FCGuiTextField {
private final int _xPos;
private final int _yPos;
private final int _width;
private final FontRenderer _fontRender;
public FCGuiLineField(FontRenderer fontRenderer, int xPos, int yPos, int width) {
this(fontRenderer, xPos, yPos, width, 5);
@@ -17,8 +15,6 @@ public class FCGuiLineField extends FCGuiTextField {
super(fontRenderer, xPos, yPos, width, height);
this._xPos = xPos;
this._yPos = yPos;
this._width = width;
this._fontRender = fontRenderer;
}
@Override
@@ -71,9 +71,9 @@ public class FCGuiTextField extends GuiTextField {
mouseY = 15;
}
if (mouseX + length + 20 >= gui.width) {
gui.drawTooltip(mouseX - length - 20, mouseY + 4 + offsetY, 0, this.getMessage());
gui.drawTooltip(mouseX - length - 20, mouseY + 4 + offsetY, this.getMessage());
} else {
gui.drawTooltip(mouseX, mouseY + 4 + offsetY, 0, this.getMessage());
gui.drawTooltip(mouseX, mouseY + 4 + offsetY, this.getMessage());
}
}
}
@@ -0,0 +1,94 @@
package com.glodblock.github.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
import com.glodblock.github.common.parts.PartFluidTerminal;
import com.glodblock.github.common.parts.PartLevelTerminal;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.inventory.item.WirelessFluidTerminalInventory;
import com.glodblock.github.inventory.item.WirelessInterfaceTerminalInventory;
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.network.CPacketInventoryAction;
import com.glodblock.github.util.Ae2ReflectClient;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEItemStack;
import appeng.container.AEBaseContainer;
import appeng.helpers.InventoryAction;
public class GuiCraftingStatus extends appeng.client.gui.implementations.GuiCraftingStatus {
private final ITerminalHost host;
public GuiCraftingStatus(InventoryPlayer inventoryPlayer, ITerminalHost te) {
super(inventoryPlayer, te);
host = te;
}
@Override
public void initGui() {
if (host instanceof PartFluidPatternTerminal) this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL.stack();
else if (host instanceof PartFluidPatternTerminalEx) this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL_EX.stack();
else if (host instanceof PartFluidTerminal) this.myIcon = ItemAndBlockHolder.FLUID_TERM.stack();
else if (host instanceof PartLevelTerminal) this.myIcon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
else if (host instanceof IWirelessTerminal terminal && terminal.isUniversal(host))
this.myIcon = ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack();
else if (host instanceof WirelessFluidTerminalInventory)
this.myIcon = ItemAndBlockHolder.WIRELESS_FLUID_TERM.stack();
else if (host instanceof WirelessPatternTerminalInventory)
this.myIcon = ItemAndBlockHolder.WIRELESS_PATTERN_TERM.stack();
else if (host instanceof WirelessInterfaceTerminalInventory)
this.myIcon = ItemAndBlockHolder.WIRELESS_INTERFACE_TERM.stack();
else if (host instanceof WirelessLevelTerminalInventory)
this.myIcon = ItemAndBlockHolder.WIRELESS_LEVEL_TERM.stack();
super.initGui();
}
@Override
protected void actionPerformed(final GuiButton btn) {
if (btn == originalGuiBtn) {
if (host instanceof PartFluidPatternTerminal) InventoryHandler.switchGui(GuiType.FLUID_PATTERN_TERMINAL);
else if (host instanceof PartFluidPatternTerminalEx)
InventoryHandler.switchGui(GuiType.FLUID_PATTERN_TERMINAL_EX);
else if (host instanceof PartFluidTerminal) InventoryHandler.switchGui(GuiType.FLUID_TERMINAL);
else if (host instanceof PartLevelTerminal) InventoryHandler.switchGui(GuiType.LEVEL_TERMINAL);
else if (host instanceof IWirelessTerminal terminal && terminal.isUniversal(host))
InventoryHandler.switchGui(ItemWirelessUltraTerminal.readMode(terminal.getItemStack()));
else if (host instanceof WirelessFluidTerminalInventory)
InventoryHandler.switchGui(GuiType.WIRELESS_FLUID_TERMINAL);
else if (host instanceof WirelessPatternTerminalInventory)
InventoryHandler.switchGui(GuiType.WIRELESS_FLUID_PATTERN_TERMINAL);
else if (host instanceof WirelessInterfaceTerminalInventory)
InventoryHandler.switchGui(GuiType.WIRELESS_INTERFACE_TERMINAL);
else if (host instanceof WirelessLevelTerminalInventory)
InventoryHandler.switchGui(GuiType.WIRELESS_LEVEL_TERMINAL);
} else {
super.actionPerformed(btn);
}
}
@Override
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
IAEItemStack hoveredAEStack = getHoveredAEStack();
if (hoveredAEStack != null && btn == 2) {
((AEBaseContainer) inventorySlots).setTargetStack(hoveredAEStack);
FluidCraft.proxy.netHandler.sendToServer(
new CPacketInventoryAction(
InventoryAction.AUTO_CRAFT,
Ae2ReflectClient.getInventorySlots(this).size(),
hoveredAEStack.getStackSize(),
hoveredAEStack));
return;
}
super.mouseClicked(xCoord, yCoord, btn);
}
}
@@ -4,40 +4,54 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.StatCollector;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import appeng.api.config.InsertionMode;
import appeng.api.config.Settings;
import appeng.api.config.SidelessMode;
import appeng.api.config.YesNo;
import appeng.client.gui.implementations.GuiUpgradeable;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.client.gui.widgets.GuiToggleButton;
import appeng.container.implementations.ContainerInterface;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.helpers.IInterfaceHost;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerDualInterface;
import com.glodblock.github.common.parts.PartFluidInterface;
import com.glodblock.github.common.tile.TileFluidInterface;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.network.CPacketSwitchGuis;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.NameConst;
import appeng.api.config.AdvancedBlockingMode;
import appeng.api.config.FuzzyMode;
import appeng.api.config.InsertionMode;
import appeng.api.config.LockCraftingMode;
import appeng.api.config.Settings;
import appeng.api.config.SidelessMode;
import appeng.api.config.Upgrades;
import appeng.api.config.YesNo;
import appeng.client.gui.implementations.GuiUpgradeable;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiSimpleImgButton;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.client.gui.widgets.GuiToggleButton;
import appeng.container.implementations.ContainerInterface;
import appeng.core.AELog;
import appeng.core.localization.ButtonToolTips;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.helpers.IInterfaceHost;
public class GuiDualInterface extends GuiUpgradeable {
private GuiTabButton priority;
private GuiTabButton switcher;
private GuiImgButton BlockMode;
private GuiImgButton SmartBlockMode;
private GuiImgButton fuzzyMode;
private GuiToggleButton interfaceMode;
private GuiImgButton insertionMode;
private GuiImgButton sidelessMode;
private GuiSimpleImgButton doublePatterns;
private GuiToggleButton patternOptimization;
private GuiImgButton advancedBlockingMode;
private GuiImgButton lockCraftingMode;
private final IInterfaceHost host;
public GuiDualInterface(InventoryPlayer inventoryPlayer, IInterfaceHost te) {
@@ -47,7 +61,6 @@ public class GuiDualInterface extends GuiUpgradeable {
}
@Override
@SuppressWarnings("unchecked")
protected void addButtons() {
this.priority = new GuiTabButton(
this.guiLeft + 154,
@@ -66,33 +79,91 @@ public class GuiDualInterface extends GuiUpgradeable {
itemRender);
this.buttonList.add(this.switcher);
this.BlockMode = new GuiImgButton(this.guiLeft - 18, this.guiTop + 8, Settings.BLOCK, YesNo.NO);
int offset = 8;
this.BlockMode = new GuiImgButton(this.guiLeft - 18, this.guiTop + offset, Settings.BLOCK, YesNo.NO);
this.buttonList.add(this.BlockMode);
this.SmartBlockMode = new GuiImgButton(this.guiLeft - 36, this.guiTop + offset, Settings.SMART_BLOCK, YesNo.NO);
this.buttonList.add(this.SmartBlockMode);
offset += 18;
this.interfaceMode = new GuiToggleButton(
this.guiLeft - 18,
this.guiTop + 26,
this.guiTop + offset,
84,
85,
GuiText.InterfaceTerminal.getLocal(),
GuiText.InterfaceTerminalHint.getLocal());
this.buttonList.add(this.interfaceMode);
offset += 18;
this.insertionMode = new GuiImgButton(
this.guiLeft - 18,
this.guiTop + 44,
this.guiTop + offset,
Settings.INSERTION_MODE,
InsertionMode.DEFAULT);
this.buttonList.add(this.insertionMode);
offset += 18;
this.doublePatterns = new GuiSimpleImgButton(this.guiLeft - 18, this.guiTop + offset, 71, "");
this.doublePatterns.enabled = false;
this.buttonList.add(this.doublePatterns);
offset += 18;
this.patternOptimization = new GuiToggleButton(
this.guiLeft - 18,
this.guiTop + offset,
178,
194,
GuiText.PatternOptimization.getLocal(),
GuiText.PatternOptimizationHint.getLocal());
this.buttonList.add(this.patternOptimization);
offset += 18;
this.advancedBlockingMode = new GuiImgButton(
this.guiLeft - 18,
this.guiTop + offset,
Settings.ADVANCED_BLOCKING_MODE,
AdvancedBlockingMode.DEFAULT);
this.buttonList.add(this.advancedBlockingMode);
this.advancedBlockingMode.visible = this.bc.getInstalledUpgrades(Upgrades.ADVANCED_BLOCKING) > 0;
offset += 18;
if (isTile()) {
this.sidelessMode = new GuiImgButton(
this.guiLeft - 18,
this.guiTop + 62,
this.guiTop + offset,
Settings.SIDELESS_MODE,
SidelessMode.SIDELESS);
this.buttonList.add(this.sidelessMode);
offset += 18;
}
this.lockCraftingMode = new GuiImgButton(
this.guiLeft - 18,
this.guiTop + offset,
Settings.LOCK_CRAFTING_MODE,
LockCraftingMode.NONE);
this.lockCraftingMode.visible = this.bc.getInstalledUpgrades(Upgrades.LOCK_CRAFTING) > 0;
this.buttonList.add(lockCraftingMode);
offset += 18;
this.fuzzyMode = new GuiImgButton(
this.guiLeft - 18,
this.guiTop + offset,
Settings.FUZZY_MODE,
FuzzyMode.IGNORE_ALL);
this.fuzzyMode.visible = this.bc.getInstalledUpgrades(Upgrades.FUZZY) > 0;
this.buttonList.add(fuzzyMode);
}
@Override
@@ -100,17 +171,37 @@ public class GuiDualInterface extends GuiUpgradeable {
if (this.BlockMode != null) {
this.BlockMode.set(((ContainerInterface) this.cvb).getBlockingMode());
}
if (this.SmartBlockMode != null) {
this.SmartBlockMode.set(((ContainerInterface) this.cvb).getSmartBlockingMode());
}
if (this.interfaceMode != null) {
this.interfaceMode.setState(((ContainerInterface) this.cvb).getInterfaceTerminalMode() == YesNo.YES);
}
if (this.insertionMode != null) {
this.insertionMode.set(((ContainerInterface) this.cvb).getInsertionMode());
}
if (this.doublePatterns != null) {
this.doublePatterns.enabled = ((ContainerInterface) this.cvb).isAllowedToMultiplyPatterns;
if (this.doublePatterns.enabled) this.doublePatterns.setTooltip(
ButtonToolTips.DoublePatterns.getLocal() + "\n" + ButtonToolTips.DoublePatternsHint.getLocal());
else this.doublePatterns.setTooltip(
ButtonToolTips.DoublePatterns.getLocal() + "\n" + ButtonToolTips.OptimizePatternsNoReq.getLocal());
}
if (this.patternOptimization != null) {
this.patternOptimization.setState(((ContainerInterface) this.cvb).getPatternOptimization() == YesNo.YES);
}
if (this.sidelessMode != null) {
this.sidelessMode.set(((ContainerDualInterface) this.cvb).getSidelessMode());
}
if (this.advancedBlockingMode != null) {
this.advancedBlockingMode.set(((ContainerDualInterface) this.cvb).getAdvancedBlockingMode());
}
if (this.lockCraftingMode != null) {
this.lockCraftingMode.set(((ContainerInterface) this.cvb).getLockCraftingMode());
}
if (this.fuzzyMode != null) {
this.fuzzyMode.set(((ContainerInterface) this.cvb).getFuzzyMode());
}
this.fontRendererObj.drawString(
getGuiDisplayName(StatCollector.translateToLocal(NameConst.GUI_FLUID_INTERFACE)),
8,
@@ -121,52 +212,69 @@ public class GuiDualInterface extends GuiUpgradeable {
@Override
protected String getBackground() {
if (!ModAndClassUtil.isBigInterface) return "guis/interface.png";
switch (((ContainerInterface) this.cvb).getPatternCapacityCardsInstalled()) {
case 1:
return "guis/interface2.png";
case 2:
return "guis/interface3.png";
case 3:
return "guis/interface4.png";
}
return "guis/interface.png";
return switch (((ContainerInterface) this.cvb).getPatternCapacityCardsInstalled()) {
case -1 -> "guis/interfacenonenoconfig.png";
case 1 -> "guis/interface2.png";
case 2 -> "guis/interface3.png";
case 3 -> "guis/interface4.png";
default -> "guis/interface.png";
};
}
@Override
protected void actionPerformed(final GuiButton btn) {
super.actionPerformed(btn);
final boolean backwards = Mouse.isButtonDown(1);
if (btn == null) {
return;
}
if (btn == this.priority) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis(GuiType.PRIORITY));
}
if (btn == this.switcher) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis(GuiType.DUAL_INTERFACE_FLUID));
}
if (btn == this.interfaceMode) {
InventoryHandler.switchGui(GuiType.PRIORITY);
} else if (btn == this.switcher) {
InventoryHandler.switchGui(GuiType.DUAL_INTERFACE_FLUID);
} else if (btn == this.interfaceMode) {
NetworkHandler.instance.sendToServer(new PacketConfigButton(Settings.INTERFACE_TERMINAL, backwards));
}
if (btn == this.BlockMode) {
} else if (btn == this.BlockMode) {
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.BlockMode.getSetting(), backwards));
}
if (btn == this.insertionMode) {
} else if (btn == this.SmartBlockMode) {
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.SmartBlockMode.getSetting(), backwards));
} else if (btn == this.insertionMode) {
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.insertionMode.getSetting(), backwards));
}
if (btn == this.sidelessMode) {
} else if (btn == this.doublePatterns) {
try {
int val = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 1 : 0;
if (backwards) val |= 0b10;
NetworkHandler.instance
.sendToServer(new PacketValueConfig("Interface.DoublePatterns", String.valueOf(val)));
} catch (final Throwable e) {
AELog.debug(e);
}
} else if (btn == this.patternOptimization) {
NetworkHandler.instance.sendToServer(new PacketConfigButton(Settings.PATTERN_OPTIMIZATION, backwards));
} else if (btn == this.sidelessMode) {
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.sidelessMode.getSetting(), backwards));
} else if (btn == this.advancedBlockingMode) {
NetworkHandler.instance
.sendToServer(new PacketConfigButton(this.advancedBlockingMode.getSetting(), backwards));
} else if (btn == this.lockCraftingMode) {
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.lockCraftingMode.getSetting(), backwards));
} else if (btn == this.fuzzyMode) {
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.fuzzyMode.getSetting(), backwards));
}
}
private boolean isPart() {
return this.host instanceof PartFluidInterface;
}
private boolean isTile() {
return this.host instanceof TileFluidInterface;
}
@Override
protected void handleButtonVisibility() {
super.handleButtonVisibility();
if (this.advancedBlockingMode != null) {
this.advancedBlockingMode.setVisibility(this.bc.getInstalledUpgrades(Upgrades.ADVANCED_BLOCKING) > 0);
}
if (this.lockCraftingMode != null) {
this.lockCraftingMode.setVisibility(this.bc.getInstalledUpgrades(Upgrades.LOCK_CRAFTING) > 0);
}
if (this.fuzzyMode != null) {
this.fuzzyMode.setVisibility(this.bc.getInstalledUpgrades(Upgrades.FUZZY) > 0);
}
}
}
@@ -1,7 +1,5 @@
package com.glodblock.github.client.gui;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import net.minecraft.client.gui.GuiButton;
@@ -11,10 +9,7 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.me.SlotME;
import appeng.client.render.AppEngRenderItem;
import org.lwjgl.opengl.GL11;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerEssentiaMonitor;
@@ -26,11 +21,13 @@ import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.network.CPacketFluidUpdate;
import com.glodblock.github.util.Ae2ReflectClient;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.me.SlotME;
public class GuiEssentiaTerminal extends GuiFluidMonitor {
private final AppEngRenderItem stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
protected EntityPlayer player;
public GuiEssentiaTerminal(InventoryPlayer inventoryPlayer, IWirelessTerminal te) {
@@ -64,13 +61,15 @@ public class GuiEssentiaTerminal extends GuiFluidMonitor {
AspectUtil.getAspectFromGas(fluidStack),
fluidStack.amount);
IAEItemStack gas = stack.copy().setStackSize(stack.getStackSize() / AspectUtil.R);
stackSizeRenderer.setAeStack(gas);
stackSizeRenderer.renderItemOverlayIntoGUI(
aeRenderItem.setAeStack(gas);
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
aeRenderItem.renderItemOverlayIntoGUI(
fontRendererObj,
mc.getTextureManager(),
gas.getItemStack(),
slot.xDisplayPosition,
slot.yDisplayPosition);
GL11.glTranslatef(0.0f, 0.0f, -200.0f);
return false;
}
return true;
@@ -79,13 +78,8 @@ public class GuiEssentiaTerminal extends GuiFluidMonitor {
@Override
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
if (slot instanceof SlotME && AspectUtil.isEssentiaContainer(player.inventory.getItemStack())) {
Map<Integer, IAEFluidStack> tmp = new HashMap<>();
ItemStack itemStack = this.player.inventory.getItemStack().copy();
tmp.put(0, ItemFluidDrop.getAeFluidStack(((SlotME) slot).getAEStack()));
if (!isShiftKeyDown()) {
itemStack.stackSize = 1;
}
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(tmp, itemStack));
IAEFluidStack fluid = ItemFluidDrop.getAeFluidStack(((SlotME) slot).getAEStack());
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(fluid, isShiftKeyDown()));
}
if (mouseButton == 3 && slot instanceof SlotME) {
return;
@@ -10,11 +10,11 @@ import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import appeng.client.gui.widgets.ITooltip;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.util.NameConst;
import appeng.client.gui.widgets.ITooltip;
public class GuiFCImgButton extends GuiButton implements ITooltip {
private static final Pattern COMPILE = Pattern.compile("%s");
@@ -22,6 +22,7 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
private static Map<EnumPair, ButtonAppearance> appearances;
private final String buttonSetting;
private boolean halfSize = false;
private boolean threeFourths = false;
private String fillVar;
private String currentValue;
private final boolean background;
@@ -59,6 +60,21 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
this.registerApp(15, "PATTERN_EX_TEM", "YES", "pattern_terminal_ex_w");
this.registerApp(16, "FILL_PATTERN", "DO_FILL", "fill_pattern");
this.registerApp(17, "NOT_FILL_PATTERN", "DONT_FILL", "not_fill_pattern");
this.registerApp(20, "LEVEL_TEM", "YES", "level_terminal_w");
this.registerApp(21, "SWITCH", "ON", "edit");
this.registerApp(22, "SWITCH", "OFF", "view");
this.registerApp(21, "SWITCH", "ENABLE", "enable");
this.registerApp(22, "SWITCH", "DISABLE", "disable");
this.registerApp(23, "CONFIG", "YES", "open_configuration");
this.registerApp(24, "HIGHLIGHT", "YES", "block_highlight");
this.registerApp(30, "MAGNET_CARD", "INV", "magnet_card.inv");
this.registerApp(30, "MAGNET_CARD", "ME", "magnet_card.me");
this.registerApp(30, "MAGNET_CARD", "FILTER", "magnet_card.filter");
this.registerApp(31, "MAGNET_CARD", "OFF", "magnet_card.off");
this.registerApp(32, "ENABLE_12x", "ENABLE", "enable");
this.registerApp(33, "DISABLE_12x", "DISABLE", "disable");
this.registerApp(34, "RESTOCK", "ENABLE", "restock.on");
this.registerApp(35, "RESTOCK", "DISABLE", "restock.off");
}
}
@@ -110,6 +126,10 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
return this.currentValue;
}
public boolean getMouseIn() {
return this.field_146123_n;
}
public void set(final String e) {
if (!this.currentValue.equals(e)) {
this.currentValue = e;
@@ -124,6 +144,14 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
this.halfSize = halfSize;
}
public boolean isThreeFourths() {
return threeFourths;
}
public void setThreeFourths(boolean threeFourths) {
this.threeFourths = threeFourths;
}
public String getFillVar() {
return this.fillVar;
}
@@ -144,12 +172,12 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
@Override
public int getWidth() {
return this.halfSize ? 8 : 16;
return this.halfSize ? 8 : threeFourths ? 12 : 16;
}
@Override
public int getHeight() {
return this.halfSize ? 8 : 16;
return this.halfSize ? 8 : threeFourths ? 12 : 16;
}
@Override
@@ -206,83 +234,46 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
if (this.visible) {
final int iconIndex = this.getIconIndex();
final int iconPage = this.getIconPage();
this.width = getWidth();
this.height = getHeight();
float scaleFactor = halfSize ? 3 : threeFourths ? 4.5f : 6;
if (this.halfSize) {
this.width = 8;
this.height = 8;
GL11.glPushMatrix();
GL11.glTranslatef(this.xPosition, this.yPosition, 0.0F);
GL11.glScalef(0.5f / 16 * scaleFactor, 0.5f / 16 * scaleFactor, 0.5f / 16 * scaleFactor);
GL11.glPushMatrix();
GL11.glTranslatef(this.xPosition, this.yPosition, 0.0F);
GL11.glScalef(0.5f / 16 * 3, 0.5f / 16 * 3, 0.5f / 16 * 3);
if (this.enabled) {
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
} else {
GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
}
par1Minecraft.renderEngine.bindTexture(FluidCraft.resource("textures/gui/states" + iconPage + ".png"));
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition
&& par2 < this.xPosition + this.width
&& par3 < this.yPosition + this.height;
final int uv_y = (int) Math.floor(iconIndex / 3.0);
final int uv_x = iconIndex - uv_y * 3;
if (this.background) {
this.drawTexturedModalRect(
0,
0,
Math.round(32F * 16F / 3F),
Math.round(32F * 16F / 3F),
Math.round(16F * 16F / 3F),
Math.round(16F * 16F / 3F));
}
this.drawTexturedModalRect(
0,
0,
Math.round(uv_x * 16F * 16F / 3F),
Math.round(uv_y * 16F * 16F / 3F),
Math.round(16F * 16F / 3F),
Math.round(16F * 16F / 3F));
this.mouseDragged(par1Minecraft, par2, par3);
GL11.glPopMatrix();
if (this.enabled) {
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
} else {
GL11.glPushMatrix();
GL11.glTranslatef(this.xPosition, this.yPosition, 0.0F);
GL11.glScalef(0.5f / 16 * 6, 0.5f / 16 * 6, 0.5f / 16 * 6);
if (this.enabled) {
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
} else {
GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
}
GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
}
par1Minecraft.renderEngine.bindTexture(FluidCraft.resource("textures/gui/states" + iconPage + ".png"));
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition
&& par2 < this.xPosition + this.width
&& par3 < this.yPosition + this.height;
par1Minecraft.renderEngine.bindTexture(FluidCraft.resource("textures/gui/states" + iconPage + ".png"));
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition
&& par2 < this.xPosition + this.width
&& par3 < this.yPosition + this.height;
final int uv_y = (int) Math.floor(iconIndex / 3.0);
final int uv_x = iconIndex - uv_y * 3;
if (this.background) {
this.drawTexturedModalRect(
0,
0,
Math.round(32F * 16F / 3F),
Math.round(32F * 16F / 3F),
Math.round(16F * 16F / 3F),
Math.round(16F * 16F / 3F));
}
final int uv_y = (int) Math.floor(iconIndex / 3.0);
final int uv_x = iconIndex - uv_y * 3;
if (this.background) {
this.drawTexturedModalRect(
0,
0,
Math.round(uv_x * 16F * 16F / 3F),
Math.round(uv_y * 16F * 16F / 3F),
Math.round(32F * 16F / 3F),
Math.round(32F * 16F / 3F),
Math.round(16F * 16F / 3F),
Math.round(16F * 16F / 3F));
this.mouseDragged(par1Minecraft, par2, par3);
GL11.glPopMatrix();
}
this.drawTexturedModalRect(
0,
0,
Math.round(uv_x * 16F * 16F / 3F),
Math.round(uv_y * 16F * 16F / 3F),
Math.round(16F * 16F / 3F),
Math.round(16F * 16F / 3F));
this.mouseDragged(par1Minecraft, par2, par3);
GL11.glPopMatrix();
}
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}
@@ -4,7 +4,14 @@ import java.io.IOException;
import net.minecraft.entity.player.InventoryPlayer;
import com.glodblock.github.client.gui.base.FCGuiAmount;
import com.glodblock.github.common.parts.PartFluidStorageBus;
import com.glodblock.github.inventory.IDualHost;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.loader.ItemAndBlockHolder;
import appeng.container.implementations.ContainerPriority;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
@@ -13,12 +20,6 @@ import appeng.helpers.IPriorityHost;
import appeng.util.calculators.ArithHelper;
import appeng.util.calculators.Calculator;
import com.glodblock.github.client.gui.base.FCGuiAmount;
import com.glodblock.github.common.parts.PartFluidStorageBus;
import com.glodblock.github.inventory.IDualHost;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.loader.ItemAndBlockHolder;
public class GuiFCPriority extends FCGuiAmount {
public GuiFCPriority(final InventoryPlayer inventoryPlayer, final IPriorityHost te) {
@@ -34,6 +35,11 @@ public class GuiFCPriority extends FCGuiAmount {
((ContainerPriority) this.inventorySlots).setTextField(this.amountBox);
}
@Override
protected int getIncrementQuantity(int i) {
return AEConfig.instance.priorityByStacksAmounts(i);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.fontRendererObj.drawString(GuiText.Priority.getLocal(), 8, 6, 0x404040);
@@ -49,6 +55,7 @@ public class GuiFCPriority extends FCGuiAmount {
protected void addQty(final int i) {
try {
this.amountBox.setText(Long.toString(getAmount() + i));
this.amountBox.setCursorPositionEnd();
} catch (final NumberFormatException ignore) {}
try {
NetworkHandler.instance
@@ -5,14 +5,14 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import appeng.client.gui.AEBaseMEGui;
import appeng.core.localization.GuiText;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerFluidAutoFiller;
import com.glodblock.github.common.tile.TileFluidAutoFiller;
import com.glodblock.github.util.NameConst;
import appeng.client.gui.AEBaseMEGui;
import appeng.core.localization.GuiText;
public class GuiFluidAutoFiller extends AEBaseMEGui {
protected EntityPlayer player;
@@ -2,11 +2,8 @@ package com.glodblock.github.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.storage.ITerminalHost;
import appeng.container.implementations.ContainerCraftAmount;
import appeng.core.localization.GuiText;
import org.lwjgl.input.Mouse;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.base.FCGuiAmount;
@@ -14,14 +11,26 @@ import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
import com.glodblock.github.common.parts.PartFluidTerminal;
import com.glodblock.github.common.parts.PartLevelTerminal;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.network.CPacketCraftRequest;
import appeng.api.config.CraftingMode;
import appeng.api.config.Settings;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.container.implementations.ContainerCraftAmount;
import appeng.core.localization.GuiText;
import appeng.util.Platform;
public class GuiFluidCraftAmount extends FCGuiAmount {
private GuiImgButton craftingMode;
public GuiFluidCraftAmount(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
super(new ContainerCraftAmount(inventoryPlayer, te));
}
@@ -29,8 +38,14 @@ public class GuiFluidCraftAmount extends FCGuiAmount {
@Override
public void initGui() {
super.initGui();
this.amountBox.setText("1");
this.amountBox.setSelectionPos(0);
this.buttonList.add(
this.craftingMode = new GuiImgButton(
this.guiLeft + 10,
this.guiTop + 53,
Settings.CRAFTING_MODE,
CraftingMode.STANDARD));
((ContainerCraftAmount) this.inventorySlots).setAmountField(this.amountBox);
}
@Override
@@ -54,8 +69,20 @@ public class GuiFluidCraftAmount extends FCGuiAmount {
protected void actionPerformed(final GuiButton btn) {
super.actionPerformed(btn);
try {
if (btn == this.submit && this.submit.enabled) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketCraftRequest(getAmount(), isShiftKeyDown()));
if (btn == this.craftingMode) {
GuiImgButton iBtn = ((GuiImgButton) btn);
final Enum<?> cv = iBtn.getCurrentValue();
final boolean backwards = Mouse.isButtonDown(1);
final Enum<?> next = Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
iBtn.set(next);
} else if (btn == this.submit && this.submit.enabled) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketCraftRequest(
getAmount(),
isShiftKeyDown(),
((CraftingMode) this.craftingMode.getCurrentValue())));
}
} catch (final NumberFormatException e) {
this.amountBox.setText("1");
@@ -65,20 +92,26 @@ public class GuiFluidCraftAmount extends FCGuiAmount {
@Override
protected void setOriginGUI(Object target) {
if (target instanceof PartFluidPatternTerminal) {
this.myIcon = new ItemStack(ItemAndBlockHolder.FLUID_TERMINAL, 1);
this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL.stack();
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
} else if (target instanceof PartFluidPatternTerminalEx) {
this.myIcon = new ItemStack(ItemAndBlockHolder.FLUID_TERMINAL_EX, 1);
this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL_EX.stack();
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
} else if (target instanceof PartFluidTerminal) {
this.myIcon = new ItemStack(ItemAndBlockHolder.FLUID_TERM, 1);
this.myIcon = ItemAndBlockHolder.FLUID_TERM.stack();
this.originalGui = GuiType.FLUID_TERMINAL;
} else if (target instanceof IWirelessTerminal && ((IWirelessTerminal) target).isUniversal(target)) {
this.myIcon = new ItemStack(ItemAndBlockHolder.WIRELESS_ULTRA_TERM, 1);
this.originalGui = ItemWirelessUltraTerminal.readMode(((IWirelessTerminal) target).getItemStack());
} else if (target instanceof PartLevelTerminal) {
myIcon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
originalGui = GuiType.LEVEL_TERMINAL;
} else if (target instanceof IWirelessTerminal terminal && terminal.isUniversal(target)) {
this.myIcon = ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack();
this.originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
} else if (target instanceof WirelessPatternTerminalInventory) {
this.myIcon = new ItemStack(ItemAndBlockHolder.WIRELESS_PATTERN_TERM, 1);
this.myIcon = ItemAndBlockHolder.WIRELESS_PATTERN_TERM.stack();
this.originalGui = GuiType.FLUID_TERMINAL;
} else if (target instanceof WirelessLevelTerminalInventory) {
myIcon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
}
}
@@ -1,40 +1,43 @@
package com.glodblock.github.client.gui;
import java.util.*;
import net.minecraft.entity.player.InventoryPlayer;
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
import com.glodblock.github.common.parts.PartLevelTerminal;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.implementations.GuiCraftConfirm;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
import com.glodblock.github.network.CPacketSwitchGuis;
public class GuiFluidCraftConfirm extends GuiCraftConfirm {
private GuiType OriginalGui;
private GuiType originalGui;
public GuiFluidCraftConfirm(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
super(inventoryPlayer, te);
if (te instanceof PartFluidPatternTerminal) {
this.OriginalGui = GuiType.FLUID_PATTERN_TERMINAL;
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
} else if (te instanceof PartFluidPatternTerminalEx) {
this.OriginalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
} else if (te instanceof IWirelessTerminal && ((IWirelessTerminal) te).isUniversal(te)) {
this.OriginalGui = ItemWirelessUltraTerminal.readMode(((IWirelessTerminal) te).getItemStack());
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
} else if (te instanceof PartLevelTerminal) {
originalGui = GuiType.LEVEL_TERMINAL;
} else if (te instanceof IWirelessTerminal terminal && terminal.isUniversal(te)) {
this.originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
} else if (te instanceof WirelessPatternTerminalInventory) {
this.OriginalGui = GuiType.FLUID_TERMINAL;
this.originalGui = GuiType.FLUID_TERMINAL;
} else if (te instanceof WirelessLevelTerminalInventory) {
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
}
}
@Override
public void switchToOriginalGUI() {
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis(this.OriginalGui));
InventoryHandler.switchGui(originalGui);
}
}
@@ -5,6 +5,11 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import com.glodblock.github.client.gui.container.ContainerCraftingWireless;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import appeng.api.config.ActionItems;
import appeng.api.config.Settings;
import appeng.client.gui.widgets.GuiImgButton;
@@ -15,11 +20,6 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketInventoryAction;
import appeng.helpers.InventoryAction;
import com.glodblock.github.client.gui.container.ContainerCraftingWireless;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
public class GuiFluidCraftingWireless extends GuiItemMonitor {
private GuiImgButton clearBtn;
@@ -55,7 +55,6 @@ public class GuiFluidCraftingWireless extends GuiItemMonitor {
}
@Override
@SuppressWarnings("unchecked")
public void initGui() {
super.initGui();
this.buttonList.add(
@@ -3,17 +3,17 @@ package com.glodblock.github.client.gui;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.config.Upgrades;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.gui.implementations.GuiUpgradeable;
import appeng.core.localization.GuiText;
import com.glodblock.github.client.gui.container.ContainerFluidIO;
import com.glodblock.github.common.parts.PartFluidExportBus;
import com.glodblock.github.common.parts.PartFluidImportBus;
import com.glodblock.github.common.parts.base.FCSharedFluidBus;
import com.glodblock.github.util.NameConst;
import appeng.api.config.Upgrades;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.gui.implementations.GuiUpgradeable;
import appeng.core.localization.GuiText;
public class GuiFluidIO extends GuiUpgradeable {
private final FCSharedFluidBus bus;
@@ -12,24 +12,24 @@ import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.core.localization.GuiText;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerFluidInterface;
import com.glodblock.github.common.parts.PartFluidInterface;
import com.glodblock.github.inventory.IAEFluidTank;
import com.glodblock.github.inventory.IDualHost;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.gui.MouseRegionManager;
import com.glodblock.github.inventory.gui.TankMouseHandler;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.network.CPacketSwitchGuis;
import com.glodblock.github.util.NameConst;
import com.glodblock.github.util.RenderUtil;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.core.localization.GuiText;
public class GuiFluidInterface extends AEBaseGui {
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/interface_fluid.png");
@@ -66,7 +66,6 @@ public class GuiFluidInterface extends AEBaseGui {
}
@Override
@SuppressWarnings("unchecked")
public void initGui() {
super.initGui();
this.switcher = new GuiTabButton(
@@ -117,7 +116,7 @@ public class GuiFluidInterface extends AEBaseGui {
protected void actionPerformed(final GuiButton btn) {
super.actionPerformed(btn);
if (btn == this.switcher) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis(GuiType.DUAL_INTERFACE));
InventoryHandler.switchGui(GuiType.DUAL_INTERFACE);
}
}
@@ -3,28 +3,31 @@ package com.glodblock.github.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.config.*;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.gui.implementations.GuiUpgradeable;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiNumberBox;
import appeng.client.render.AppEngRenderItem;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.localization.GuiColors;
import appeng.core.localization.GuiText;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerFluidLevelEmitter;
import com.glodblock.github.common.parts.PartFluidLevelEmitter;
import com.glodblock.github.network.CPacketValueConfig;
import com.glodblock.github.util.Ae2ReflectClient;
import com.glodblock.github.util.NameConst;
import appeng.api.config.RedstoneMode;
import appeng.api.config.Settings;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.gui.implementations.GuiUpgradeable;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.MEGuiTextField;
import appeng.core.AEConfig;
import appeng.core.localization.GuiColors;
import appeng.core.localization.GuiText;
import appeng.util.calculators.ArithHelper;
import appeng.util.calculators.Calculator;
public class GuiFluidLevelEmitter extends GuiUpgradeable {
private GuiNumberBox level;
private final AppEngRenderItem stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
private MEGuiTextField amountTextField;
private GuiButton plus1;
private GuiButton plus10;
private GuiButton plus100;
@@ -33,6 +36,9 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
private GuiButton minus10;
private GuiButton minus100;
private GuiButton minus1000;
private GuiButton setButton;
private boolean isMul = false;
public GuiFluidLevelEmitter(final InventoryPlayer inventoryPlayer, final PartFluidLevelEmitter te) {
@@ -43,13 +49,12 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
public void initGui() {
super.initGui();
this.level = new GuiNumberBox(this.fontRendererObj, 24, 43, 79, this.fontRendererObj.FONT_HEIGHT, Long.class);
this.level.setEnableBackgroundDrawing(false);
this.level.setMaxStringLength(16);
this.level.setTextColor(GuiColors.LevelEmitterValue.getColor());
this.level.setVisible(true);
this.level.setFocused(true);
((ContainerFluidLevelEmitter) this.inventorySlots).setTextField(this.level);
this.amountTextField = new MEGuiTextField(90, 12);
this.amountTextField.x = this.guiLeft + 39;
this.amountTextField.y = this.guiTop + 44;
this.amountTextField.setFocused(true);
((ContainerFluidLevelEmitter) this.inventorySlots).setTextField(this.amountTextField);
this.validateText();
}
@Override
@@ -70,10 +75,19 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
this.buttonList.add(this.plus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 17, 32, 20, "+" + c));
this.buttonList.add(this.plus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 17, 38, 20, "+" + d));
this.buttonList.add(this.minus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 59, 22, 20, "-" + a));
this.buttonList.add(this.minus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 59, 28, 20, "-" + b));
this.buttonList.add(this.minus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 59, 32, 20, "-" + c));
this.buttonList.add(this.minus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 59, 38, 20, "-" + d));
this.buttonList.add(this.minus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 63, 22, 20, "-" + a));
this.buttonList.add(this.minus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 63, 28, 20, "-" + b));
this.buttonList.add(this.minus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 63, 32, 20, "-" + c));
this.buttonList.add(this.minus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 63, 38, 20, "-" + d));
this.buttonList.add(
this.setButton = new GuiButton(
0,
this.guiLeft + 134,
this.guiTop + 40,
28,
20,
GuiText.Set.getLocal()));
this.buttonList.add(this.redstoneMode);
}
@@ -81,7 +95,7 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.fontRendererObj.drawString(
NameConst.i18n(NameConst.GUI_FLUID_LEVEL_EMITTER),
getGuiDisplayName(NameConst.i18n(NameConst.GUI_FLUID_LEVEL_EMITTER)),
8,
6,
GuiColors.UpgradableTitle.getColor());
@@ -91,19 +105,18 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
this.ySize - 96 + 3,
GuiColors.UpgradableInventory.getColor());
this.redstoneMode.set(this.cvb.getRedStoneMode());
this.level.drawTextBox();
if (isShiftKeyDown() && !isMul) {
for (Object btn : this.buttonList) {
for (GuiButton btn : this.buttonList) {
if (btn instanceof GuiButton) {
((GuiButton) btn).displayString += "000";
btn.displayString += "000";
}
}
isMul = true;
} else if (!isShiftKeyDown() && isMul) {
for (Object btn : this.buttonList) {
for (GuiButton btn : this.buttonList) {
if (btn instanceof GuiButton) {
((GuiButton) btn).displayString = ((GuiButton) btn).displayString
.substring(0, ((GuiButton) btn).displayString.lastIndexOf("000"));
btn.displayString = btn.displayString.substring(0, btn.displayString.lastIndexOf("000"));
}
}
isMul = false;
@@ -113,6 +126,11 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
super.drawBG(offsetX, offsetY, mouseX, mouseY);
this.amountTextField.drawTextBox();
// Without these two lines, the liquid slot will not draw properly.
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.bindTexture(this.getBackground());
}
@Override
@@ -126,76 +144,76 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
@Override
protected void actionPerformed(final GuiButton btn) {
super.actionPerformed(btn);
final boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
final boolean isMinus = btn == this.minus1 || btn == this.minus10
|| btn == this.minus100
|| btn == this.minus1000;
if (isPlus || isMinus) {
this.addQty(this.getQty(btn));
if (btn == this.setButton && this.setButton.enabled) {
final long amount = this.getAmountLong();
this.amountTextField.setText(Long.toString(amount));
FluidCraft.proxy.netHandler.sendToServer(new CPacketValueConfig(amount, 0));
} else {
final boolean isPlus = btn == this.plus1 || btn == this.plus10
|| btn == this.plus100
|| btn == this.plus1000;
final boolean isMinus = btn == this.minus1 || btn == this.minus10
|| btn == this.minus100
|| btn == this.minus1000;
if (isPlus || isMinus) {
long result = addOrderAmount(this.getQty(btn));
this.amountTextField.setText(Long.toString(result));
}
}
}
private void addQty(final long i) {
try {
String Out = this.level.getText();
private long addOrderAmount(final int i) {
long resultL = getAmountLong();
boolean Fixed = false;
while (Out.startsWith("0") && Out.length() > 1) {
Out = Out.substring(1);
Fixed = true;
}
if (Fixed) {
this.level.setText(Out);
}
if (Out.isEmpty()) {
Out = "0";
}
long result = Long.parseLong(Out);
result += i;
if (result < 0) {
result = 0;
}
this.level.setText(Out = Long.toString(result));
FluidCraft.proxy.netHandler.sendToServer(new CPacketValueConfig(result, 0));
} catch (final NumberFormatException e) {
// nope..
this.level.setText("0");
if (resultL == 1 && i > 1) {
resultL = 0;
}
resultL += i;
if (resultL < 1) {
resultL = 1;
}
return resultL;
}
private long getAmountLong() {
String out = this.amountTextField.getText();
double resultD = Calculator.conversion(out);
if (resultD <= 0 || Double.isNaN(resultD)) {
return 0;
} else {
return (long) ArithHelper.round(resultD, 0);
}
}
private void validateText() {
String text = this.amountTextField.getText();
double resultD = Calculator.conversion(text);
this.setButton.enabled = !Double.isNaN(resultD);
}
@Override
protected void mouseClicked(int xCoord, int yCoord, int btn) {
this.amountTextField.mouseClicked(xCoord, yCoord, btn);
super.mouseClicked(xCoord, yCoord, btn);
}
@Override
protected void keyTyped(final char character, final int key) {
if (!this.checkHotbarKeys(key)) {
if ((key == 211 || key == 205 || key == 203 || key == 14 || Character.isDigit(character))
&& this.level.textboxKeyTyped(character, key)) {
try {
String Out = this.level.getText();
boolean Fixed = false;
while (Out.startsWith("0") && Out.length() > 1) {
Out = Out.substring(1);
Fixed = true;
}
if (Fixed) {
this.level.setText(Out);
}
if (Out.isEmpty()) {
Out = "0";
}
FluidCraft.proxy.netHandler.sendToServer(new CPacketValueConfig(Long.parseLong(Out), 0));
} catch (final NumberFormatException e) {
AELog.debug(e);
}
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
this.actionPerformed(this.setButton);
} else {
super.keyTyped(character, key);
boolean typedTextbox = this.amountTextField.textboxKeyTyped(character, key);
if (typedTextbox) {
this.validateText();
} else {
super.keyTyped(character, key);
}
}
}
}
@@ -4,12 +4,7 @@ import java.util.List;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.core.localization.GuiText;
import appeng.util.item.AEItemStack;
import net.minecraftforge.fluids.FluidStack;
import com.glodblock.github.client.gui.base.FCGuiMonitor;
import com.glodblock.github.client.gui.container.ContainerFluidMonitor;
@@ -17,12 +12,19 @@ import com.glodblock.github.client.me.FluidRepo;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.util.Util;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.core.localization.GuiText;
import appeng.util.item.AEItemStack;
public class GuiFluidMonitor extends FCGuiMonitor<IAEFluidStack> {
public GuiFluidMonitor(final InventoryPlayer inventoryPlayer, final ITerminalHost te,
final ContainerFluidMonitor c) {
super(inventoryPlayer, te, c);
this.repo = new FluidRepo(getScrollBar(), this);
this.setScrollBar();
}
@Override
@@ -42,6 +44,7 @@ public class GuiFluidMonitor extends FCGuiMonitor<IAEFluidStack> {
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.fontRendererObj.drawString(this.getGuiDisplayName(GuiText.Terminal.getLocal()), 8, 6, 4210752);
this.fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
super.drawFG(offsetX, offsetY, mouseX, mouseY);
}
@Override
@@ -54,8 +57,9 @@ public class GuiFluidMonitor extends FCGuiMonitor<IAEFluidStack> {
@Override
public void setTextFieldValue(String displayName, int mousex, int mousey, ItemStack stack) {
if (Util.getFluidFromItem(stack) != null) {
setSearchString(Util.getFluidFromItem(stack).getLocalizedName(), true);
final FluidStack fluid = Util.getFluidFromItem(stack);
if (fluid != null) {
setSearchString(fluid.getLocalizedName(), true);
}
}
}
@@ -0,0 +1,49 @@
package com.glodblock.github.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
import com.glodblock.github.common.parts.PartLevelTerminal;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.implementations.GuiOptimizePatterns;
import appeng.core.localization.GuiText;
public class GuiFluidOptimizePatterns extends GuiOptimizePatterns {
private GuiType originalGui;
public GuiFluidOptimizePatterns(InventoryPlayer inventoryPlayer, ITerminalHost te) {
super(inventoryPlayer, te);
if (te instanceof PartFluidPatternTerminal) {
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
} else if (te instanceof PartFluidPatternTerminalEx) {
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
} else if (te instanceof PartLevelTerminal) {
originalGui = GuiType.LEVEL_TERMINAL;
} else if (te instanceof IWirelessTerminal terminal && terminal.isUniversal(te)) {
this.originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
} else if (te instanceof WirelessPatternTerminalInventory) {
this.originalGui = GuiType.FLUID_TERMINAL;
} else if (te instanceof WirelessLevelTerminalInventory) {
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
}
}
@Override
protected void actionPerformed(GuiButton btn) {
if (btn.displayString.equals(GuiText.Cancel.getLocal())) {
InventoryHandler.switchGui(originalGui);
return;
}
super.actionPerformed(btn);
}
}
@@ -4,14 +4,14 @@ import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import appeng.client.gui.AEBaseGui;
import appeng.core.localization.GuiText;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerFluidPacketDecoder;
import com.glodblock.github.common.tile.TileFluidPacketDecoder;
import com.glodblock.github.util.NameConst;
import appeng.client.gui.AEBaseGui;
import appeng.core.localization.GuiText;
public class GuiFluidPacketDecoder extends AEBaseGui {
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/fluid_packet_decoder.png");
@@ -13,10 +13,7 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.AEBaseGui;
import appeng.client.render.AppEngRenderItem;
import appeng.core.localization.GuiText;
import org.lwjgl.opengl.GL11;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerFluidPatternEncoder;
@@ -26,16 +23,18 @@ import com.glodblock.github.inventory.gui.MouseRegionManager;
import com.glodblock.github.inventory.slot.ISlotFluid;
import com.glodblock.github.inventory.slot.SlotSingleItem;
import com.glodblock.github.network.CPacketEncodePattern;
import com.glodblock.github.util.Ae2ReflectClient;
import com.glodblock.github.util.NameConst;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.AEBaseGui;
import appeng.core.localization.GuiText;
public class GuiFluidPatternEncoder extends AEBaseGui {
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/fluid_pattern_encoder.png");
private final ContainerFluidPatternEncoder cont;
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
private final AppEngRenderItem stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
public GuiFluidPatternEncoder(InventoryPlayer ipl, TileFluidPatternEncoder tile) {
super(new ContainerFluidPatternEncoder(ipl, tile));
@@ -95,13 +94,15 @@ public class GuiFluidPatternEncoder extends AEBaseGui {
if (ItemFluidPacket.getFluidStack(stack) != null && ItemFluidPacket.getFluidStack(stack).amount > 0)
fake.setStackSize(ItemFluidPacket.getFluidStack(stack).amount);
}
stackSizeRenderer.setAeStack(fake);
stackSizeRenderer.renderItemOverlayIntoGUI(
aeRenderItem.setAeStack(fake);
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
aeRenderItem.renderItemOverlayIntoGUI(
fontRendererObj,
mc.getTextureManager(),
stack.getItemStack(),
slot.xDisplayPosition,
slot.yDisplayPosition);
GL11.glTranslatef(0.0f, 0.0f, -200.0f);
} else {
super.func_146977_a(slot);
}
@@ -109,7 +110,7 @@ public class GuiFluidPatternEncoder extends AEBaseGui {
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void renderToolTip(ItemStack stack, int x, int y) {
public void renderToolTip(ItemStack stack, int x, int y) {
List list;
if (stack.getItem() instanceof ItemFluidPacket) {
FluidStack fluid = ItemFluidPacket.getFluidStack(stack);
@@ -2,11 +2,11 @@ package com.glodblock.github.client.gui;
import net.minecraft.entity.player.InventoryPlayer;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import appeng.container.slot.AppEngSlot;
import appeng.container.slot.SlotDisabled;
import com.glodblock.github.inventory.item.IWirelessTerminal;
public class GuiFluidPatternExWireless extends GuiFluidPatternTerminalEx {
public GuiFluidPatternExWireless(InventoryPlayer inventoryPlayer, IWirelessTerminal te) {
@@ -6,6 +6,15 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.base.FCGuiEncodeTerminal;
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminal;
import com.glodblock.github.client.gui.container.ContainerFluidPatternWireless;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.network.CPacketInventoryAction;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.NameConst;
import appeng.api.config.ActionItems;
import appeng.api.config.ItemSubstitution;
import appeng.api.config.PatternBeSubstitution;
@@ -17,13 +26,7 @@ import appeng.container.slot.OptionalSlotFake;
import appeng.container.slot.SlotFakeCraftingMatrix;
import appeng.container.slot.SlotPatternTerm;
import appeng.core.localization.GuiText;
import com.glodblock.github.client.gui.base.FCGuiEncodeTerminal;
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminal;
import com.glodblock.github.client.gui.container.ContainerFluidPatternWireless;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.NameConst;
import appeng.helpers.InventoryAction;
public class GuiFluidPatternTerminal extends FCGuiEncodeTerminal {
@@ -36,7 +39,6 @@ public class GuiFluidPatternTerminal extends FCGuiEncodeTerminal {
}
@Override
@SuppressWarnings("unchecked")
public void initGui() {
super.initGui();
this.tabCraftButton = new GuiTabButton(
@@ -144,6 +146,18 @@ public class GuiFluidPatternTerminal extends FCGuiEncodeTerminal {
4210752);
}
@Override
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
if (btn == 2 && doubleBtn.mousePressed(this.mc, xCoord, yCoord)) { //
InventoryAction action = InventoryAction.SET_PATTERN_MULTI;
final CPacketInventoryAction p = new CPacketInventoryAction(action, 0, 0);
FluidCraft.proxy.netHandler.sendToServer(p);
} else super.mouseClicked(xCoord, yCoord, btn);
}
@Override
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
if (mouseButton == 3) {
@@ -1,74 +0,0 @@
package com.glodblock.github.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.implementations.GuiCraftingStatus;
import appeng.client.gui.widgets.GuiTabButton;
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
import com.glodblock.github.common.parts.PartFluidTerminal;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.inventory.item.WirelessFluidTerminalInventory;
import com.glodblock.github.inventory.item.WirelessInterfaceTerminalInventory;
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.Ae2ReflectClient;
public class GuiFluidPatternTerminalCraftingStatus extends GuiCraftingStatus {
private GuiTabButton originalGuiBtn;
private final ITerminalHost host;
public GuiFluidPatternTerminalCraftingStatus(InventoryPlayer inventoryPlayer, ITerminalHost te) {
super(inventoryPlayer, te);
host = te;
}
@Override
public void initGui() {
if (host instanceof PartFluidPatternTerminal)
Ae2ReflectClient.rewriteIcon(this, new ItemStack(ItemAndBlockHolder.FLUID_TERMINAL, 1));
else if (host instanceof PartFluidPatternTerminalEx)
Ae2ReflectClient.rewriteIcon(this, new ItemStack(ItemAndBlockHolder.FLUID_TERMINAL_EX, 1));
else if (host instanceof PartFluidTerminal) {
Ae2ReflectClient.rewriteIcon(this, new ItemStack(ItemAndBlockHolder.FLUID_TERM, 1));
} else if (host instanceof IWirelessTerminal && ((IWirelessTerminal) host).isUniversal(host)) {
Ae2ReflectClient.rewriteIcon(this, new ItemStack(ItemAndBlockHolder.WIRELESS_ULTRA_TERM, 1));
} else if (host instanceof WirelessFluidTerminalInventory) {
Ae2ReflectClient.rewriteIcon(this, new ItemStack(ItemAndBlockHolder.WIRELESS_FLUID_TERM, 1));
} else if (host instanceof WirelessPatternTerminalInventory) {
Ae2ReflectClient.rewriteIcon(this, new ItemStack(ItemAndBlockHolder.WIRELESS_PATTERN_TERM, 1));
} else if (host instanceof WirelessInterfaceTerminalInventory) {
Ae2ReflectClient.rewriteIcon(this, new ItemStack(ItemAndBlockHolder.WIRELESS_INTERFACE_TERM, 1));
}
super.initGui();
originalGuiBtn = Ae2ReflectClient.getOriginalGuiButton(this);
}
@Override
protected void actionPerformed(final GuiButton btn) {
if (btn == originalGuiBtn) {
if (host instanceof PartFluidPatternTerminal) InventoryHandler.switchGui(GuiType.FLUID_PATTERN_TERMINAL);
else if (host instanceof PartFluidPatternTerminalEx)
InventoryHandler.switchGui(GuiType.FLUID_PATTERN_TERMINAL_EX);
else if (host instanceof PartFluidTerminal) InventoryHandler.switchGui(GuiType.FLUID_TERMINAL);
else if (host instanceof IWirelessTerminal && ((IWirelessTerminal) host).isUniversal(host)) InventoryHandler
.switchGui(ItemWirelessUltraTerminal.readMode(((IWirelessTerminal) host).getItemStack()));
else if (host instanceof WirelessFluidTerminalInventory)
InventoryHandler.switchGui(GuiType.WIRELESS_FLUID_TERMINAL);
else if (host instanceof WirelessPatternTerminalInventory)
InventoryHandler.switchGui(GuiType.WIRELESS_FLUID_PATTERN_TERMINAL);
else if (host instanceof WirelessInterfaceTerminalInventory)
InventoryHandler.switchGui(GuiType.WIRELESS_INTERFACE_TERMINAL);
} else {
super.actionPerformed(btn);
}
}
}
@@ -5,19 +5,25 @@ import net.minecraft.util.StatCollector;
import org.lwjgl.input.Mouse;
import appeng.api.config.*;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.widgets.GuiImgButton;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.base.FCGuiEncodeTerminal;
import com.glodblock.github.client.gui.container.ContainerFluidPatternExWireless;
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminalEx;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
import com.glodblock.github.network.CPacketInventoryAction;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.NameConst;
import appeng.api.config.ActionItems;
import appeng.api.config.ItemSubstitution;
import appeng.api.config.PatternBeSubstitution;
import appeng.api.config.PatternSlotConfig;
import appeng.api.config.Settings;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.helpers.InventoryAction;
public class GuiFluidPatternTerminalEx extends FCGuiEncodeTerminal {
public GuiFluidPatternTerminalEx(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
@@ -33,7 +39,6 @@ public class GuiFluidPatternTerminalEx extends FCGuiEncodeTerminal {
}
@Override
@SuppressWarnings("unchecked")
public void initGui() {
super.initGui();
@@ -175,7 +180,12 @@ public class GuiFluidPatternTerminalEx extends FCGuiEncodeTerminal {
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
final int currentScroll = this.processingScrollBar.getCurrentScroll();
this.processingScrollBar.click(this, xCoord - this.guiLeft, yCoord - this.guiTop);
super.mouseClicked(xCoord, yCoord, btn);
if (btn == 2 && doubleBtn.mousePressed(this.mc, xCoord, yCoord)) { //
InventoryAction action = InventoryAction.SET_PATTERN_MULTI;
final CPacketInventoryAction p = new CPacketInventoryAction(action, 0, 0);
FluidCraft.proxy.netHandler.sendToServer(p);
} else super.mouseClicked(xCoord, yCoord, btn);
if (currentScroll != this.processingScrollBar.getCurrentScroll()) {
changeActivePage();
@@ -2,11 +2,11 @@ package com.glodblock.github.client.gui;
import net.minecraft.entity.player.InventoryPlayer;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import appeng.container.slot.AppEngSlot;
import appeng.container.slot.SlotDisabled;
import com.glodblock.github.inventory.item.IWirelessTerminal;
public class GuiFluidPatternWireless extends GuiFluidPatternTerminal {
public GuiFluidPatternWireless(InventoryPlayer inventoryPlayer, IWirelessTerminal te) {
@@ -2,12 +2,12 @@ package com.glodblock.github.client.gui;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.container.slot.AppEngSlot;
import com.glodblock.github.client.gui.container.ContainerFluidPortableCell;
import com.glodblock.github.inventory.item.IFluidPortableCell;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import appeng.container.slot.AppEngSlot;
public class GuiFluidPortableCell extends GuiFluidTerminal {
public GuiFluidPortableCell(final InventoryPlayer inventoryPlayer, final IFluidPortableCell te) {
@@ -27,4 +27,9 @@ public class GuiFluidPortableCell extends GuiFluidTerminal {
return 3;
}
}
@Override
protected boolean isPortableCell() {
return true;
}
}
@@ -6,6 +6,14 @@ import net.minecraft.entity.player.InventoryPlayer;
import org.lwjgl.input.Mouse;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerFluidStorageBus;
import com.glodblock.github.common.parts.PartFluidStorageBus;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
import com.glodblock.github.util.NameConst;
import appeng.api.config.AccessRestriction;
import appeng.api.config.ActionItems;
import appeng.api.config.Settings;
@@ -18,14 +26,6 @@ import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketConfigButton;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerFluidStorageBus;
import com.glodblock.github.common.parts.PartFluidStorageBus;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
import com.glodblock.github.network.CPacketSwitchGuis;
import com.glodblock.github.util.NameConst;
public class GuiFluidStorageBus extends GuiUpgradeable {
private GuiImgButton rwMode;
@@ -39,7 +39,6 @@ public class GuiFluidStorageBus extends GuiUpgradeable {
}
@Override
@SuppressWarnings("unchecked")
protected void addButtons() {
this.clear = new GuiImgButton(this.guiLeft - 18, this.guiTop + 8, Settings.ACTIONS, ActionItems.CLOSE);
this.partition = new GuiImgButton(this.guiLeft - 18, this.guiTop + 28, Settings.ACTIONS, ActionItems.WRENCH);
@@ -93,7 +92,7 @@ public class GuiFluidStorageBus extends GuiUpgradeable {
} else if (btn == this.clear) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("StorageBus.Action", "Clear"));
} else if (btn == this.priority) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis(GuiType.PRIORITY));
InventoryHandler.switchGui(GuiType.PRIORITY);
} else if (btn == this.rwMode) {
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.rwMode.getSetting(), backwards));
}
@@ -1,8 +1,5 @@
package com.glodblock.github.client.gui;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.texture.TextureMap;
@@ -10,30 +7,30 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.me.SlotME;
import appeng.client.render.AppEngRenderItem;
import appeng.container.slot.AppEngSlot;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerFluidMonitor;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.network.CPacketFluidUpdate;
import com.glodblock.github.util.Ae2ReflectClient;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.Util;
import com.mitchej123.hodgepodge.textures.IPatchedTextureAtlasSprite;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.me.SlotME;
import appeng.container.slot.AppEngSlot;
public class GuiFluidTerminal extends GuiFluidMonitor {
private final AppEngRenderItem stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
protected EntityPlayer player;
public ContainerFluidMonitor container;
@@ -81,45 +78,48 @@ public class GuiFluidTerminal extends GuiFluidMonitor {
if (stack == null) return true;
FluidStack fluidStack = ItemFluidDrop.getFluidStack(slot.getStack());
this.drawWidget(slot.xDisplayPosition, slot.yDisplayPosition, fluidStack.getFluid());
stackSizeRenderer.setAeStack(stack);
stackSizeRenderer.renderItemOverlayIntoGUI(
aeRenderItem.setAeStack(stack);
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
aeRenderItem.renderItemOverlayIntoGUI(
fontRendererObj,
mc.getTextureManager(),
stack.getItemStack(),
slot.xDisplayPosition,
slot.yDisplayPosition);
GL11.glTranslatef(0.0f, 0.0f, -200.0f);
return false;
}
return true;
}
private void drawWidget(int posX, int posY, Fluid fluid) {
if (fluid == null) return;
IIcon icon = fluid.getIcon();
if (icon == null) return;
if (ModAndClassUtil.HODGEPODGE && icon instanceof IPatchedTextureAtlasSprite) {
((IPatchedTextureAtlasSprite) icon).markNeedsAnimationUpdate();
}
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor3f(1, 1, 1);
if (fluid != null && fluid.getIcon() != null) {
GL11.glColor3f(
(fluid.getColor() >> 16 & 0xFF) / 255.0F,
(fluid.getColor() >> 8 & 0xFF) / 255.0F,
(fluid.getColor() & 0xFF) / 255.0F);
drawTexturedModelRectFromIcon(posX, posY, fluid.getIcon(), 16, 16);
}
GL11.glColor3f(
(fluid.getColor() >> 16 & 0xFF) / 255.0F,
(fluid.getColor() >> 8 & 0xFF) / 255.0F,
(fluid.getColor() & 0xFF) / 255.0F);
drawTexturedModelRectFromIcon(posX, posY, fluid.getIcon(), 16, 16);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glColor3f(1, 1, 1);
}
@Override
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
if (slot instanceof SlotME && Util.FluidUtil.isFluidContainer(player.inventory.getItemStack())) {
Map<Integer, IAEFluidStack> tmp = new HashMap<>();
ItemStack itemStack = this.player.inventory.getItemStack().copy();
tmp.put(0, ItemFluidDrop.getAeFluidStack(((SlotME) slot).getAEStack()));
if (!isShiftKeyDown()) {
itemStack.stackSize = 1;
}
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(tmp, itemStack));
IAEFluidStack fluid = ItemFluidDrop.getAeFluidStack(((SlotME) slot).getAEStack());
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(fluid, isShiftKeyDown()));
}
if (mouseButton == 3 && slot instanceof SlotME) {
return;
@@ -8,10 +8,6 @@ import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.gui.AEBaseGui;
import appeng.core.localization.GuiText;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerIngredientBuffer;
import com.glodblock.github.common.tile.TileIngredientBuffer;
@@ -22,6 +18,10 @@ import com.glodblock.github.inventory.gui.TankMouseHandler;
import com.glodblock.github.util.NameConst;
import com.glodblock.github.util.RenderUtil;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.gui.AEBaseGui;
import appeng.core.localization.GuiText;
public class GuiIngredientBuffer extends AEBaseGui {
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/ingredient_buffer.png");
@@ -1,748 +0,0 @@
package com.glodblock.github.client.gui;
import java.util.*;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import appeng.api.AEApi;
import appeng.api.config.*;
import appeng.api.util.WorldCoord;
import appeng.client.gui.widgets.*;
import appeng.client.me.ClientDCInternalInv;
import appeng.client.me.SlotDisconnected;
import appeng.client.render.BlockPosHighlighter;
import appeng.container.slot.AppEngSlot;
import appeng.core.AEConfig;
import appeng.core.CommonHelper;
import appeng.core.localization.ButtonToolTips;
import appeng.core.localization.GuiColors;
import appeng.core.localization.GuiText;
import appeng.core.localization.PlayerMessages;
import appeng.helpers.PatternHelper;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.util.Platform;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.base.FCBaseMEGui;
import com.glodblock.github.client.gui.container.ContainerInterfaceWireless;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.network.CPacketRenamer;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.Util;
import com.google.common.collect.HashMultimap;
public class GuiInterfaceTerminalWireless extends FCBaseMEGui implements IDropToFillTextField {
protected int offsetY;
private static final int MAGIC_HEIGHT_NUMBER = 52 + 99;
private static final int offsetX = 21;
private final HashMap<Long, ClientDCInternalInv> byId = new HashMap<>();
private final HashMultimap<String, ClientDCInternalInv> byName = HashMultimap.create();
private final HashMap<ClientDCInternalInv, Util.DimensionalCoordSide> blockPosHashMap = new HashMap<>();
private final HashMap<GuiButton, ClientDCInternalInv> guiButtonHashMap = new HashMap<>();
private final ArrayList<String> names = new ArrayList<>();
private final ArrayList<Object> lines = new ArrayList<>();
private final Set<Object> matchedStacks = new HashSet<>();
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
protected static String searchFieldOutputsText = "";
protected static String searchFieldInputsText = "";
protected static String searchFieldNamesText = "";
private final MEGuiTextField searchFieldOutputs;
private final MEGuiTextField searchFieldInputs;
private final MEGuiTextField searchFieldNames;
private final GuiImgButton guiButtonHideFull;
private final GuiImgButton guiButtonAssemblersOnly;
private final GuiImgButton guiButtonBrokenRecipes;
private GuiImgButton searchStringSave;
private GuiImgButton terminalStyleBox;
private boolean refreshList = false;
protected static boolean onlyMolecularAssemblers = false;
protected static boolean onlyBrokenRecipes = false;
protected GuiTabButton craftingStatusBtn;
// private final IConfigManager configSrc;
private int rows = 3;
private static final String MOLECULAR_ASSEMBLER = "tile.appliedenergistics2.BlockMolecularAssembler";
public GuiInterfaceTerminalWireless(final InventoryPlayer inventoryPlayer, final IWirelessTerminal te) {
super(inventoryPlayer, new ContainerInterfaceWireless(inventoryPlayer, te));
this.setScrollBar(new GuiScrollbar());
this.xSize = 208;
this.ySize = 255;
searchFieldInputs = new MEGuiTextField(86, 12, ButtonToolTips.SearchFieldInputs.getLocal()) {
@Override
public void onTextChange(final String oldText) {
refreshList();
}
};
searchFieldOutputs = new MEGuiTextField(86, 12, ButtonToolTips.SearchFieldOutputs.getLocal()) {
@Override
public void onTextChange(final String oldText) {
refreshList();
}
};
searchFieldNames = new MEGuiTextField(71, 12, ButtonToolTips.SearchFieldNames.getLocal()) {
@Override
public void onTextChange(final String oldText) {
refreshList();
}
};
searchFieldNames.setFocused(true);
guiButtonAssemblersOnly = new GuiImgButton(0, 0, Settings.ACTIONS, null);
guiButtonHideFull = new GuiImgButton(0, 0, Settings.ACTIONS, null);
guiButtonBrokenRecipes = new GuiImgButton(0, 0, Settings.ACTIONS, null);
}
@Override
public int getOffsetY() {
return this.offsetY;
}
@Override
public void setOffsetY(int y) {
this.offsetY = y;
}
private void setScrollBar() {
this.getScrollBar().setTop(52).setLeft(189).setHeight(this.rows * 18 - 2);
this.getScrollBar().setRange(0, this.lines.size() - this.rows, 2);
}
@Override
public void initGui() {
super.initGui();
this.rows = calculateRowsCount();
this.ySize = MAGIC_HEIGHT_NUMBER + this.rows * 18;
final int unusedSpace = this.height - this.ySize;
this.guiTop = (int) Math.floor(unusedSpace / (unusedSpace < 0 ? 3.8f : 2.0f));
this.offsetY = this.guiTop + 8;
this.buttonList.add(
this.terminalStyleBox = new GuiImgButton(
this.guiLeft - 18,
this.offsetY,
Settings.TERMINAL_STYLE,
AEConfig.instance.settings.getSetting(Settings.TERMINAL_STYLE)));
this.offsetY += 20;
this.buttonList.add(
this.searchStringSave = new GuiImgButton(
this.guiLeft - 18,
this.offsetY,
Settings.SAVE_SEARCH,
AEConfig.instance.settings.getSetting(Settings.SAVE_SEARCH)));
this.offsetY += 20;
searchFieldInputs.x = guiLeft + Math.max(32, offsetX);
searchFieldInputs.y = guiTop + 25;
searchFieldOutputs.x = guiLeft + Math.max(32, offsetX);
searchFieldOutputs.y = guiTop + 38;
searchFieldNames.x = guiLeft + Math.max(32, offsetX) + 99;
searchFieldNames.y = guiTop + 38;
guiButtonAssemblersOnly.xPosition = guiLeft + Math.max(32, offsetX) + 99;
guiButtonAssemblersOnly.yPosition = guiTop + 20;
guiButtonHideFull.xPosition = guiButtonAssemblersOnly.xPosition + 18;
guiButtonHideFull.yPosition = guiTop + 20;
guiButtonBrokenRecipes.xPosition = guiButtonHideFull.xPosition + 18;
guiButtonBrokenRecipes.yPosition = guiTop + 20;
terminalStyleBox.xPosition = guiLeft - 18;
terminalStyleBox.yPosition = guiTop + 8;
this.buttonList.add(
this.craftingStatusBtn = new GuiTabButton(
this.guiLeft + this.xSize - 24,
this.guiTop - 4,
2 + 11 * 16,
GuiText.CraftingStatus.getLocal(),
itemRender));
this.craftingStatusBtn.setHideEdge(13); // GuiTabButton implementation //
if (ModAndClassUtil.isSearchBar && (AEConfig.instance.preserveSearchBar || this.isSubGui())) {
setSearchString();
}
this.setScrollBar();
this.repositionSlots();
this.initGuiDone();
}
@Override
public void onGuiClosed() {
super.onGuiClosed();
searchFieldOutputsText = this.searchFieldOutputs.getText();
searchFieldInputsText = this.searchFieldInputs.getText();
searchFieldNamesText = this.searchFieldNames.getText();
}
public void setSearchString() {
this.searchFieldOutputs.setText(searchFieldOutputsText);
this.searchFieldInputs.setText(searchFieldInputsText);
this.searchFieldNames.setText(searchFieldNamesText);
}
protected void repositionSlots() {
for (final Object obj : this.inventorySlots.inventorySlots) {
if (obj instanceof AppEngSlot) {
final AppEngSlot slot = (AppEngSlot) obj;
slot.yDisplayPosition = this.ySize + slot.getY() - 78 - 7;
}
}
}
protected int calculateRowsCount() {
final int maxRows = this.getMaxRows();
final boolean hasNEI = IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.NEI);
final int NEIPadding = hasNEI ? 22 /* input */ + 18 /* top panel */ : 0;
final int extraSpace = this.height - MAGIC_HEIGHT_NUMBER - NEIPadding;
return Math.max(3, Math.min(maxRows, extraSpace / 18));
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
fontRendererObj.drawString(
getGuiDisplayName(GuiText.InterfaceTerminal.getLocal()),
8,
6,
GuiColors.InterfaceTerminalTitle.getColor());
fontRendererObj.drawString(
GuiText.inventory.getLocal(),
GuiInterfaceTerminalWireless.offsetX + 2,
this.ySize - 96,
GuiColors.InterfaceTerminalInventory.getColor());
int offset = 51;
final int ex = getScrollBar().getCurrentScroll();
for (int x = 0; x < this.rows && ex + x < this.lines.size(); x++) {
final Object lineObj = this.lines.get(ex + x);
if (lineObj instanceof ClientDCInternalInv) {
final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
for (int z = 0; z < inv.getInventory().getSizeInventory(); z++) {
if (this.matchedStacks.contains(inv.getInventory().getStackInSlot(z))) drawRect(
z * 18 + 22,
1 + offset,
z * 18 + 22 + 16,
1 + offset + 16,
GuiColors.InterfaceTerminalMatch.getColor());
}
} else if (lineObj instanceof String) {
String name = (String) lineObj;
final int rows = this.byName.get(name).size();
String postfix = "";
if (rows > 1) {
postfix = " (" + rows + ')';
}
while (name.length() > 2 && this.fontRendererObj.getStringWidth(name + postfix) > 158) {
name = name.substring(0, name.length() - 1);
}
this.fontRendererObj.drawString(
name + postfix,
GuiInterfaceTerminalWireless.offsetX + 3,
6 + offset,
GuiColors.InterfaceTerminalName.getColor());
}
offset += 18;
}
}
@Override
public void drawScreen(final int mouseX, final int mouseY, final float btn) {
buttonList.clear();
inventorySlots.inventorySlots.removeIf(slot -> slot instanceof SlotDisconnected);
guiButtonAssemblersOnly.set(
onlyMolecularAssemblers ? ActionItems.MOLECULAR_ASSEMBLEERS_ON : ActionItems.MOLECULAR_ASSEMBLEERS_OFF);
guiButtonHideFull.set(
AEConfig.instance.showOnlyInterfacesWithFreeSlotsInInterfaceTerminal
? ActionItems.TOGGLE_SHOW_FULL_INTERFACES_OFF
: ActionItems.TOGGLE_SHOW_FULL_INTERFACES_ON);
guiButtonBrokenRecipes.set(
onlyBrokenRecipes ? ActionItems.TOGGLE_SHOW_ONLY_INVALID_PATTERN_OFF
: ActionItems.TOGGLE_SHOW_ONLY_INVALID_PATTERN_ON);
terminalStyleBox.set(AEConfig.instance.settings.getSetting(Settings.TERMINAL_STYLE));
buttonList.add(guiButtonAssemblersOnly);
buttonList.add(guiButtonHideFull);
buttonList.add(guiButtonBrokenRecipes);
buttonList.add(terminalStyleBox);
buttonList.add(searchStringSave);
buttonList.add(craftingStatusBtn);
this.guiButtonHashMap.clear();
addSwitchGuiBtns();
int offset = 51;
final int ex = this.getScrollBar().getCurrentScroll();
for (int x = 0; x < this.rows && ex + x < this.lines.size(); x++) {
final Object lineObj = this.lines.get(ex + x);
if (lineObj instanceof ClientDCInternalInv) {
final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
for (int z = 0; z < inv.getInventory().getSizeInventory(); z++) {
inventorySlots.inventorySlots.add(new SlotDisconnected(inv, z, z * 18 + 22, 1 + offset));
}
GuiButton guiButton = new GuiImgButton(
guiLeft + 4,
guiTop + offset + 1,
Settings.ACTIONS,
ActionItems.HIGHLIGHT_INTERFACE);
GuiFCImgButton editButton = new GuiFCImgButton(guiLeft + 4, guiTop + offset + 1, "EDIT", "YES");
guiButtonHashMap.put(guiButton, inv);
guiButtonHashMap.put(editButton, inv);
if (isShiftKeyDown()) {
buttonList.add(editButton);
} else {
buttonList.add(guiButton);
}
}
offset += 18;
}
super.drawScreen(mouseX, mouseY, btn);
handleTooltip(mouseX, mouseY, searchFieldInputs);
handleTooltip(mouseX, mouseY, searchFieldOutputs);
handleTooltip(mouseX, mouseY, searchFieldNames);
}
@Override
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
searchFieldInputs.mouseClicked(xCoord, yCoord, btn);
searchFieldOutputs.mouseClicked(xCoord, yCoord, btn);
searchFieldNames.mouseClicked(xCoord, yCoord, btn);
super.mouseClicked(xCoord, yCoord, btn);
}
@Override
protected void actionPerformed(final GuiButton btn) {
if (guiButtonHashMap.containsKey(btn)) {
Util.DimensionalCoordSide blockPos = blockPosHashMap.get(guiButtonHashMap.get(btn));
if (btn instanceof GuiFCImgButton) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketRenamer(
blockPos.x,
blockPos.y,
blockPos.z,
blockPos.getDimension(),
blockPos.getSide()));
} else {
WorldCoord blockPos2 = new WorldCoord(
(int) mc.thePlayer.posX,
(int) mc.thePlayer.posY,
(int) mc.thePlayer.posZ);
if (mc.theWorld.provider.dimensionId != blockPos.getDimension()) {
mc.thePlayer.addChatMessage(
new ChatComponentTranslation(
PlayerMessages.InterfaceInOtherDim.getName(),
blockPos.getDimension()));
} else {
BlockPosHighlighter.highlightBlock(
blockPos,
System.currentTimeMillis() + 500 * WorldCoord.getTaxicabDistance(blockPos, blockPos2));
mc.thePlayer.addChatMessage(
new ChatComponentTranslation(
PlayerMessages.InterfaceHighlighted.getName(),
blockPos.x,
blockPos.y,
blockPos.z));
}
mc.thePlayer.closeScreen();
}
} else if (btn == guiButtonHideFull) {
AEConfig.instance.showOnlyInterfacesWithFreeSlotsInInterfaceTerminal = !AEConfig.instance.showOnlyInterfacesWithFreeSlotsInInterfaceTerminal;
this.refreshList();
} else if (btn == guiButtonAssemblersOnly) {
onlyMolecularAssemblers = !onlyMolecularAssemblers;
this.refreshList();
} else if (btn == guiButtonBrokenRecipes) {
onlyBrokenRecipes = !onlyBrokenRecipes;
this.refreshList();
} else if (ModAndClassUtil.isSaveText && btn == searchStringSave) {
final boolean backwards = Mouse.isButtonDown(1);
final GuiImgButton iBtn = (GuiImgButton) btn;
final Enum<?> cv = iBtn.getCurrentValue();
final Enum<?> next = Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
AEConfig.instance.preserveSearchBar = next == YesNo.YES;
AEConfig.instance.settings.putSetting(Settings.SAVE_SEARCH, next);
this.searchStringSave.set(next);
} else if (btn == craftingStatusBtn) {
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
} else if (btn instanceof GuiImgButton) {
final GuiImgButton iBtn = (GuiImgButton) btn;
if (iBtn.getSetting() != Settings.ACTIONS) {
final Enum cv = iBtn.getCurrentValue();
final boolean backwards = Mouse.isButtonDown(1);
final Enum next = Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
if (btn == this.terminalStyleBox) {
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
this.reinitialize();
}
iBtn.set(next);
}
}
super.actionPerformed(btn);
}
private void reinitialize() {
this.buttonList.clear();
this.initGui();
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.bindTexture("guis/newinterfaceterminal.png");
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, 53);
int offset = 51;
final int ex = this.getScrollBar().getCurrentScroll();
for (int x = 0; x < this.rows; x++) {
this.drawTexturedModalRect(offsetX, offsetY + 53 + x * 18, 0, 52, this.xSize, 18);
}
for (int x = 0; x < this.rows && ex + x < this.lines.size(); x++) {
final Object lineObj = this.lines.get(ex + x);
if (lineObj instanceof ClientDCInternalInv) {
final ClientDCInternalInv inv = (ClientDCInternalInv) lineObj;
GL11.glColor4f(1, 1, 1, 1);
final int width = inv.getInventory().getSizeInventory() * 18;
this.drawTexturedModalRect(offsetX + 20, offsetY + offset, 20, 173, width, 18);
}
offset += 18;
}
this.drawTexturedModalRect(offsetX, offsetY + 50 + this.rows * 18, 0, 158, this.xSize, 99);
searchFieldInputs.drawTextBox();
searchFieldOutputs.drawTextBox();
searchFieldNames.drawTextBox();
}
@Override
protected void keyTyped(final char character, final int key) {
if (!checkHotbarKeys(key)) {
if (character == ' ') {
if ((searchFieldInputs.getText().isEmpty() && searchFieldInputs.isFocused())
|| (searchFieldOutputs.getText().isEmpty() && searchFieldOutputs.isFocused())
|| (searchFieldNames.getText().isEmpty() && searchFieldNames.isFocused()))
return;
} else if (character == '\t') {
if (handleTab()) return;
}
if (searchFieldInputs.textboxKeyTyped(character, key) || searchFieldOutputs.textboxKeyTyped(character, key)
|| searchFieldNames.textboxKeyTyped(character, key)) {
refreshList();
} else {
super.keyTyped(character, key);
}
}
}
private boolean handleTab() {
if (searchFieldInputs.isFocused()) {
searchFieldInputs.setFocused(false);
if (isShiftKeyDown()) searchFieldNames.setFocused(true);
else searchFieldOutputs.setFocused(true);
return true;
} else if (searchFieldOutputs.isFocused()) {
searchFieldOutputs.setFocused(false);
if (isShiftKeyDown()) searchFieldInputs.setFocused(true);
else searchFieldNames.setFocused(true);
return true;
} else if (searchFieldNames.isFocused()) {
searchFieldNames.setFocused(false);
if (isShiftKeyDown()) searchFieldOutputs.setFocused(true);
else searchFieldInputs.setFocused(true);
return true;
}
return false;
}
public void postUpdate(final NBTTagCompound in) {
if (in.getBoolean("clear")) {
this.byId.clear();
this.refreshList = true;
}
for (final Object oKey : in.func_150296_c()) {
final String key = (String) oKey;
if (key.startsWith("=")) {
try {
final long id = Long.parseLong(key.substring(1), Character.MAX_RADIX);
final NBTTagCompound invData = in.getCompoundTag(key);
final ClientDCInternalInv current = this
.getById(id, invData.getLong("sortBy"), invData.getString("un"));
int X = invData.getInteger("x");
int Y = invData.getInteger("y");
int Z = invData.getInteger("z");
int dim = invData.getInteger("dim");
ForgeDirection side = ForgeDirection.getOrientation(invData.getInteger("side"));
blockPosHashMap.put(
current,
new Util.DimensionalCoordSide(X, Y, Z, dim, side, current.getUnlocalizedName()));
for (int x = 0; x < current.getInventory().getSizeInventory(); x++) {
final String which = Integer.toString(x);
if (invData.hasKey(which)) {
current.getInventory().setInventorySlotContents(
x,
ItemStack.loadItemStackFromNBT(invData.getCompoundTag(which)));
}
}
} catch (final NumberFormatException ignored) {}
}
}
if (this.refreshList) {
this.refreshList = false;
// invalid caches on refresh
this.cachedSearches.clear();
this.refreshList();
}
}
/**
* Rebuilds the list of interfaces.
* <p>
* Respects a search term if present (ignores case) and adding only matching patterns.
*/
private void refreshList() {
this.byName.clear();
this.buttonList.clear();
this.matchedStacks.clear();
final String searchFieldInputs = this.searchFieldInputs.getText().toLowerCase();
final String searchFieldOutputs = this.searchFieldOutputs.getText().toLowerCase();
final String searchFieldNames = this.searchFieldNames.getText().toLowerCase();
final Set<Object> cachedSearch = this.getCacheForSearchTerm(
"IN:" + searchFieldInputs
+ "OUT:"
+ searchFieldOutputs
+ "NAME:"
+ searchFieldNames
+ AEConfig.instance.showOnlyInterfacesWithFreeSlotsInInterfaceTerminal
+ onlyMolecularAssemblers
+ onlyBrokenRecipes);
final boolean rebuild = cachedSearch.isEmpty();
for (final ClientDCInternalInv entry : this.byId.values()) {
// ignore inventory if not doing a full rebuild and cache already marks it as miss.
if (!rebuild && !cachedSearch.contains(entry)) {
continue;
}
// Shortcut to skip any filter if search term is ""/empty
boolean found = searchFieldInputs.isEmpty() && searchFieldOutputs.isEmpty();
boolean interfaceHasFreeSlots = false;
boolean interfaceHasBrokenRecipes = false;
// Search if the current inventory holds a pattern containing the search term.
if (!found || AEConfig.instance.showOnlyInterfacesWithFreeSlotsInInterfaceTerminal || onlyBrokenRecipes) {
for (final ItemStack itemStack : entry.getInventory()) {
// If only Interfaces with empty slots should be shown, check that here
if (itemStack == null) {
interfaceHasFreeSlots = true;
continue;
}
if (onlyBrokenRecipes && recipeIsBroken(itemStack)) {
interfaceHasBrokenRecipes = true;
}
if ((!searchFieldInputs.isEmpty() && itemStackMatchesSearchTerm(itemStack, searchFieldInputs, 0))
|| (!searchFieldOutputs.isEmpty()
&& itemStackMatchesSearchTerm(itemStack, searchFieldOutputs, 1))) {
found = true;
matchedStacks.add(itemStack);
}
}
}
if ((found && entry.getName().toLowerCase().contains(searchFieldNames))
&& (!onlyMolecularAssemblers || entry.getUnlocalizedName().contains(MOLECULAR_ASSEMBLER))
&& (!AEConfig.instance.showOnlyInterfacesWithFreeSlotsInInterfaceTerminal || interfaceHasFreeSlots)
&& (!onlyBrokenRecipes || interfaceHasBrokenRecipes)) {
this.byName.put(entry.getName(), entry);
cachedSearch.add(entry);
} else {
cachedSearch.remove(entry);
}
}
this.names.clear();
this.names.addAll(this.byName.keySet());
Collections.sort(this.names);
this.lines.clear();
this.lines.ensureCapacity(this.names.size() + this.byId.size());
for (final String n : this.names) {
this.lines.add(n);
final ArrayList<ClientDCInternalInv> clientInventories = new ArrayList<>(this.byName.get(n));
Collections.sort(clientInventories);
this.lines.addAll(clientInventories);
}
this.setScrollBar();
}
private boolean itemStackMatchesSearchTerm(final ItemStack itemStack, final String searchTerm, int pass) {
if (itemStack == null) {
return false;
}
final NBTTagCompound encodedValue = itemStack.getTagCompound();
if (encodedValue == null) {
return false;
}
final NBTTagList tags = encodedValue.getTagList(pass == 0 ? "in" : "out", 10);
final boolean containsInvalidDisplayName = GuiText.UnknownItem.getLocal().toLowerCase().contains(searchTerm);
for (int i = 0; i < tags.tagCount(); i++) {
final NBTTagCompound tag = tags.getCompoundTagAt(i);
final ItemStack parsedItemStack = ItemStack.loadItemStackFromNBT(tag);
if (parsedItemStack != null) {
final String displayName = Platform
.getItemDisplayName(AEApi.instance().storage().createItemStack(parsedItemStack)).toLowerCase();
if (displayName.contains(searchTerm)) {
return true;
}
} else if (containsInvalidDisplayName && !tag.hasNoTags()) {
return true;
}
}
return false;
}
private boolean recipeIsBroken(final ItemStack itemStack) {
if (itemStack == null) {
return false;
}
final NBTTagCompound encodedValue = itemStack.getTagCompound();
if (encodedValue == null) {
return true;
}
final World w = CommonHelper.proxy.getWorld();
if (w == null) {
return false;
}
try {
new PatternHelper(itemStack, w);
return false;
} catch (final Throwable t) {
return true;
}
}
/**
* Tries to retrieve a cache for a with search term as keyword.
* <p>
* If this cache should be empty, it will populate it with an earlier cache if available or at least the cache for
* the empty string.
*
* @param searchTerm the corresponding search
* @return a Set matching a superset of the search term
*/
private Set<Object> getCacheForSearchTerm(final String searchTerm) {
if (!this.cachedSearches.containsKey(searchTerm)) {
this.cachedSearches.put(searchTerm, new HashSet<>());
}
final Set<Object> cache = this.cachedSearches.get(searchTerm);
if (cache.isEmpty() && searchTerm.length() > 1) {
cache.addAll(this.getCacheForSearchTerm(searchTerm.substring(0, searchTerm.length() - 1)));
return cache;
}
return cache;
}
private int getMaxRows() {
return AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) == TerminalStyle.SMALL
? AEConfig.instance.InterfaceTerminalSmallSize
: Integer.MAX_VALUE;
}
private ClientDCInternalInv getById(final long id, final long sortBy, final String unlocalizedName) {
ClientDCInternalInv o = this.byId.get(id);
if (o == null) {
this.byId.put(id, o = new ClientDCInternalInv(9, id, sortBy, unlocalizedName));
this.refreshList = true;
}
return o;
}
public boolean isOverTextField(final int mousex, final int mousey) {
return searchFieldInputs.isMouseIn(mousex, mousey) || searchFieldOutputs.isMouseIn(mousex, mousey)
|| searchFieldNames.isMouseIn(mousex, mousey);
}
public void setTextFieldValue(final String displayName, final int mousex, final int mousey, final ItemStack stack) {
if (searchFieldInputs.isMouseIn(mousex, mousey)) {
searchFieldInputs.setText(displayName);
} else if (searchFieldOutputs.isMouseIn(mousex, mousey)) {
searchFieldOutputs.setText(displayName);
} else if (searchFieldNames.isMouseIn(mousex, mousey)) {
searchFieldNames.setText(displayName);
}
}
}
@@ -0,0 +1,107 @@
package com.glodblock.github.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import com.glodblock.github.client.gui.container.ContainerInterfaceWireless;
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.util.ModAndClassUtil;
import appeng.client.gui.implementations.GuiInterfaceTerminal;
public class GuiInterfaceWireless extends GuiInterfaceTerminal {
protected GuiFCImgButton FluidTerminal;
protected GuiFCImgButton CraftingTerminal;
protected GuiFCImgButton PatternTerminal;
protected GuiFCImgButton EssentiaTerminal;
protected GuiFCImgButton InterfaceTerminal;
protected GuiFCImgButton LevelTerminal;
protected GuiFCImgButton PatternTerminalEx;
public GuiInterfaceWireless(final InventoryPlayer inventoryPlayer, final IWirelessTerminal te) {
super(new ContainerInterfaceWireless(inventoryPlayer, te));
}
@Override
public void initGui() {
super.initGui();
drawSwitchGuiBtns();
}
protected void drawSwitchGuiBtns() {
this.buttonList.add(this.CraftingTerminal = new GuiFCImgButton(this.guiLeft - 18, offsetY, "CRAFT_TEM", "YES"));
offsetY += 20;
this.buttonList
.add(this.PatternTerminal = new GuiFCImgButton(this.guiLeft - 18, offsetY, "PATTERN_TEM", "YES"));
offsetY += 20;
this.buttonList
.add(this.PatternTerminalEx = new GuiFCImgButton(this.guiLeft - 18, offsetY, "PATTERN_EX_TEM", "YES"));
offsetY += 20;
this.buttonList.add(this.FluidTerminal = new GuiFCImgButton(this.guiLeft - 18, offsetY, "FLUID_TEM", "YES"));
offsetY += 20;
this.buttonList.add(this.LevelTerminal = new GuiFCImgButton(this.guiLeft - 18, offsetY, "LEVEL_TEM", "YES"));
offsetY += 20;
if (ModAndClassUtil.ThE) {
this.buttonList
.add(this.EssentiaTerminal = new GuiFCImgButton(this.guiLeft - 18, offsetY, "ESSENTIA_TEM", "YES"));
offsetY += 20;
}
}
private boolean scheduleGuiResize;
@Override
protected void mouseClicked(int xCoord, int yCoord, int btn) {
super.mouseClicked(xCoord, yCoord, btn);
if (scheduleGuiResize) {
// in the GuiScreen class, the implementation of super.mouseClicked
// ends up looping on the button list and execute the action for any
// button below the mouse.
// Therefore, if we initGui() the terminal in the actionPerformed method below
// it will run the actionPerformed a second time for the new button
// that will end up being below the mouse (if any) after the initGui()
buttonList.clear();
initGui();
scheduleGuiResize = false;
}
}
protected final void scheduleGuiResize() {
scheduleGuiResize = true;
}
@Override
protected void actionPerformed(final GuiButton btn) {
if (btn instanceof GuiFCImgButton) {
if (btn == this.FluidTerminal) {
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_FLUID_TERMINAL);
} else if (btn == this.CraftingTerminal) {
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_CRAFTING_TERMINAL);
} else if (btn == this.EssentiaTerminal) {
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_ESSENTIA_TERMINAL);
} else if (btn == this.PatternTerminal) {
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_FLUID_PATTERN_TERMINAL);
} else if (btn == this.InterfaceTerminal) {
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_INTERFACE_TERMINAL);
} else if (btn == this.LevelTerminal) {
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_LEVEL_TERMINAL);
} else if (btn == this.PatternTerminalEx) {
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_FLUID_PATTERN_TERMINAL_EX);
}
}
super.actionPerformed(btn);
if (btn == this.terminalStyleBox) {
scheduleGuiResize();
}
}
}
@@ -5,16 +5,14 @@ import java.util.List;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import com.glodblock.github.client.gui.base.FCGuiMonitor;
import com.glodblock.github.client.gui.container.ContainerItemMonitor;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.me.ItemRepo;
import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import com.glodblock.github.client.gui.base.FCGuiMonitor;
import com.glodblock.github.client.gui.container.ContainerItemMonitor;
import com.glodblock.github.util.ModAndClassUtil;
public class GuiItemMonitor extends FCGuiMonitor<IAEItemStack> {
public GuiItemMonitor(final InventoryPlayer inventoryPlayer, final ITerminalHost te, final ContainerItemMonitor c) {
@@ -37,13 +35,7 @@ public class GuiItemMonitor extends FCGuiMonitor<IAEItemStack> {
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.fontRendererObj.drawString(this.getGuiDisplayName(GuiText.Terminal.getLocal()), 8, 6, 4210752);
this.fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
}
@Override
public void drawScreen(final int mouseX, final int mouseY, final float btn) {
super.drawScreen(mouseX, mouseY, btn);
if (ModAndClassUtil.isSearchBar && AEConfig.instance.preserveSearchBar && searchField != null)
handleTooltip(mouseX, mouseY, searchField.new TooltipProvider());
super.drawFG(offsetX, offsetY, mouseX, mouseY);
}
@Override
@@ -8,10 +8,6 @@ import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.gui.AEBaseGui;
import appeng.core.localization.GuiText;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerLargeIngredientBuffer;
import com.glodblock.github.common.tile.TileLargeIngredientBuffer;
@@ -22,6 +18,10 @@ import com.glodblock.github.inventory.gui.TankMouseHandler;
import com.glodblock.github.util.NameConst;
import com.glodblock.github.util.RenderUtil;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.gui.AEBaseGui;
import appeng.core.localization.GuiText;
public class GuiLargeIngredientBuffer extends AEBaseGui {
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/large_ingredient_buffer.png");
@@ -1,6 +1,6 @@
package com.glodblock.github.client.gui;
import java.awt.*;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -11,31 +11,48 @@ import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.api.registries.LevelState;
import com.glodblock.github.client.gui.container.ContainerLevelMaintainer;
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
import com.glodblock.github.common.parts.PartLevelTerminal;
import com.glodblock.github.common.tile.TileLevelMaintainer;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.gui.MouseRegionManager;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
import com.glodblock.github.inventory.slot.SlotFluidConvertingFake;
import com.glodblock.github.inventory.slot.SlotSingleItem;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.network.CPacketLevelMaintainer;
import com.glodblock.github.network.CPacketLevelMaintainer.Action;
import com.glodblock.github.network.CPacketLevelTerminalCommands;
import com.glodblock.github.util.FCGuiColors;
import com.glodblock.github.util.NameConst;
import com.glodblock.github.util.Util;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.DimensionalCoord;
import appeng.client.gui.AEBaseGui;
import appeng.client.render.AppEngRenderItem;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotFake;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketNEIDragClick;
import appeng.util.calculators.ArithHelper;
import appeng.util.calculators.Calculator;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cofh.core.render.CoFHFontRenderer;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerLevelMaintainer;
import com.glodblock.github.common.tile.TileLevelMaintainer;
import com.glodblock.github.inventory.gui.MouseRegionManager;
import com.glodblock.github.inventory.slot.SlotFluidConvertingFake;
import com.glodblock.github.inventory.slot.SlotSingleItem;
import com.glodblock.github.network.CPacketLevelMaintainer;
import com.glodblock.github.util.Ae2ReflectClient;
import com.glodblock.github.util.NameConst;
import cpw.mods.fml.common.Optional;
@Optional.Interface(modid = "NotEnoughItems", iface = "codechicken.nei.api.INEIGuiHandler")
@@ -45,11 +62,13 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
private final ContainerLevelMaintainer cont;
private final Component[] component = new Component[TileLevelMaintainer.REQ_COUNT];
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
private final AppEngRenderItem stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
private FCGuiTextField input;
private int lastWorkingTick;
private int refreshTick;
private Widget focusedWidget;
private final CoFHFontRenderer render;
protected ItemStack icon = null;
protected GuiType originalGui;
protected Util.DimensionalCoordSide originalBlockPos;
protected GuiTabButton originalGuiBtn;
public GuiLevelMaintainer(InventoryPlayer ipl, TileLevelMaintainer tile) {
super(new ContainerLevelMaintainer(ipl, tile));
@@ -61,54 +80,81 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
TEX_BG,
Minecraft.getMinecraft().getTextureManager(),
true);
this.refreshTick = 0;
}
public void postUpdate(List<IAEItemStack> list) {
for (Slot slot : this.cont.getRequestSlots()) {
if (!slot.getHasStack()) {
component[slot.getSlotIndex()].setState(TileLevelMaintainer.State.Nothing);
if (ipl.player.openContainer instanceof AEBaseContainer container) {
var target = container.getTarget();
if (target instanceof PartLevelTerminal terminal) {
icon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
originalGui = GuiType.LEVEL_TERMINAL;
DimensionalCoord blockPos = new DimensionalCoord(terminal.getTile());
originalBlockPos = new Util.DimensionalCoordSide(
blockPos.x,
blockPos.y,
blockPos.z,
blockPos.getDimension(),
terminal.getSide(),
"");
} else if (target instanceof IWirelessTerminal terminal && terminal.isUniversal(target)) {
icon = ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack();
originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
originalBlockPos = new Util.DimensionalCoordSide(
terminal.getInventorySlot(),
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
0,
ipl.player.worldObj.provider.dimensionId,
ForgeDirection.UNKNOWN,
"");
} else if (target instanceof WirelessLevelTerminalInventory terminal) {
icon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
originalBlockPos = new Util.DimensionalCoordSide(
terminal.getInventorySlot(),
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
0,
ipl.player.worldObj.provider.dimensionId,
ForgeDirection.UNKNOWN,
"");
}
}
for (IAEItemStack is : list) {
NBTTagCompound data = is.getItemStack().getTagCompound();
long size = data.getLong("Batch");
int i = data.getInteger("Index");
boolean isEnable = data.getBoolean("Enable");
TileLevelMaintainer.State state = TileLevelMaintainer.State.values()[data.getInteger("State")];
component[i].getQty().textField.setText(String.valueOf(is.getStackSize()));
component[i].getBatch().textField.setText(String.valueOf(size));
component[i].setEnable(isEnable);
component[i].setState(state);
}
}
@Override
public void initGui() {
super.initGui();
this.lastWorkingTick = this.refreshTick;
for (int i = 0; i < TileLevelMaintainer.REQ_COUNT; i++) {
component[i] = new Component(
new Widget(
new FCGuiTextField(this.fontRendererObj, guiLeft + 46, guiTop + 19 + 19 * i, 52, 14),
NameConst.TT_LEVEL_MAINTAINER_REQUEST_SIZE,
i,
"TileLevelMaintainer.Quantity"),
Action.Quantity),
new Widget(
new FCGuiTextField(this.fontRendererObj, guiLeft + 100, guiTop + 19 + 19 * i, 52, 14),
NameConst.TT_LEVEL_MAINTAINER_BATCH_SIZE,
i,
"TileLevelMaintainer.Batch"),
Action.Batch),
new GuiFCImgButton(guiLeft + 105 + 47, guiTop + 17 + 19 * i, "SUBMIT", "SUBMIT", false),
new GuiFCImgButton(guiLeft + 9, guiTop + 20 + 19 * i, "ENABLE", "ENABLE", false),
new GuiFCImgButton(guiLeft + 9, guiTop + 20 + 19 * i, "DISABLE", "DISABLE", false),
new FCGuiLineField(fontRendererObj, guiLeft + 47, guiTop + 33 + 19 * i, 125),
this.buttonList);
this.buttonList,
this.cont);
}
if (this.icon != null) {
this.originalGuiBtn = new GuiTabButton(
this.guiLeft + 151,
this.guiTop - 4,
this.icon,
this.icon.getDisplayName(),
itemRender);
this.originalGuiBtn.setHideEdge(13);
this.buttonList.add(originalGuiBtn);
}
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer("TileLevelMaintainer.refresh"));
}
@Override
public void drawScreen(final int mouseX, final int mouseY, final float btn) {
this.refreshTick++;
super.drawScreen(mouseX, mouseY, btn);
for (Component com : this.component) {
com.getQty().textField.handleTooltip(mouseX, mouseY, this);
@@ -121,12 +167,7 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
mc.getTextureManager().bindTexture(TEX_BG);
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
int tick = this.refreshTick;
int interval = 20;
if (tick > lastWorkingTick + interval && this.input == null) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer("TileLevelMaintainer.refresh"));
lastWorkingTick = this.refreshTick;
}
for (int i = 0; i < TileLevelMaintainer.REQ_COUNT; i++) {
this.component[i].draw();
}
@@ -149,18 +190,20 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
super.func_146977_a(new SlotSingleItem(slot));
if (stack == null) return true;
IAEItemStack fake = stack.copy();
if (this.component[slot.getSlotIndex()].getQty().textField.getText().matches("[0-9]+")) {
fake.setStackSize(Long.parseLong(this.component[slot.getSlotIndex()].getQty().textField.getText()));
} else {
fake.setStackSize(0);
}
stackSizeRenderer.setAeStack(fake);
stackSizeRenderer.renderItemOverlayIntoGUI(
Widget qty = this.component[slot.getSlotIndex()].getQty();
qty.validate();
fake.setStackSize(qty.getAmount() != null ? qty.getAmount() : 0);
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
aeRenderItem.setAeStack(fake);
aeRenderItem.renderItemOverlayIntoGUI(
fontRendererObj,
mc.getTextureManager(),
stack.getItemStack(),
fake.getItemStack(),
slot.xDisplayPosition,
slot.yDisplayPosition);
GL11.glTranslatef(0.0f, 0.0f, -200.0f);
return false;
}
return true;
@@ -169,70 +212,73 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
@Override
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
if (btn == 0) {
if (input != null) {
input.setFocused(false);
if (focusedWidget != null) {
focusedWidget.textField.setFocused(false);
}
for (Component com : this.component) {
FCGuiTextField textField = com.isMouseIn(xCoord, yCoord);
Widget textField = com.isMouseIn(xCoord, yCoord);
if (textField != null) {
textField.setFocused(true);
this.input = textField;
textField.textField.setFocused(true);
this.focusedWidget = textField;
super.mouseClicked(xCoord, yCoord, btn);
return;
}
}
this.input = null;
this.focusedWidget = null;
}
super.mouseClicked(xCoord, yCoord, btn);
}
@Override
protected void keyTyped(final char character, final int key) {
if (this.input == null) {
if (this.focusedWidget == null) {
super.keyTyped(character, key);
return;
}
if (!this.checkHotbarKeys(key)) {
if (!((character == ' ') && this.input.getText().isEmpty())) {
this.input.textboxKeyTyped(character, key);
if (!((character == ' ') && this.focusedWidget.textField.getText().isEmpty())) {
this.focusedWidget.textField.textboxKeyTyped(character, key);
}
super.keyTyped(character, key);
if (!this.input.getText().matches("^[0-9]+")) {
this.input.setTextColor(0xFF0000);
} else {
this.input.setTextColor(0xFFFFFF);
}
if (key == Keyboard.KEY_RETURN) {
this.input.setFocused(false);
this.input = null;
this.focusedWidget.validate();
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
this.component[this.focusedWidget.componentIndex].submit();
this.focusedWidget.textField.setFocused(false);
this.focusedWidget = null;
}
}
}
@Override
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
if (slot instanceof SlotFluidConvertingFake && this.cont.getPlayerInv().getItemStack() != null) {
this.component[slot.getSlotIndex()].getQty().textField
.setText(String.valueOf(this.cont.getPlayerInv().getItemStack().stackSize));
return;
}
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
}
public void updateAmount(int idx, int stackSize) {
this.component[idx].getQty().textField.setText(String.valueOf(stackSize));
}
@Override
protected void actionPerformed(final GuiButton btn) {
super.actionPerformed(btn);
for (Component com : this.component) {
if (com.sendToServer(btn)) {
break;
if (btn == originalGuiBtn) {
switchGui();
} else {
super.actionPerformed(btn);
for (Component com : this.component) {
if (com.sendToServer(btn)) {
break;
}
}
}
}
public void switchGui() {
CPacketLevelTerminalCommands message = new CPacketLevelTerminalCommands(
CPacketLevelTerminalCommands.Action.BACK,
originalBlockPos.x,
originalBlockPos.y,
originalBlockPos.z,
originalBlockPos.getDimension(),
originalBlockPos.getSide());
if (originalGui != null) {
message.setOriginalGui(originalGui.ordinal());
}
FluidCraft.proxy.netHandler.sendToServer(message);
}
@Override
public VisiblityData modifyVisiblity(GuiContainer gui, VisiblityData currentVisibility) {
return currentVisibility;
@@ -248,26 +294,36 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
return null;
}
private Rectangle getSlotArea(SlotFake slot) {
return new Rectangle(guiLeft + slot.getX(), guiTop + slot.getY(), 16, 16);
@Override
protected void handleMouseClick(Slot slot, int slotIdx, int ctrlDown, int mouseButton) {
if (slot instanceof SlotFluidConvertingFake && this.cont.getPlayerInv().getItemStack() == null) {
slot.putStack(null);
this.component[slot.getSlotIndex()].reset();
}
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
}
@Override
public boolean handleDragNDrop(GuiContainer gui, int mouseX, int mouseY, ItemStack draggedStack, int button) {
for (SlotFluidConvertingFake slot : this.cont.getRequestSlots()) {
if (getSlotArea(slot).contains(mouseX, mouseY)) {
if (draggedStack == null) {
return false;
}
draggedStack.stackSize = 0;
Slot slotAtPosition = this.getSlotAtPosition(mouseX, mouseY);
if (slotAtPosition == null) {
return false;
}
for (int i = 0; i < this.cont.getRequestSlots().length; i++) {
SlotFluidConvertingFake slot = this.cont.getRequestSlots()[i];
if (slotAtPosition.equals(slot)) {
slot.putStack(draggedStack);
component[i].reset();
NetworkHandler.instance.sendToServer(new PacketNEIDragClick(draggedStack, slot.getSlotIndex()));
if (draggedStack != null) {
this.updateAmount(slot.getSlotIndex(), draggedStack.stackSize);
draggedStack.stackSize = 0;
}
return true;
}
}
if (draggedStack != null) {
draggedStack.stackSize = 0;
}
return false;
}
@@ -276,76 +332,103 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
return false;
}
public void updateComponent(int index, long quantity, long batchSize, boolean isEnabled, LevelState state) {
if (index < 0 || index >= TileLevelMaintainer.REQ_COUNT) return;
component[index].setEnable(isEnabled);
component[index].setState(state);
component[index].getQty().textField.setText(String.valueOf(quantity));
component[index].getBatch().textField.setText(String.valueOf(batchSize));
component[index].getQty().validate();
component[index].getBatch().validate();
}
public void updateComponent(int index, LevelState state) {
if (index < 0 || index >= TileLevelMaintainer.REQ_COUNT) return;
component[index].setState(state);
}
private class Component {
public boolean isEnable = true;
public boolean isEnable = false;
private final Widget qty;
private final Widget batch;
private final GuiFCImgButton disable;
private final GuiFCImgButton enable;
private final GuiFCImgButton submit;
private final FCGuiLineField line;
private TileLevelMaintainer.State state;
private LevelState state;
private final ContainerLevelMaintainer container;
public Component(Widget qtyInput, Widget batchInput, GuiFCImgButton submitBtn, GuiFCImgButton enableBtn,
GuiFCImgButton disableBtn, FCGuiLineField line, List buttonList) {
GuiFCImgButton disableBtn, FCGuiLineField line, List<GuiButton> buttonList,
ContainerLevelMaintainer container) {
this.qty = qtyInput;
this.batch = batchInput;
this.enable = enableBtn;
this.disable = disableBtn;
this.submit = submitBtn;
this.line = line;
this.state = TileLevelMaintainer.State.Nothing;
this.state = LevelState.None;
this.container = container;
buttonList.add(this.submit);
buttonList.add(this.enable);
buttonList.add(this.disable);
}
public int getIndex() {
return this.getQty().idx;
return this.qty.componentIndex;
}
public void setEnable(boolean enable) {
this.isEnable = enable;
}
private boolean send(Widget widget) {
if (((SlotFluidConvertingFake) cont.inventorySlots.get(widget.idx)).getHasStack()) {
if (!widget.textField.getText().isEmpty() && widget.textField.getText().matches("^[0-9]+")) {
String str = widget.textField.getText().replaceAll("^(0+)", "");
widget.textField.setText(str.isEmpty() ? "0" : str);
FluidCraft.proxy.netHandler.sendToServer(
new CPacketLevelMaintainer(widget.action, widget.idx, widget.textField.getText()));
widget.textField.setTextColor(0xFFFFFF);
return true;
} else {
widget.textField.setTextColor(0xFF0000);
return false;
}
private void send(Widget widget) {
if (cont.inventorySlots.get(widget.componentIndex).getHasStack() && widget.getAmount() != null) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketLevelMaintainer(widget.action, widget.componentIndex, widget.getAmount()));
}
return false;
}
public void submit() {
this.sendToServer(this.submit);
}
protected boolean sendToServer(GuiButton btn) {
boolean didSomething = false;
if (this.submit == btn) {
if (this.send(this.getQty())) this.send(this.getBatch());
final Widget qty = this.getQty();
final Widget batch = this.getBatch();
qty.validate();
batch.validate();
if (qty.getAmount() != null) {
this.send(qty);
qty.textField.setText(String.valueOf(qty.getAmount()));
}
if (batch.getAmount() != null) {
this.send(batch);
batch.textField.setText(String.valueOf(batch.getAmount()));
}
didSomething = true;
} else if (this.enable == btn) {
FluidCraft.proxy.netHandler
.sendToServer(new CPacketLevelMaintainer("TileLevelMaintainer.Enable", this.getIndex()));
this.setEnable(false);
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.Enable, this.getIndex()));
didSomething = true;
} else if (this.disable == btn) {
FluidCraft.proxy.netHandler
.sendToServer(new CPacketLevelMaintainer("TileLevelMaintainer.Disable", this.getIndex()));
didSomething = true;
if (this.container.getInventory().get(this.getIndex()) != null) {
this.setEnable(true);
FluidCraft.proxy.netHandler
.sendToServer(new CPacketLevelMaintainer(Action.Disable, this.getIndex()));
didSomething = true;
}
}
return didSomething;
}
public FCGuiTextField isMouseIn(final int xCoord, final int yCoord) {
if (this.getQty().textField.isMouseIn(xCoord, yCoord)) return this.getQty().textField;
if (this.getBatch().textField.isMouseIn(xCoord, yCoord)) return this.getBatch().textField;
public Widget isMouseIn(final int xCoord, final int yCoord) {
if (this.qty.textField.isMouseIn(xCoord, yCoord)) return this.getQty();
if (this.batch.textField.isMouseIn(xCoord, yCoord)) return this.getBatch();
return null;
}
@@ -362,34 +445,53 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
}
public void draw() {
this.getQty().draw();
this.getBatch().draw();
ArrayList<String> message = new ArrayList<String>();
this.qty.draw();
this.batch.draw();
ArrayList<String> message = new ArrayList<>();
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_TITLE) + "\n");
switch (this.state) {
case Idling:
this.line.setColor(0xFF55FF55);
case Idle -> {
this.line.setColor(FCGuiColors.StateIdle.getColor());
message.add(
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT)
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_IDLE));
break;
case Crafting:
this.line.setColor(0xFFFFFF55);
}
case Craft -> {
this.line.setColor(FCGuiColors.StateCraft.getColor());
message.add(
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT)
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_LINK));
break;
case Exporting:
this.line.setColor(0xFFAA00AA);
}
case Export -> {
this.line.setColor(FCGuiColors.StateExport.getColor());
message.add(
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT)
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_EXPORT));
break;
default:
this.line.setColor(0);
}
case Error -> {
this.line.setColor(FCGuiColors.StateError.getColor());
message.add(
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT)
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_ERROR));
}
case NotFound -> {
this.line.setColor(FCGuiColors.StateError.getColor());
message.add(
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_NOT_FOUND));
}
case CantCraft -> {
this.line.setColor(FCGuiColors.StateError.getColor());
message.add(
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CANT_CRAFT));
}
default -> {
this.line.setColor(FCGuiColors.StateNone.getColor());
message.add(
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_NONE));
}
}
message.add("");
if (isShiftKeyDown()) {
@@ -398,7 +500,13 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_LINK));
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_LINK_DESC) + "\n");
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_EXPORT));
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_EXPORT_DESC));
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_EXPORT_DESC) + "\n");
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_ERROR));
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_ERROR_DESC) + "\n");
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_NOT_FOUND));
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_NOT_FOUND_DESC) + "\n");
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CANT_CRAFT));
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CANT_CRAFT_DESC));
} else {
message.add(NameConst.i18n(NameConst.TT_SHIFT_FOR_MORE));
}
@@ -414,35 +522,57 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
}
}
public void setState(TileLevelMaintainer.State state) {
public void setState(LevelState state) {
this.state = state;
}
public void reset() {
this.qty.textField.setText("0");
this.batch.textField.setText("0");
this.qty.validate();
this.batch.validate();
this.setEnable(false);
this.setState(LevelState.None);
}
}
private class Widget {
public final int idx;
public final String action;
private final FCGuiTextField textField;
public final int componentIndex;
public final Action action;
public final FCGuiTextField textField;
private final String tooltip;
private Long amount;
public Widget(FCGuiTextField textField, String tooltip, int idx, String action) {
public Widget(FCGuiTextField textField, String tooltip, int componentIndex, Action action) {
this.textField = textField;
this.textField.setEnableBackgroundDrawing(false);
this.textField.setText("0");
this.textField.setMaxStringLength(10); // it's enough to useful
this.idx = idx;
this.textField.setMaxStringLength(16); // this length is enough to be useful
this.componentIndex = componentIndex;
this.action = action;
this.tooltip = tooltip;
}
public void draw() {
String current = amount != null
? StatCollector.translateToLocal(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
+ NumberFormat.getNumberInstance().format(amount)
+ "\n"
: "";
if (isShiftKeyDown()) {
this.setTooltip(render.wrapFormattedStringToWidth(NameConst.i18n(this.tooltip), xSize / 2));
this.setTooltip(
render.wrapFormattedStringToWidth(
StatCollector.translateToLocal(this.tooltip) + "\n"
+ current
+ "\n"
+ StatCollector.translateToLocal(this.tooltip + ".hint"),
xSize / 2));
} else {
this.setTooltip(
render.wrapFormattedStringToWidth(
NameConst.i18n(this.tooltip, "\n", false) + "\n"
+ current
+ NameConst.i18n(NameConst.TT_SHIFT_FOR_MORE),
(int) Math.floor(xSize * 0.8)));
}
@@ -452,5 +582,21 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
public void setTooltip(String message) {
this.textField.setMessage(message);
}
public void validate() {
final double result = Calculator.conversion(this.textField.getText());
if (Double.isNaN(result) || result < 0) {
this.amount = null;
this.textField.setTextColor(0xFF0000);
} else {
this.amount = (long) ArithHelper.round(result, 0);
this.textField.setTextColor(0xFFFFFF);
}
}
@Nullable
public Long getAmount() {
return this.amount;
}
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,24 @@
package com.glodblock.github.client.gui;
import net.minecraft.entity.player.InventoryPlayer;
import com.glodblock.github.client.gui.container.ContainerLevelWireless;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import appeng.container.slot.AppEngSlot;
public class GuiLevelWireless extends GuiLevelTerminal {
public GuiLevelWireless(final InventoryPlayer inventoryPlayer, final IWirelessTerminal te) {
super(inventoryPlayer, new ContainerLevelWireless(inventoryPlayer, te));
}
@Override
protected void repositionSlots() {
for (final Object obj : this.inventorySlots.inventorySlots) {
if (obj instanceof final AppEngSlot slot) {
slot.yDisplayPosition = this.ySize + slot.getY() - 78 - 4;
}
}
}
}
@@ -0,0 +1,212 @@
package com.glodblock.github.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Keyboard;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerMagnetFilter;
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.item.WirelessMagnet;
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
import com.glodblock.github.util.NameConst;
import appeng.api.config.ActionItems;
import appeng.api.config.Settings;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.AEBaseMEGui;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.client.gui.widgets.MEGuiTextField;
public class GuiMagnetFilter extends AEBaseMEGui {
protected FCGuiBaseButton listModeBtn;
protected ContainerMagnetFilter cont;
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/magnet_filter.png");
protected Component[] components = new Component[4];
protected MEGuiTextField oreDict;
protected GuiTabButton originalGuiBtn;
protected GuiImgButton clearBtn;
public GuiMagnetFilter(InventoryPlayer ip, ITerminalHost container) {
super(new ContainerMagnetFilter(ip, container));
this.xSize = 195;
this.ySize = 214;
this.cont = (ContainerMagnetFilter) this.inventorySlots;
oreDict = new MEGuiTextField(149, 12, NameConst.i18n(NameConst.TT_MAGNET_CARD_OREDICT));
}
private class Component {
private final GuiFCImgButton enable;
private final GuiFCImgButton disable;
private final String action;
private boolean var;
public Component(int x, int y, boolean var, String action) {
this.enable = new GuiFCImgButton(x, y, "ENABLE_12x", "ENABLE", false);
this.disable = new GuiFCImgButton(x, y, "DISABLE_12x", "DISABLE", false);
this.var = var;
this.action = action;
enable.setThreeFourths(true);
disable.setThreeFourths(true);
buttonList.add(this.enable);
buttonList.add(this.disable);
}
public boolean sameBtn(GuiButton btn) {
return btn == this.enable || btn == this.disable;
}
public boolean getVar() {
return this.var;
}
public void setVar(boolean var) {
this.var = var;
}
public void send() {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns(this.action, !this.getVar()));
}
public void draw() {
if (var) {
this.enable.visible = true;
this.disable.visible = false;
} else {
this.enable.visible = false;
this.disable.visible = true;
}
}
}
@Override
public void initGui() {
super.initGui();
this.buttonList.clear();
this.buttonList.add(
this.listModeBtn = new FCGuiBaseButton(
0,
this.guiLeft + 86,
this.guiTop + 4,
64,
14,
NameConst.i18n(
this.cont.listMode == WirelessMagnet.ListMode.WhiteList
? NameConst.GUI_MAGNET_CARD_WhiteList
: NameConst.GUI_MAGNET_CARD_BlackList)));
this.components[0] = new Component(
this.guiLeft + 157,
this.guiTop + 18,
this.cont.nbt,
"WirelessTerminal.magnet.NBT");
this.components[1] = new Component(
this.guiLeft + 157,
this.guiTop + 31,
this.cont.meta,
"WirelessTerminal.magnet.Meta");
this.components[2] = new Component(
this.guiLeft + 157,
this.guiTop + 44,
this.cont.ore,
"WirelessTerminal.magnet.Ore");
this.components[3] = new Component(
this.guiLeft + 157,
this.guiTop + 112,
this.cont.oreDict,
"WirelessTerminal.magnet.OreDictState");
oreDict.x = this.guiLeft + 7;
oreDict.y = this.guiTop + 112;
oreDict.setText(this.cont.oreDictFilter);
this.buttonList.add(
this.originalGuiBtn = new GuiTabButton(
this.guiLeft + this.xSize - 44,
this.guiTop - 4,
this.cont.getPortableCell().getItemStack(),
this.cont.getPortableCell().getItemStack().getDisplayName(),
itemRender));
this.originalGuiBtn.setHideEdge(13); // GuiTabButton implementation //
this.clearBtn = new GuiImgButton(this.guiLeft + 7, this.guiTop + 48, Settings.ACTIONS, ActionItems.CLOSE);
this.clearBtn.setHalfSize(true);
this.buttonList.add(this.clearBtn);
}
@Override
public void drawScreen(int mouseX, int mouseY, float btn) {
handleTooltip(mouseX, mouseY, oreDict);
super.drawScreen(mouseX, mouseY, btn);
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
this.fontRendererObj.drawString(NameConst.i18n(NameConst.GUI_MAGNET_CARD), 8, 6, 0x404040);
this.fontRendererObj.drawString(NameConst.i18n(NameConst.GUI_MAGNET_CARD_NBT), 61, 22, 0x404040);
this.fontRendererObj.drawString(NameConst.i18n(NameConst.GUI_MAGNET_CARD_META), 61, 34, 0x404040);
this.fontRendererObj.drawString(NameConst.i18n(NameConst.GUI_MAGNET_CARD_ORE), 61, 46, 0x404040);
this.components[0].setVar(this.cont.nbt);
this.components[1].setVar(this.cont.meta);
this.components[2].setVar(this.cont.ore);
this.components[3].setVar(this.cont.oreDict);
for (Component c : components) {
c.draw();
}
this.listModeBtn.displayString = NameConst.i18n(
this.cont.listMode == WirelessMagnet.ListMode.WhiteList ? NameConst.GUI_MAGNET_CARD_WhiteList
: NameConst.GUI_MAGNET_CARD_BlackList);
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
bindTexture(TEX_BG);
drawTexturedModalRect(offsetX, offsetY, 0, 0, xSize, ySize);
oreDict.drawTextBox();
}
@Override
protected void keyTyped(char typedChar, int keyCode) {
if (oreDict.isFocused() && (Keyboard.KEY_NUMPADENTER == keyCode || Keyboard.KEY_RETURN == keyCode)) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidPatternTermBtns("WirelessTerminal.magnet.OreDictFilter", oreDict.getText()));
}
if (!oreDict.textboxKeyTyped(typedChar, keyCode)) super.keyTyped(typedChar, keyCode);
}
@Override
protected void mouseClicked(int xCoord, int yCoord, int btn) {
oreDict.mouseClicked(xCoord, yCoord, btn);
super.mouseClicked(xCoord, yCoord, btn);
}
@Override
protected void actionPerformed(GuiButton btn) {
for (Component c : components) {
if (c.sameBtn(btn)) {
c.send();
break;
}
}
if (btn == this.listModeBtn) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidPatternTermBtns(
"WirelessTerminal.magnet.FilterMode",
this.cont.listMode != WirelessMagnet.ListMode.WhiteList));
} else if (btn == this.originalGuiBtn) {
InventoryHandler.switchGui(ItemWirelessUltraTerminal.readMode(this.cont.getPortableCell().getItemStack()));
} else if (btn == this.clearBtn) {
FluidCraft.proxy.netHandler
.sendToServer(new CPacketFluidPatternTermBtns("WirelessTerminal.magnet.clear", 1));
}
super.actionPerformed(btn);
}
}
@@ -4,14 +4,14 @@ import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import appeng.client.gui.AEBaseGui;
import appeng.core.localization.GuiText;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerOCPatternEditor;
import com.glodblock.github.common.tile.TileOCPatternEditor;
import com.glodblock.github.util.NameConst;
import appeng.client.gui.AEBaseGui;
import appeng.core.localization.GuiText;
public class GuiOCPatternEditor extends AEBaseGui {
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/oc_pattern_editor.png");
@@ -0,0 +1,55 @@
package com.glodblock.github.client.gui;
import net.minecraft.entity.player.InventoryPlayer;
import org.lwjgl.input.Keyboard;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
import com.glodblock.github.common.parts.PartFluidTerminal;
import com.glodblock.github.common.parts.PartLevelTerminal;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
import com.glodblock.github.network.SPacketPatternItemRenamer;
import appeng.api.storage.ITerminalHost;
public class GuiPatternItemRenamer extends appeng.client.gui.implementations.GuiPatternItemRenamer {
private GuiType originalGui;
public GuiPatternItemRenamer(InventoryPlayer ip, ITerminalHost p) {
super(ip, p);
}
@Override
protected void setOriginGUI(Object target) {
if (target instanceof PartFluidPatternTerminal) {
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
} else if (target instanceof PartFluidPatternTerminalEx) {
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
} else if (target instanceof PartFluidTerminal) {
this.originalGui = GuiType.FLUID_TERMINAL;
} else if (target instanceof PartLevelTerminal) {
originalGui = GuiType.LEVEL_TERMINAL;
} else if (target instanceof IWirelessTerminal terminal && terminal.isUniversal(target)) {
this.originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
} else if (target instanceof WirelessPatternTerminalInventory) {
this.originalGui = GuiType.FLUID_TERMINAL;
} else if (target instanceof WirelessLevelTerminalInventory) {
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
}
}
@Override
protected void keyTyped(final char character, final int key) {
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
FluidCraft.proxy.netHandler
.sendToServer(new SPacketPatternItemRenamer(originalGui, getText(), getValueIndex()));
} else super.keyTyped(character, key);
}
}
@@ -0,0 +1,155 @@
package com.glodblock.github.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
import com.glodblock.github.common.parts.PartFluidTerminal;
import com.glodblock.github.common.parts.PartLevelTerminal;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.network.CPacketPatternMultiSet;
import appeng.api.config.ActionItems;
import appeng.api.config.Settings;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.implementations.GuiAmount;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.container.implementations.ContainerPatternMulti;
import appeng.core.localization.GuiColors;
import appeng.core.localization.GuiText;
import appeng.helpers.Reflected;
import appeng.util.calculators.ArithHelper;
import appeng.util.calculators.Calculator;
public class GuiPatternMulti extends GuiAmount {
private static final int DEFAULT_VALUE = 0;
private GuiImgButton symbolSwitch;
protected GuiType originalGui;
@Reflected
public GuiPatternMulti(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
super(new ContainerPatternMulti(inventoryPlayer, te));
}
@Override
public void initGui() {
super.initGui();
this.buttonList.add(
this.symbolSwitch = new GuiImgButton(
this.guiLeft + 22,
this.guiTop + 53,
Settings.ACTIONS,
ActionItems.MULTIPLY));
this.amountTextField.x = this.guiLeft + 48;
this.amountTextField.w = 73;
this.amountTextField.setText(String.valueOf(DEFAULT_VALUE));
this.amountTextField.setCursorPositionEnd();
this.amountTextField.setSelectionPos(0);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.fontRendererObj
.drawString(GuiText.SelectAmount.getLocal(), 8, 6, GuiColors.CraftAmountSelectAmount.getColor());
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
super.drawBG(offsetX, offsetY, mouseX, mouseY);
this.nextBtn.displayString = GuiText.Set.getLocal();
try {
int resultI = getAmount();
this.symbolSwitch.set(resultI >= 0 ? ActionItems.MULTIPLY : ActionItems.DIVIDE);
this.nextBtn.enabled = resultI < -1 || resultI > 1;
} catch (final NumberFormatException e) {
this.nextBtn.enabled = false;
}
this.amountTextField.drawTextBox();
}
@Override
protected void actionPerformed(final GuiButton btn) {
super.actionPerformed(btn);
try {
if (btn == this.nextBtn && btn.enabled) {
int resultI = getAmount();
if (resultI > 1 || resultI < -1)
FluidCraft.proxy.netHandler.sendToServer(new CPacketPatternMultiSet(this.originalGui, resultI));
}
} catch (final NumberFormatException e) {
// nope..
this.amountTextField.setText(String.valueOf(DEFAULT_VALUE));
}
if (btn == this.symbolSwitch) {
int resultI = -getAmount();
this.amountTextField.setText(Integer.toString(resultI));
}
}
@Override
protected int getAmount() {
String out = this.amountTextField.getText();
double resultD = Calculator.conversion(out);
if (Double.isNaN(resultD)) {
return DEFAULT_VALUE;
} else {
return (int) ArithHelper.round(resultD, 0);
}
}
@Override
protected void addAmount(int i) {
this.amountTextField.setText(Long.toString(i + getAmount()));
this.amountTextField.setCursorPositionEnd();
}
@Override
protected String getBackground() {
return "guis/patternMulti.png";
}
@Override
protected void setOriginGUI(Object target) {
if (target instanceof PartFluidPatternTerminal) {
this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL.stack();
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
} else if (target instanceof PartFluidPatternTerminalEx) {
this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL_EX.stack();
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
} else if (target instanceof PartFluidTerminal) {
this.myIcon = ItemAndBlockHolder.FLUID_TERM.stack();
this.originalGui = GuiType.FLUID_TERMINAL;
} else if (target instanceof PartLevelTerminal) {
myIcon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
originalGui = GuiType.LEVEL_TERMINAL;
} else if (target instanceof IWirelessTerminal terminal && terminal.isUniversal(target)) {
this.myIcon = ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack();
this.originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
} else if (target instanceof WirelessPatternTerminalInventory) {
this.myIcon = ItemAndBlockHolder.WIRELESS_PATTERN_TERM.stack();
this.originalGui = GuiType.FLUID_TERMINAL;
} else if (target instanceof WirelessLevelTerminalInventory) {
myIcon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
}
}
}
@@ -2,10 +2,6 @@ package com.glodblock.github.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.storage.ITerminalHost;
import appeng.core.localization.GuiText;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.base.FCGuiAmount;
@@ -13,15 +9,18 @@ import com.glodblock.github.client.gui.container.ContainerPatternValueAmount;
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
import com.glodblock.github.common.tile.TileSuperStockReplenisher;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.network.CPacketPatternValueSet;
import appeng.core.localization.GuiText;
public class GuiPatternValueAmount extends FCGuiAmount {
public GuiPatternValueAmount(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
public GuiPatternValueAmount(final InventoryPlayer inventoryPlayer, final Object te) {
super(new ContainerPatternValueAmount(inventoryPlayer, te));
}
@@ -67,17 +66,20 @@ public class GuiPatternValueAmount extends FCGuiAmount {
@Override
protected void setOriginGUI(Object target) {
if (target instanceof PartFluidPatternTerminal) {
this.myIcon = new ItemStack(ItemAndBlockHolder.FLUID_TERMINAL, 1);
this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL.stack();
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
} else if (target instanceof PartFluidPatternTerminalEx) {
this.myIcon = new ItemStack(ItemAndBlockHolder.FLUID_TERMINAL_EX, 1);
this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL_EX.stack();
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
} else if (target instanceof IWirelessTerminal && ((IWirelessTerminal) target).isUniversal(target)) {
this.myIcon = new ItemStack(ItemAndBlockHolder.WIRELESS_ULTRA_TERM, 1);
this.originalGui = ItemWirelessUltraTerminal.readMode(((IWirelessTerminal) target).getItemStack());
} else if (target instanceof IWirelessTerminal terminal && terminal.isUniversal(target)) {
this.myIcon = ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack();
this.originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
} else if (target instanceof WirelessPatternTerminalInventory) {
this.myIcon = new ItemStack(ItemAndBlockHolder.WIRELESS_PATTERN_TERM, 1);
this.myIcon = ItemAndBlockHolder.WIRELESS_PATTERN_TERM.stack();
this.originalGui = GuiType.WIRELESS_FLUID_PATTERN_TERMINAL;
} else if (target instanceof TileSuperStockReplenisher) {
this.myIcon = ItemAndBlockHolder.SUPER_STOCK_RERPLENISHER.stack();
this.originalGui = GuiType.GUI_SUPER_STOCK_REPLENISHER;
}
}
@@ -1,25 +1,45 @@
package com.glodblock.github.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import org.lwjgl.input.Keyboard;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerRenamer;
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
import com.glodblock.github.common.parts.PartLevelTerminal;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.inventory.item.WirelessInterfaceTerminalInventory;
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.network.CPacketRenamer;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.client.gui.widgets.IDropToFillTextField;
import appeng.client.gui.widgets.MEGuiTextField;
import appeng.core.localization.GuiColors;
import appeng.core.localization.GuiText;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerRenamer;
import com.glodblock.github.network.CPacketRenamer;
public class GuiRenamer extends AEBaseGui implements IDropToFillTextField {
private MEGuiTextField textField;
protected final MEGuiTextField textField;
protected final ITerminalHost host;
protected GuiTabButton originalGuiBtn;
protected ItemStack icon = null;
protected GuiType originalGui;
public GuiRenamer(InventoryPlayer ip, ITerminalHost monitorable) {
super(new ContainerRenamer(ip, monitorable));
this.host = monitorable;
this.xSize = 256;
this.textField = new MEGuiTextField(230, 12);
@@ -30,6 +50,29 @@ public class GuiRenamer extends AEBaseGui implements IDropToFillTextField {
public void initGui() {
super.initGui();
FluidCraft.proxy.netHandler.sendToServer(new CPacketRenamer(CPacketRenamer.Action.GET_TEXT));
if (host instanceof PartLevelTerminal) {
icon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
originalGui = GuiType.LEVEL_TERMINAL;
} else if (host instanceof IWirelessTerminal terminal && terminal.isUniversal(host)) {
icon = ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack();
originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
} else if (host instanceof WirelessLevelTerminalInventory) {
icon = ItemAndBlockHolder.WIRELESS_LEVEL_TERM.stack();
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
} else if (host instanceof WirelessInterfaceTerminalInventory) {
icon = ItemAndBlockHolder.WIRELESS_INTERFACE_TERM.stack();
originalGui = GuiType.WIRELESS_INTERFACE_TERMINAL;
}
if (this.icon != null) {
this.buttonList.add(
this.originalGuiBtn = new GuiTabButton(
this.guiLeft + 231,
this.guiTop - 4,
this.icon,
this.icon.getDisplayName(),
itemRender));
this.originalGuiBtn.setHideEdge(13);
}
this.textField.x = this.guiLeft + 12;
this.textField.y = this.guiTop + 35;
this.textField.setFocused(true);
@@ -55,7 +98,7 @@ public class GuiRenamer extends AEBaseGui implements IDropToFillTextField {
@Override
protected void keyTyped(final char character, final int key) {
if (key == 28) { // Enter
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketRenamer(this.textField.getText()));
} else if (!this.textField.textboxKeyTyped(character, key)) {
super.keyTyped(character, key);
@@ -66,6 +109,21 @@ public class GuiRenamer extends AEBaseGui implements IDropToFillTextField {
return textField.isMouseIn(mousex, mousey);
}
@Override
protected void actionPerformed(GuiButton button) {
if (button == originalGuiBtn) {
switchGui();
} else {
super.actionPerformed(button);
}
}
public void switchGui() {
if (originalGui != null) {
InventoryHandler.switchGui(originalGui);
}
}
public void setTextFieldValue(final String displayName, final int mousex, final int mousey, final ItemStack stack) {
textField.setText(displayName);
}
@@ -0,0 +1,116 @@
package com.glodblock.github.client.gui;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerSuperStockReplenisher;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.common.tile.TileSuperStockReplenisher;
import com.glodblock.github.network.CPacketInventoryAction;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.client.gui.AEBaseGui;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotFake;
import appeng.core.localization.GuiText;
import appeng.helpers.InventoryAction;
import appeng.util.item.AEItemStack;
public class GuiSuperStockReplenisher extends AEBaseGui {
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/superStockReplenisher.png");
private Map<Integer, IAEStack<?>> list = new HashMap<>();
public GuiSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockReplenisher tile) {
super(new ContainerSuperStockReplenisher(ipl, tile));
this.ySize = 251;
this.xSize = 216;
}
@Override
protected void handleMouseClick(Slot slot, int slotIdx, int ctrlDown, int mouseButton) {
if (mouseButton == 3) {
if (slot instanceof SlotFake) {
if (slot.getHasStack()) {
InventoryAction action = InventoryAction.SET_PATTERN_VALUE;
IAEItemStack stack = AEItemStack.create(slot.getStack());
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
for (int i = 0; i < this.inventorySlots.inventorySlots.size(); i++) {
if (slot.equals(this.inventorySlots.inventorySlots.get(i))) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketInventoryAction(action, i, 0, stack));
}
}
return;
}
}
}
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
}
@Override
public void func_146977_a(Slot s) {
if (s instanceof SlotFake) {
this.drawFillStatus(s);
}
super.func_146977_a(s);
}
private void drawFillStatus(Slot slotIn) {
int offsetX = slotIn.xDisplayPosition - 8;
int offsetY = slotIn.yDisplayPosition - 11;
ItemStack itemstack = slotIn.getStack();
int slotInt = slotIn.slotNumber;
if (itemstack != null) {
String s = "0%";
if (slotInt > 0 && slotInt < 10) {
IAEStack<?> aeStack = list.get(slotInt - 1);
if (aeStack != null)
s = (int) (((float) aeStack.getStackSize() / ItemFluidPacket.getFluidAmount(itemstack)) * 100)
+ "%";
} else if (slotInt > 9 && slotInt < 73) {
IAEStack<?> aeStack = list.get(slotInt + 90);
if (aeStack != null && itemstack.stackSize > 0) {
long i = aeStack.getStackSize();
s = (int) (((float) i / itemstack.stackSize) * 100) + "%";
}
}
float scale = 0.5f;
float shiftX = 2;
float shiftY = 1;
final float inverseScaleFactor = 1.0f / scale;
final int X = (int) (((float) offsetX - shiftX + 10.0f) * inverseScaleFactor);
final int Y = (int) (((float) offsetY - shiftY + 16.0f - 7.0f * scale) * inverseScaleFactor);
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
GL11.glScaled(scale, scale, scale);
this.fontRendererObj.drawStringWithShadow(s, X, Y, 16777215);
GL11.glScaled(inverseScaleFactor, inverseScaleFactor, inverseScaleFactor);
GL11.glTranslatef(0.0f, 0.0f, -200.0f);
}
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
this.bindTexture(TEX_BG);
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, xSize, ySize);
}
public void update(Map<Integer, IAEStack<?>> map) {
this.list = map;
}
}
@@ -7,15 +7,25 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import appeng.client.gui.AEBaseMEGui;
import com.glodblock.github.client.gui.*;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.GuiEssentiaTerminal;
import com.glodblock.github.client.gui.GuiFCImgButton;
import com.glodblock.github.client.gui.GuiFluidCraftingWireless;
import com.glodblock.github.client.gui.GuiFluidPatternExWireless;
import com.glodblock.github.client.gui.GuiFluidPatternWireless;
import com.glodblock.github.client.gui.GuiFluidPortableCell;
import com.glodblock.github.client.gui.GuiLevelWireless;
import com.glodblock.github.client.gui.container.base.FCBaseContainer;
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.inventory.item.WirelessMagnet;
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
import com.glodblock.github.util.ModAndClassUtil;
import appeng.api.storage.StorageChannel;
import appeng.client.gui.AEBaseMEGui;
public abstract class FCBaseMEGui extends AEBaseMEGui {
protected GuiFCImgButton FluidTerminal;
@@ -23,9 +33,17 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
protected GuiFCImgButton PatternTerminal;
protected GuiFCImgButton EssentiaTerminal;
protected GuiFCImgButton InterfaceTerminal;
protected GuiFCImgButton PatternTerminaleEx;
protected GuiFCImgButton LevelTerminal;
protected GuiFCImgButton PatternTerminalEx;
protected GuiFCImgButton magnetOff;
protected GuiFCImgButton magnetInv;
protected GuiFCImgButton magnetME;
protected GuiFCImgButton magnetFilter;
protected GuiFCImgButton restockEnableBtn;
protected GuiFCImgButton restockDisableBtn;
protected List<GuiFCImgButton> termBtns = new ArrayList<>();
protected boolean drawSwitchGuiBtn;
private StorageChannel channel = null;
public FCBaseMEGui(final InventoryPlayer inventoryPlayer, Container container) {
super(container);
@@ -34,10 +52,19 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
if (target instanceof IWirelessTerminal
&& ((IWirelessTerminal) target).getItemStack().getItem() instanceof ItemWirelessUltraTerminal) {
this.drawSwitchGuiBtn = true;
channel = ((IWirelessTerminal) target).getChannel();
}
}
}
protected WirelessMagnet.Mode getMagnetMode() {
return ((FCBaseContainer) this.inventorySlots).mode;
}
protected boolean isRestock() {
return ((FCBaseContainer) this.inventorySlots).restock;
}
@Override
public void onGuiClosed() {
super.onGuiClosed();
@@ -53,12 +80,51 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
public abstract void setOffsetY(int y);
@SuppressWarnings("unchecked")
protected void drawSwitchGuiBtns() {
if (!drawSwitchGuiBtn) return;
if (!termBtns.isEmpty()) {
this.termBtns.clear();
}
if (this.getMagnetMode() != null && this.channel == StorageChannel.ITEMS) {
this.buttonList.add(
this.magnetOff = new GuiFCImgButton(
this.guiLeft + this.xSize - 18,
this.guiTop + this.ySize - 124,
"MAGNET_CARD",
"OFF"));
this.buttonList.add(
this.magnetInv = new GuiFCImgButton(
this.guiLeft + this.xSize - 18,
this.guiTop + this.ySize - 124,
"MAGNET_CARD",
"INV"));
this.buttonList.add(
this.magnetME = new GuiFCImgButton(
this.guiLeft + this.xSize - 18,
this.guiTop + this.ySize - 124,
"MAGNET_CARD",
"ME"));
this.buttonList.add(
this.magnetFilter = new GuiFCImgButton(
this.guiLeft + this.xSize - 18,
this.guiTop + this.ySize - 104,
"MAGNET_CARD",
"FILTER"));
}
if (this.channel == StorageChannel.ITEMS) {
this.buttonList.add(
this.restockEnableBtn = new GuiFCImgButton(
this.guiLeft + this.xSize - 18,
this.guiTop + this.ySize - 84,
"RESTOCK",
"ENABLE"));
this.buttonList.add(
this.restockDisableBtn = new GuiFCImgButton(
this.guiLeft + this.xSize - 18,
this.guiTop + this.ySize - 84,
"RESTOCK",
"DISABLE"));
}
if (!(this instanceof GuiFluidCraftingWireless)) {
this.buttonList.add(
this.CraftingTerminal = new GuiFCImgButton(
@@ -81,13 +147,13 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
}
if (!(this instanceof GuiFluidPatternExWireless)) {
this.buttonList.add(
this.PatternTerminaleEx = new GuiFCImgButton(
this.PatternTerminalEx = new GuiFCImgButton(
this.guiLeft - 18,
this.getOffsetY(),
"PATTERN_EX_TEM",
"YES"));
this.setOffsetY(this.getOffsetY() + 20);
termBtns.add(this.PatternTerminaleEx);
termBtns.add(this.PatternTerminalEx);
}
if (!(this instanceof GuiFluidPortableCell)) {
this.buttonList.add(
@@ -95,15 +161,19 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
this.setOffsetY(this.getOffsetY() + 20);
termBtns.add(this.FluidTerminal);
}
if (!(this instanceof GuiInterfaceTerminalWireless)) {
this.buttonList.add(
this.InterfaceTerminal = new GuiFCImgButton(
this.guiLeft - 18,
this.getOffsetY(),
"INTERFACE_TEM",
"YES"));
this.setOffsetY(this.getOffsetY() + 20);
termBtns.add(this.InterfaceTerminal);
if (!(this instanceof GuiLevelWireless)) {
this.buttonList.add(
this.InterfaceTerminal = new GuiFCImgButton(
this.guiLeft - 18,
this.getOffsetY(),
"INTERFACE_TEM",
"YES"));
this.LevelTerminal = new GuiFCImgButton(this.guiLeft - 18, this.getOffsetY(), "LEVEL_TEM", "YES"));
this.setOffsetY(this.getOffsetY() + 20);
termBtns.add(this.InterfaceTerminal);
termBtns.add(this.LevelTerminal);
}
if (ModAndClassUtil.ThE && !(this instanceof GuiEssentiaTerminal)) {
this.buttonList.add(
@@ -122,6 +192,43 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
this.buttonList.addAll(termBtns);
}
private boolean scheduleGuiResize;
@Override
protected void mouseClicked(int xCoord, int yCoord, int btn) {
super.mouseClicked(xCoord, yCoord, btn);
if (scheduleGuiResize) {
// in the GuiScreen class, the implementation of super.mouseClicked
// ends up looping on the button list and execute the action for any
// button below the mouse.
// Therefore, if we initGui() the terminal in the actionPerformed method below
// it will run the actionPerformed a second time for the new button
// that will end up being below the mouse (if any) after the initGui()
buttonList.clear();
initGui();
scheduleGuiResize = false;
}
}
protected final void scheduleGuiResize() {
scheduleGuiResize = true;
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
if (isPortableCell()) return;
if (getMagnetMode() != null && this.channel == StorageChannel.ITEMS) {
GuiFCImgButton[] magnetButtons = { this.magnetOff, this.magnetInv, this.magnetME };
for (int i = 0; i < magnetButtons.length; i++) {
magnetButtons[i].visible = getMagnetMode().ordinal() == i;
}
}
if (this.drawSwitchGuiBtn && this.channel == StorageChannel.ITEMS) { // Only ultra terminal
this.restockDisableBtn.visible = !this.isRestock();
this.restockEnableBtn.visible = this.isRestock();
}
}
@Override
protected void actionPerformed(final GuiButton btn) {
if (btn instanceof GuiFCImgButton) {
@@ -135,10 +242,24 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_FLUID_PATTERN_TERMINAL);
} else if (btn == this.InterfaceTerminal) {
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_INTERFACE_TERMINAL);
} else if (btn == this.PatternTerminaleEx) {
} else if (btn == this.LevelTerminal) {
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_LEVEL_TERMINAL);
} else if (btn == this.PatternTerminalEx) {
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_FLUID_PATTERN_TERMINAL_EX);
} else if (btn == this.magnetOff || btn == this.magnetME || btn == this.magnetInv) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidPatternTermBtns("WirelessTerminal.MagnetMode", this.getMagnetMode().ordinal()));
} else if (btn == this.magnetFilter) {
FluidCraft.proxy.netHandler
.sendToServer(new CPacketFluidPatternTermBtns("WirelessTerminal.OpenMagnet", 0));
} else if (btn == this.restockDisableBtn || btn == this.restockEnableBtn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("WirelessTerminal.Stock", 1));
}
}
super.actionPerformed(btn);
}
protected boolean isPortableCell() {
return false;
}
}
@@ -1,25 +1,26 @@
package com.glodblock.github.client.gui.base;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import org.lwjgl.input.Keyboard;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.client.gui.widgets.MEGuiTextField;
import appeng.container.AEBaseContainer;
import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.util.calculators.ArithHelper;
import appeng.util.calculators.Calculator;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.network.CPacketSwitchGuis;
public abstract class FCGuiAmount extends AEBaseGui {
protected GuiTextField amountBox;
protected MEGuiTextField amountBox;
protected GuiTabButton originalGuiBtn;
protected GuiButton submit;
protected GuiButton plus1;
@@ -38,13 +39,13 @@ public abstract class FCGuiAmount extends AEBaseGui {
}
@Override
@SuppressWarnings("unchecked")
public void initGui() {
super.initGui();
final int a = AEConfig.instance.priorityByStacksAmounts(0);
final int b = AEConfig.instance.priorityByStacksAmounts(1);
final int c = AEConfig.instance.priorityByStacksAmounts(2);
final int d = AEConfig.instance.priorityByStacksAmounts(3);
final int a = getIncrementQuantity(0);
final int b = getIncrementQuantity(1);
final int c = getIncrementQuantity(2);
final int d = getIncrementQuantity(3);
this.buttonList.add(this.plus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 26, 22, 20, "+" + a));
this.buttonList.add(this.plus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 26, 28, 20, "+" + b));
@@ -63,26 +64,25 @@ public abstract class FCGuiAmount extends AEBaseGui {
if (this.originalGui != null && this.myIcon != null) {
this.buttonList.add(
this.originalGuiBtn = new GuiTabButton(
this.guiLeft + 154,
this.guiTop,
this.guiLeft + 151,
this.guiTop - 4,
this.myIcon,
this.myIcon.getDisplayName(),
itemRender));
this.originalGuiBtn.setHideEdge(13);
}
this.amountBox = new GuiTextField(
this.fontRendererObj,
this.guiLeft + 62,
this.guiTop + 57,
59,
this.fontRendererObj.FONT_HEIGHT);
this.amountBox.setEnableBackgroundDrawing(false);
this.amountBox = new MEGuiTextField(61, 12);
this.amountBox.x = this.guiLeft + 60;
this.amountBox.y = this.guiTop + 55;
this.amountBox.setMaxStringLength(16);
this.amountBox.setTextColor(0xFFFFFF);
this.amountBox.setVisible(true);
this.amountBox.setFocused(true);
}
protected int getIncrementQuantity(int i) {
return AEConfig.instance.craftItemsByStackAmounts(i);
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.bindTexture(getBackground());
@@ -92,7 +92,7 @@ public abstract class FCGuiAmount extends AEBaseGui {
@Override
protected void keyTyped(final char character, final int key) {
if (!this.checkHotbarKeys(key)) {
if (key == 28) {
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
this.actionPerformed(this.submit);
}
this.amountBox.textboxKeyTyped(character, key);
@@ -104,7 +104,7 @@ public abstract class FCGuiAmount extends AEBaseGui {
protected void actionPerformed(final GuiButton btn) {
super.actionPerformed(btn);
if (btn == this.originalGuiBtn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis(this.originalGui));
InventoryHandler.switchGui(originalGui);
}
final boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
final boolean isMinus = btn == this.minus1 || btn == this.minus10
@@ -128,6 +128,7 @@ public abstract class FCGuiAmount extends AEBaseGui {
}
String out = Long.toString(resultI);
this.amountBox.setText(out);
this.amountBox.setCursorPositionEnd();
} catch (final NumberFormatException ignore) {}
}
@@ -5,16 +5,8 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import org.lwjgl.input.Keyboard;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiScrollbar;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.client.render.AppEngRenderItem;
import appeng.container.slot.AppEngSlot;
import appeng.container.slot.SlotFake;
import appeng.util.item.AEItemStack;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.GuiFCImgButton;
@@ -25,9 +17,17 @@ import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.slot.SlotSingleItem;
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
import com.glodblock.github.util.Ae2ReflectClient;
import com.glodblock.github.util.ModAndClassUtil;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiScrollbar;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.slot.AppEngSlot;
import appeng.container.slot.SlotFake;
import appeng.util.item.AEItemStack;
public abstract class FCGuiEncodeTerminal extends GuiItemMonitor {
private static final String SUBSTITUTION_DISABLE = "0";
@@ -54,7 +54,6 @@ public abstract class FCGuiEncodeTerminal extends GuiItemMonitor {
protected GuiFCImgButton autoFillPatternEnableBtn;
protected GuiFCImgButton autoFillPatternDisableBtn;
protected final GuiScrollbar processingScrollBar = new GuiScrollbar();
protected final AppEngRenderItem stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
public FCGuiEncodeTerminal(final InventoryPlayer inventoryPlayer, final ITerminalHost te,
final FCContainerEncodeTerminal c) {
@@ -118,10 +117,10 @@ public abstract class FCGuiEncodeTerminal extends GuiItemMonitor {
"PatternTerminal.Combine",
this.combineDisableBtn == btn ? "1" : "0"));
} else if (ModAndClassUtil.isDoubleButton && doubleBtn == btn) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidPatternTermBtns(
"PatternTerminal.Double",
Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? "1" : "0"));
int val = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 1 : 0;
if (Mouse.isButtonDown(1)) val |= 0b10;
FluidCraft.proxy.netHandler
.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.Double", String.valueOf(val)));
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsDisabledBtn == btn) {
FluidCraft.proxy.netHandler
.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "1"));
@@ -184,13 +183,15 @@ public abstract class FCGuiEncodeTerminal extends GuiItemMonitor {
if (ItemFluidPacket.getFluidStack(stack) != null && ItemFluidPacket.getFluidStack(stack).amount > 0)
fake.setStackSize(ItemFluidPacket.getFluidStack(stack).amount);
} else return true;
stackSizeRenderer.setAeStack(fake);
stackSizeRenderer.renderItemOverlayIntoGUI(
aeRenderItem.setAeStack(fake);
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
aeRenderItem.renderItemOverlayIntoGUI(
fontRendererObj,
mc.getTextureManager(),
stack.getItemStack(),
slot.xDisplayPosition,
slot.yDisplayPosition);
GL11.glTranslatef(0.0f, 0.0f, -200.0f);
return false;
}
return true;
@@ -15,27 +15,60 @@ import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import appeng.api.config.*;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.GuiFluidMonitor;
import com.glodblock.github.client.gui.GuiItemMonitor;
import com.glodblock.github.client.gui.container.base.FCContainerMonitor;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.network.CPacketInventoryAction;
import com.glodblock.github.util.Ae2ReflectClient;
import com.glodblock.github.util.ModAndClassUtil;
import appeng.api.config.CraftingStatus;
import appeng.api.config.PinsState;
import appeng.api.config.SearchBoxFocusPriority;
import appeng.api.config.SearchBoxMode;
import appeng.api.config.Settings;
import appeng.api.config.TerminalStyle;
import appeng.api.config.YesNo;
import appeng.api.implementations.tiles.IViewCellStorage;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.ITerminalPins;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IDisplayRepo;
import appeng.api.util.IConfigManager;
import appeng.api.util.IConfigurableObject;
import appeng.client.gui.widgets.*;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiScrollbar;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.client.gui.widgets.IDropToFillTextField;
import appeng.client.gui.widgets.ISortSource;
import appeng.client.gui.widgets.MEGuiTextField;
import appeng.client.me.InternalSlotME;
import appeng.client.me.ItemRepo;
import appeng.client.me.PinSlotME;
import appeng.client.me.SlotDisconnected;
import appeng.client.me.SlotME;
import appeng.container.AEBaseContainer;
import appeng.container.slot.*;
import appeng.container.slot.AppEngSlot;
import appeng.container.slot.OptionalSlotFake;
import appeng.container.slot.SlotCraftingMatrix;
import appeng.container.slot.SlotCraftingTerm;
import appeng.container.slot.SlotDisabled;
import appeng.container.slot.SlotFake;
import appeng.container.slot.SlotFakeCraftingMatrix;
import appeng.container.slot.SlotPatternTerm;
import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.localization.ButtonToolTips;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketInventoryAction;
import appeng.core.sync.packets.PacketPinsUpdate;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.helpers.IPinsHandler;
import appeng.helpers.InventoryAction;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
@@ -45,17 +78,9 @@ import appeng.util.item.AEItemStack;
import codechicken.nei.LayoutManager;
import codechicken.nei.util.TextHistory;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.*;
import com.glodblock.github.client.gui.container.base.FCContainerMonitor;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.network.CPacketInventoryAction;
import com.glodblock.github.util.Ae2ReflectClient;
import com.glodblock.github.util.ModAndClassUtil;
// TODO why is this copy pasting all the UI code from AE2 instead of reusing it ???
public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
implements ISortSource, IConfigManagerHost, IDropToFillTextField {
implements ISortSource, IConfigManagerHost, IDropToFillTextField, IPinsHandler {
public static int craftingGridOffsetX;
public static int craftingGridOffsetY;
@@ -67,9 +92,9 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
protected final ItemStack[] myCurrentViewCells = new ItemStack[5];
public FCContainerMonitor<T> monitorableContainer;
public GuiTabButton craftingStatusBtn;
protected ItemRepo repo;
protected IDisplayRepo repo;
protected GuiImgButton craftingStatusImgBtn;
protected FCGuiTextField searchField;
protected MEGuiTextField searchField;
protected int perRow = 9;
protected int reservedSpace = 0;
protected boolean customSortOrder = true;
@@ -85,6 +110,14 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
protected GuiImgButton terminalStyleBox;
protected GuiImgButton searchStringSave;
protected GuiImgButton typeFilter;
protected GuiImgButton pinsStateButton;
protected boolean hasShiftKeyDown = false;
private PinsState pinsState;
public final boolean hasPinHost;
private boolean canBeAutoFocused;
private boolean isAutoFocused;
protected int currentMouseY;
protected int currentMouseX;
@SuppressWarnings("unchecked")
public FCGuiMonitor(final InventoryPlayer inventoryPlayer, final ITerminalHost te, final FCContainerMonitor<T> c) {
@@ -97,6 +130,8 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
this.configSrc = ((IConfigurableObject) this.inventorySlots).getConfigManager();
(this.monitorableContainer = (FCContainerMonitor<T>) this.inventorySlots).setGui(this);
this.viewCell = te instanceof IViewCellStorage;
pinsState = (PinsState) configSrc.getSetting(Settings.PINS_STATE);
hasPinHost = te instanceof ITerminalPins && !(this instanceof GuiFluidMonitor);
}
public int getOffsetY() {
@@ -113,18 +148,18 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
this.getScrollBar().setTop(18).setLeft(175).setHeight(this.rows * 18 - 2);
this.getScrollBar().setRange(
0,
(this.repo.size() + this.perRow - 1) / this.perRow - this.rows,
(this.repo.size() + pinsState.ordinal() * 9 + this.perRow - 1) / this.perRow - this.rows,
Math.max(1, this.rows / 6));
}
@Override
protected void actionPerformed(final GuiButton btn) {
memoryText = this.searchField.getText();
if (btn == this.craftingStatusBtn || btn == this.craftingStatusImgBtn) {
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
}
if (btn instanceof GuiImgButton) {
if (btn instanceof final GuiImgButton iBtn) {
final boolean backwards = Mouse.isButtonDown(1);
final GuiImgButton iBtn = (GuiImgButton) btn;
if (iBtn.getSetting() != Settings.ACTIONS) {
final Enum<?> cv = iBtn.getCurrentValue();
final Enum<?> next = Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
@@ -134,6 +169,15 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
} else if (ModAndClassUtil.isSaveText && btn == this.searchStringSave) {
AEConfig.instance.preserveSearchBar = next == YesNo.YES;
} else if (btn == this.pinsStateButton) {
try {
if (next.ordinal() >= rows) return; // ignore to avoid hiding terminal inventory
final PacketPinsUpdate p = new PacketPinsUpdate((PinsState) next);
NetworkHandler.instance.sendToServer(p);
} catch (final IOException e) {
AELog.debug(e);
}
} else {
try {
NetworkHandler.instance
@@ -144,20 +188,27 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
}
iBtn.set(next);
if (next.getClass() == SearchBoxMode.class || next.getClass() == TerminalStyle.class) {
this.reInitalize();
super.scheduleGuiResize();
}
}
}
super.actionPerformed(btn);
}
protected void reInitalize() {
this.buttonList.clear();
this.initGui();
private void adjustPinsSize() {
final int pinMaxSize = rows - 1;
if (pinsState.ordinal() <= pinMaxSize) return;
try {
PinsState newState = PinsState.fromOrdinal(pinMaxSize);
final PacketPinsUpdate p = new PacketPinsUpdate(newState);
NetworkHandler.instance.sendToServer(p);
} catch (final IOException e) {
AELog.debug(e);
}
}
@Override
@SuppressWarnings("unchecked")
public void initGui() {
Keyboard.enableRepeatEvents(true);
@@ -167,7 +218,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
final boolean hasNEI = IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.NEI);
final int NEI = 0;
final int NEI = hasNEI ? 1 : 0;
int top = hasNEI ? 22 : 0;
final int magicNumber = 114 + 1;
@@ -187,10 +238,26 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
}
this.getMeSlots().clear();
for (int y = 0; y < this.rows; y++) {
// make sure we have space at least for one row of normal slots, because pins not adjusted by scroll bar
adjustPinsSize();
int pinsRows = pinsState.ordinal();
for (int y = 0; y < pinsRows; y++) {
for (int x = 0; x < this.perRow; x++) {
this.getMeSlots()
.add(new InternalSlotME(this.repo, x + y * this.perRow, this.offsetX + x * 18, 18 + y * 18));
.add(new PinSlotME(this.repo, x + y * this.perRow, this.offsetX + x * 18, y * 18 + 18));
}
}
for (int y = 0; y < this.rows - pinsRows; y++) {
for (int x = 0; x < this.perRow; x++) {
this.getMeSlots().add(
new InternalSlotME(
this.repo,
x + y * this.perRow,
this.offsetX + x * 18,
18 + y * 18 + pinsRows * 18));
}
}
@@ -201,6 +268,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
}
super.initGui();
this.setScrollBar();
// full size : 204
// extra slots : 72
// slot 18
@@ -211,6 +279,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
this.offsetY = this.guiTop + 8;
buttonList.clear();
if (this.customSortOrder) {
this.buttonList.add(
this.SortByBox = new GuiImgButton(
@@ -273,16 +342,19 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
AEConfig.instance.settings.getSetting(Settings.TERMINAL_STYLE)));
this.offsetY += 20;
this.searchField = new FCGuiTextField(
this.fontRendererObj,
this.guiLeft + Math.max(80, this.offsetX),
this.guiTop + 4,
90,
12);
this.searchField.setEnableBackgroundDrawing(false);
this.searchField = new MEGuiTextField(90, 12) {
@Override
public void onTextChange(final String oldText) {
final String text = getText();
repo.setSearchString(text);
repo.updateView();
setScrollBar();
}
};
this.searchField.x = this.guiLeft + Math.max(80, this.offsetX);
this.searchField.y = this.guiTop + 4;
this.searchField.setMaxStringLength(25);
this.searchField.setTextColor(0xFFFFFF);
this.searchField.setVisible(true);
if (ModAndClassUtil.isSearchStringTooltip)
searchField.setMessage(ButtonToolTips.SearchStringTooltip.getLocal());
@@ -308,8 +380,19 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
}
}
if (hasPinHost) {
this.buttonList.add(
this.pinsStateButton = new GuiImgButton(
this.guiLeft + 177,
this.guiTop + 18 + (rows * 18) + 26,
Settings.PINS_STATE,
configSrc.getSetting(Settings.PINS_STATE)));
}
final Enum<?> setting = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
this.searchField.setFocused(SearchBoxMode.AUTOSEARCH == setting || SearchBoxMode.NEI_AUTOSEARCH == setting);
this.canBeAutoFocused = SearchBoxMode.AUTOSEARCH == setting || SearchBoxMode.NEI_AUTOSEARCH == setting;
this.searchField.setFocused(this.canBeAutoFocused);
this.isAutoFocused = this.canBeAutoFocused;
if (ModAndClassUtil.isSearchBar && (AEConfig.instance.preserveSearchBar || this.isSubGui())) {
setSearchString(memoryText, false);
@@ -345,6 +428,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
public void setSearchString(String memoryText, boolean updateView) {
this.searchField.setText(memoryText);
this.searchField.setCursorPositionEnd();
this.repo.setSearchString(memoryText);
if (updateView) {
this.repo.updateView();
@@ -354,13 +438,8 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
@Override
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
final Enum<?> searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
if (searchMode != SearchBoxMode.AUTOSEARCH && searchMode != SearchBoxMode.NEI_AUTOSEARCH) {
this.searchField.mouseClicked(xCoord, yCoord, btn);
}
if (btn == 1 && this.searchField.isMouseIn(xCoord, yCoord)) {
setSearchString("", true);
}
this.searchField.mouseClicked(xCoord, yCoord, btn);
isAutoFocused = false;
super.mouseClicked(xCoord, yCoord, btn);
}
@@ -401,6 +480,9 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
if (slot instanceof OptionalSlotFake || slot instanceof SlotFakeCraftingMatrix) {
if (slot.getHasStack()) {
InventoryAction action = InventoryAction.SET_PATTERN_VALUE;
if (isCtrlKeyDown()) {
action = InventoryAction.RENAME_PATTERN_ITEM;
}
IAEItemStack stack = AEItemStack.create(slot.getStack());
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
for (int i = 0; i < this.inventorySlots.inventorySlots.size(); i++) {
@@ -423,7 +505,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
action = InventoryAction.PICKUP_SINGLE;
}
}
if (Ae2ReflectClient.getDragClick(this).size() > 1) {
if (this.drag_click.size() > 1) {
return;
}
final PacketInventoryAction p = new PacketInventoryAction(action, slotIdx, 0);
@@ -433,7 +515,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
if (slot instanceof SlotPatternTerm) {
if (mouseButton == 6) {
return; // prevent weird double clicks..
return; // prevents weird double clicks
}
try {
NetworkHandler.instance.sendToServer(((SlotPatternTerm) slot).getRequest(isShiftKeyDown()));
@@ -442,13 +524,13 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
}
} else if (slot instanceof SlotCraftingTerm) {
if (mouseButton == 6) {
return; // prevent weird double clicks..
return; // prevents weird double clicks
}
InventoryAction action;
if (isShiftKeyDown()) {
action = InventoryAction.CRAFT_SHIFT;
} else {
// Craft stack on right-click, craft single on left-click
// Craft a stack on right-click, craft a single one on left-click
action = (mouseButton == 1) ? InventoryAction.CRAFT_STACK : InventoryAction.CRAFT_ITEM;
}
final PacketInventoryAction p = new PacketInventoryAction(action, slotIdx, 0);
@@ -474,7 +556,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
}
if (slot instanceof SlotDisconnected) {
if (Ae2ReflectClient.getDragClick(this).size() > 1) {
if (this.drag_click.size() > 1) {
return;
}
InventoryAction action = null;
@@ -509,13 +591,22 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
return;
}
if (slot instanceof SlotME) {
if (slot instanceof SlotME sme) {
InventoryAction action = null;
IAEItemStack stack = null;
switch (mouseButton) {
case 0: // pickup / set-down.
action = ctrlDown == 1 ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
stack = ((SlotME) slot).getAEStack();
if (sme.isPin() && player.inventory.getItemStack() != null) {
final PacketInventoryAction p = new PacketInventoryAction(
InventoryAction.SET_PIN,
sme.getPinIndex(),
0);
NetworkHandler.instance.sendToServer(p);
return;
}
stack = sme.getAEStack();
if (stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN
&& stack.getStackSize() == 0
&& player.inventory.getItemStack() == null) {
@@ -523,6 +614,15 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
}
break;
case 1:
if (sme.isPin() && ctrlDown == 1) { // clear pin
final PacketInventoryAction p = new PacketInventoryAction(
InventoryAction.SET_PIN,
sme.getPinIndex(),
-1);
NetworkHandler.instance.sendToServer(p);
return;
}
action = ctrlDown == 1 ? InventoryAction.PICKUP_SINGLE : InventoryAction.SHIFT_CLICK;
stack = ((SlotME) slot).getAEStack();
break;
@@ -572,6 +672,18 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
memoryText = this.searchField.getText();
}
@Override
public void handleKeyboardInput() {
super.handleKeyboardInput();
// Pause the terminal when holding shift
this.repo.setPaused(hasShiftDown());
}
private boolean hasShiftDown() {
return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
}
public void bindTextureBack(final String file) {
final ResourceLocation loc = new ResourceLocation(FluidCraft.MODID, "textures/" + file);
this.mc.getTextureManager().bindTexture(loc);
@@ -610,6 +722,9 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
if (this.searchField != null) {
this.searchField.drawTextBox();
}
this.currentMouseX = mouseX;
this.currentMouseY = mouseY;
}
protected String getBackground() {
@@ -632,24 +747,35 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
@Override
protected void keyTyped(final char character, final int key) {
if (!this.checkHotbarKeys(key)) {
if (character == ' ' && this.searchField.getText().isEmpty()) {
return;
}
if (character == ' ' && this.searchField.getText().isEmpty()) {
return;
}
if (this.searchField.textboxKeyTyped(character, key)) {
this.repo.setSearchString(this.searchField.getText());
this.repo.updateView();
this.setScrollBar();
} else {
super.keyTyped(character, key);
}
boolean skipHotbarCheck = searchField.isFocused()
&& (AEConfig.instance.searchBoxFocusPriority == SearchBoxFocusPriority.ALWAYS
|| (AEConfig.instance.searchBoxFocusPriority == SearchBoxFocusPriority.NO_AUTOSEARCH
&& !isAutoFocused));
if (!skipHotbarCheck && checkHotbarKeys(key)) {
return;
}
final boolean mouseInGui = this
.isPointInRegion(0, 0, this.xSize, this.ySize, this.currentMouseX, this.currentMouseY);
if (this.canBeAutoFocused && !searchField.isFocused() && mouseInGui) {
searchField.setFocused(true);
isAutoFocused = true;
}
if (!searchField.textboxKeyTyped(character, key)) {
super.keyTyped(character, key);
}
}
@Override
public void updateScreen() {
this.repo.setPower(this.monitorableContainer.isPowered());
this.repo.setPowered(this.monitorableContainer.isPowered());
super.updateScreen();
}
@@ -669,12 +795,13 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
}
@Override
public Enum getTypeFilter() {
public Enum<?> getTypeFilter() {
return this.configSrc.getSetting(Settings.TYPE_FILTER);
}
@Override
public void updateSetting(final IConfigManager manager, final Enum settingName, final Enum newValue) {
public void updateSetting(final IConfigManager manager, @SuppressWarnings("rawtypes") final Enum settingName,
@SuppressWarnings("rawtypes") final Enum newValue) {
if (this.SortByBox != null) {
this.SortByBox.set(this.configSrc.getSetting(Settings.SORT_BY));
}
@@ -690,6 +817,13 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
this.typeFilter.set(this.configSrc.getSetting(Settings.TYPE_FILTER));
}
if (this.pinsStateButton != null) {
pinsState = (PinsState) this.configSrc.getSetting(Settings.PINS_STATE);
this.pinsStateButton.set(pinsState);
initGui();
}
this.repo.updateView();
}
@@ -717,13 +851,6 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
this.standardSize = standardSize;
}
@Override
public void drawScreen(final int mouseX, final int mouseY, final float btn) {
super.drawScreen(mouseX, mouseY, btn);
if (ModAndClassUtil.isSearchBar && AEConfig.instance.preserveSearchBar && searchField != null)
handleTooltip(mouseX, mouseY, searchField.new TooltipProvider());
}
public boolean isOverSearchField(int x, int y) {
return searchField.isMouseIn(x, y);
}
@@ -755,4 +882,33 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
public boolean isOverTextField(int mousex, int mousey) {
return searchField.isMouseIn(mousex, mousey);
}
@Override
public void setAEPins(IAEItemStack[] pins) {
if (repo instanceof ItemRepo) repo.setAEPins(pins);
}
@Override
public void setPinsState(PinsState state) {
configSrc.putSetting(Settings.PINS_STATE, state);
}
@SuppressWarnings("SameParameterValue")
protected boolean isPointInRegion(int rectX, int rectY, int rectWidth, int rectHeight, int pointX, int pointY) {
pointX -= this.guiLeft;
pointY -= this.guiTop;
return pointX >= rectX - 1 && pointX < rectX + rectWidth + 1
&& pointY >= rectY - 1
&& pointY < rectY + rectHeight + 1;
}
// Moving items via hotbar keys in terminals isn't working anyway.
// Let's disable hotbar keys processing for terminal slots to allow proper input of numbers in the search field
@Override
protected boolean checkHotbarKeys(int keyCode) {
if (theSlot instanceof SlotME) {
return false;
}
return super.checkHotbarKeys(keyCode);
}
}
@@ -6,6 +6,10 @@ import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import com.glodblock.github.inventory.ItemBiggerAppEngInventory;
import com.glodblock.github.inventory.item.IWirelessCraftTerminal;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import appeng.container.ContainerNull;
import appeng.container.slot.SlotCraftingMatrix;
import appeng.container.slot.SlotCraftingTerm;
@@ -14,9 +18,6 @@ import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.inventory.IAEAppEngInventory;
import appeng.tile.inventory.InvOperation;
import com.glodblock.github.inventory.item.IWirelessCraftTerminal;
import com.glodblock.github.inventory.item.IWirelessTerminal;
public class ContainerCraftingWireless extends ContainerItemMonitor
implements IAEAppEngInventory, IContainerCraftingPacket {
@@ -36,7 +37,16 @@ public class ContainerCraftingWireless extends ContainerItemMonitor
crafting,
x + y * 3,
37 + x * 18,
-72 + y * 18));
-72 + y * 18) {
@Override
public void onSlotChanged() {
if (this.inventory instanceof ItemBiggerAppEngInventory i) {
i.markDirty();
}
super.onSlotChanged();
}
});
}
}
AppEngInternalInventory output = new AppEngInternalInventory(this, 1);
@@ -2,6 +2,8 @@ package com.glodblock.github.client.gui.container;
import net.minecraft.entity.player.InventoryPlayer;
import com.glodblock.github.common.tile.TileFluidInterface;
import appeng.api.config.Settings;
import appeng.api.config.SidelessMode;
import appeng.api.util.IConfigManager;
@@ -9,11 +11,9 @@ import appeng.container.guisync.GuiSync;
import appeng.container.implementations.ContainerInterface;
import appeng.helpers.IInterfaceHost;
import com.glodblock.github.common.tile.TileFluidInterface;
public class ContainerDualInterface extends ContainerInterface {
@GuiSync(10)
@GuiSync(11)
public SidelessMode sidelessMode;
private final boolean isTile;
@@ -1,7 +1,6 @@
package com.glodblock.github.client.gui.container;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -11,13 +10,6 @@ import net.minecraft.item.ItemStack;
import org.apache.commons.lang3.tuple.MutablePair;
import appeng.api.config.Actionable;
import appeng.api.storage.data.IAEFluidStack;
import appeng.container.slot.SlotPlayerHotBar;
import appeng.container.slot.SlotPlayerInv;
import appeng.util.Platform;
import appeng.util.item.AEFluidStack;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.crossmod.thaumcraft.AspectUtil;
import com.glodblock.github.inventory.item.IWirelessTerminal;
@@ -25,6 +17,12 @@ import com.glodblock.github.network.CPacketFluidUpdate;
import com.glodblock.github.network.SPacketFluidUpdate;
import com.glodblock.github.util.Util;
import appeng.api.config.Actionable;
import appeng.api.storage.data.IAEFluidStack;
import appeng.container.slot.SlotPlayerHotBar;
import appeng.container.slot.SlotPlayerInv;
import appeng.util.Platform;
public class ContainerEssentiaMonitor extends ContainerFluidPortableCell {
public ContainerEssentiaMonitor(InventoryPlayer ip, IWirelessTerminal monitorable) {
@@ -37,116 +35,118 @@ public class ContainerEssentiaMonitor extends ContainerFluidPortableCell {
Slot clickSlot = (Slot) this.inventorySlots.get(idx);
if ((clickSlot instanceof SlotPlayerInv || clickSlot instanceof SlotPlayerHotBar) && clickSlot.getHasStack()
&& AspectUtil.isEssentiaContainer(clickSlot.getStack())) {
ItemStack tis = clickSlot.getStack();
Map<Integer, IAEFluidStack> tmp = new HashMap<>();
tmp.put(0, null);
int index = Util.findItemInPlayerInvSlot(p, clickSlot.getStack());
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(tmp, tis, index));
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(index));
}
}
return super.transferStackInSlot(p, idx);
}
@Override
public void postChange(Iterable<IAEFluidStack> change, ItemStack fluidContainer, EntityPlayer player,
int slotIndex) {
for (IAEFluidStack fluid : change) {
IAEFluidStack nfluid = this.monitor.getStorageList().findPrecise(fluid);
ItemStack out = fluidContainer.copy();
out.stackSize = 1;
if (AspectUtil.isEmptyEssentiaContainer(fluidContainer) && AspectUtil.isEssentiaGas(fluid)) {
// add essentia to jars
if (nfluid.getStackSize() / AspectUtil.R <= 0) continue;
final IAEFluidStack toExtract = nfluid.copy();
MutablePair<Integer, ItemStack> fillStack = AspectUtil
.fillEssentiaFromGas(out, toExtract.getFluidStack());
if (fillStack == null || fillStack.right == null || fillStack.left <= 0) continue;
toExtract.setStackSize((long) fillStack.left * fluidContainer.stackSize);
IAEFluidStack tmp = this.host.getFluidInventory()
.extractItems(toExtract, Actionable.SIMULATE, this.getActionSource());
if (tmp == null) continue;
fillStack.right.stackSize = (int) (tmp.getStackSize() / fillStack.left);
this.dropItem(fillStack.right);
out.stackSize = fillStack.right.stackSize;
if (AspectUtil.isEssentiaContainer(fillStack.right)) {
this.host.getFluidInventory().extractItems(toExtract, Actionable.MODULATE, this.getActionSource());
if ((int) (tmp.getStackSize() % fillStack.left) / AspectUtil.R > 0) {
this.dropItem(
AspectUtil.setAspectAmount(
fillStack.right,
(int) (tmp.getStackSize() % fillStack.left) / AspectUtil.R,
AspectUtil.getAspectFromGas(toExtract)),
1);
out.stackSize++;
}
}
} else if (!AspectUtil.isEmptyEssentiaContainer(fluidContainer)) {
// add essentia to ae network
AEFluidStack fluidStack = AspectUtil.getAEGasFromContainer(fluidContainer);
if (fluidStack == null) {
continue;
}
final IAEFluidStack aeFluidStack = fluidStack.copy();
// simulate result is incorrect. so I'm using other solution and ec2 both mod have same issues
final IAEFluidStack notInserted = this.host.getFluidInventory()
.injectItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
MutablePair<Integer, ItemStack> drainStack = AspectUtil
.drainEssentiaFromGas(out.copy(), aeFluidStack.getFluidStack());
if (notInserted != null && notInserted.getStackSize() > 0 && drainStack != null) {
if (fluidStack.getStackSize() == notInserted.getStackSize()) continue;
aeFluidStack.decStackSize(notInserted.getStackSize());
public void postChange(IAEFluidStack clientSelectedFluid, EntityPlayer player, int slotIndex, boolean shift) {
ItemStack targetStack;
if (slotIndex == -1) {
targetStack = player.inventory.getItemStack();
} else {
targetStack = player.inventory.getStackInSlot(slotIndex);
}
final int containersRequested = shift ? targetStack.stackSize : 1;
if (drainStack.left > aeFluidStack.getStackSize()
&& AspectUtil.isEssentiaContainer(drainStack.right)) {
aeFluidStack.setStackSize(drainStack.left - aeFluidStack.getStackSize());
this.host.getFluidInventory()
.extractItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
continue;
}
// drop empty item
this.dropItem(drainStack.right, (int) (aeFluidStack.getStackSize() / drainStack.left));
out.stackSize = (int) (notInserted.getStackSize() / drainStack.left);
if (AspectUtil.isEssentiaContainer(drainStack.right)) {
if (notInserted.getStackSize() % drainStack.left > 0) {
fluidStack.setStackSize((notInserted.getStackSize() % drainStack.left));
AspectUtil.fillEssentiaFromGas(drainStack.right, fluidStack.getFluidStack());
this.dropItem(drainStack.right, 1);
}
}
if (slotIndex == -1) out.stackSize = fluidContainer.stackSize - out.stackSize;
} else if (drainStack != null) {
if (slotIndex == -1) {
out.stackSize = fluidContainer.stackSize;
} else {
if (drainStack != null) {
System.out.print("---------\n");
System.out.print(drainStack.right + "\n");
System.out.print(drainStack.left + "\n");
System.out.print(aeFluidStack.getStackSize() + "\n");
}
out.stackSize = (int) (fluidContainer.stackSize
- (aeFluidStack.getStackSize() / drainStack.left));
}
this.dropItem(drainStack.right, fluidContainer.stackSize); // drop empty item
}
} else {
continue;
IAEFluidStack storedFluid = this.monitor.getStorageList().findPrecise(clientSelectedFluid);
ItemStack out = targetStack.copy();
out.stackSize = 1;
if (AspectUtil.isEmptyEssentiaContainer(targetStack) && AspectUtil.isEssentiaGas(storedFluid)) {
// add essentia to jars
if (storedFluid.getStackSize() / AspectUtil.R <= 0) {
return;
}
if (slotIndex == -1) {
player.inventory.getItemStack().stackSize = player.inventory.getItemStack().stackSize - out.stackSize;
if (player.inventory.getItemStack().stackSize > 0) {
FluidCraft.proxy.netHandler.sendTo(
new SPacketFluidUpdate(new HashMap<>(), player.inventory.getItemStack()),
(EntityPlayerMP) player);
final IAEFluidStack toExtract = storedFluid.copy();
MutablePair<Integer, ItemStack> fillStack = AspectUtil.fillEssentiaFromGas(out, toExtract.getFluidStack());
if (fillStack == null || fillStack.right == null || fillStack.left <= 0) {
return;
}
toExtract.setStackSize((long) fillStack.left * containersRequested);
IAEFluidStack tmp = this.host.getFluidInventory()
.extractItems(toExtract, Actionable.SIMULATE, this.getActionSource());
if (tmp == null) {
return;
}
fillStack.right.stackSize = (int) (tmp.getStackSize() / fillStack.left);
this.dropItem(fillStack.right);
out.stackSize = fillStack.right.stackSize;
if (AspectUtil.isEssentiaContainer(fillStack.right)) {
this.host.getFluidInventory().extractItems(toExtract, Actionable.MODULATE, this.getActionSource());
if ((int) (tmp.getStackSize() % fillStack.left) / AspectUtil.R > 0) {
this.dropItem(
AspectUtil.setAspectAmount(
fillStack.right,
(int) (tmp.getStackSize() % fillStack.left) / AspectUtil.R,
AspectUtil.getAspectFromGas(toExtract)),
1);
out.stackSize++;
}
}
} else if (!AspectUtil.isEmptyEssentiaContainer(targetStack)) {
// add essentia to ae network
ItemStack containerStack = targetStack.copy();
containerStack.stackSize = containersRequested;
IAEFluidStack fluidStack = AspectUtil.getAEGasFromContainer(containerStack);
if (fluidStack == null) {
return;
}
final IAEFluidStack aeFluidStack = fluidStack.copy();
// simulate result is incorrect. so I'm using other solution and ec2 both mod have same issues
final IAEFluidStack notInserted = this.host.getFluidInventory()
.injectItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
MutablePair<Integer, ItemStack> drainStack = AspectUtil
.drainEssentiaFromGas(out.copy(), aeFluidStack.getFluidStack());
if (notInserted != null && notInserted.getStackSize() > 0 && drainStack != null) {
if (fluidStack.getStackSize() == notInserted.getStackSize()) {
return;
}
aeFluidStack.decStackSize(notInserted.getStackSize());
if (drainStack.left > aeFluidStack.getStackSize() && AspectUtil.isEssentiaContainer(drainStack.right)) {
aeFluidStack.setStackSize(drainStack.left - aeFluidStack.getStackSize());
this.host.getFluidInventory()
.extractItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
return;
}
// drop empty item
this.dropItem(drainStack.right, (int) (aeFluidStack.getStackSize() / drainStack.left));
out.stackSize = (int) (notInserted.getStackSize() / drainStack.left);
if (AspectUtil.isEssentiaContainer(drainStack.right)) {
if (notInserted.getStackSize() % drainStack.left > 0) {
fluidStack.setStackSize((notInserted.getStackSize() % drainStack.left));
AspectUtil.fillEssentiaFromGas(drainStack.right, fluidStack.getFluidStack());
this.dropItem(drainStack.right, 1);
}
}
if (slotIndex == -1) out.stackSize = targetStack.stackSize - out.stackSize;
} else if (drainStack != null) {
if (slotIndex == -1) {
out.stackSize = targetStack.stackSize;
} else {
player.inventory.setItemStack(null);
FluidCraft.proxy.netHandler
.sendTo(new SPacketFluidUpdate(new HashMap<>()), (EntityPlayerMP) player);
out.stackSize = (int) (targetStack.stackSize - (aeFluidStack.getStackSize() / drainStack.left));
}
} else {
player.inventory.setInventorySlotContents(slotIndex, out.stackSize > 0 ? out : null);
this.dropItem(drainStack.right, targetStack.stackSize); // drop empty item
}
} else {
return;
}
if (slotIndex == -1) {
player.inventory.getItemStack().stackSize = player.inventory.getItemStack().stackSize - out.stackSize;
if (player.inventory.getItemStack().stackSize > 0) {
FluidCraft.proxy.netHandler.sendTo(
new SPacketFluidUpdate(new HashMap<>(), player.inventory.getItemStack()),
(EntityPlayerMP) player);
} else {
player.inventory.setItemStack(null);
FluidCraft.proxy.netHandler.sendTo(new SPacketFluidUpdate(new HashMap<>()), (EntityPlayerMP) player);
}
} else {
player.inventory.setInventorySlotContents(slotIndex, out.stackSize > 0 ? out : null);
}
this.detectAndSendChanges();
}
@@ -6,12 +6,12 @@ import net.minecraft.item.ItemStack;
import org.apache.commons.lang3.tuple.MutablePair;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotFake;
import com.glodblock.github.common.tile.TileFluidAutoFiller;
import com.glodblock.github.util.Util;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotFake;
public class ContainerFluidAutoFiller extends AEBaseContainer {
public static class FakeSlot extends SlotFake {
@@ -6,18 +6,23 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.networking.security.IActionHost;
import appeng.api.storage.ITerminalHost;
import appeng.container.implementations.ContainerCraftConfirm;
import com.glodblock.github.common.item.ItemBaseWirelessTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
import com.glodblock.github.common.parts.PartLevelTerminal;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.util.BlockPos;
import appeng.api.networking.IGrid;
import appeng.api.networking.security.IActionHost;
import appeng.api.storage.ITerminalHost;
import appeng.container.implementations.ContainerCraftConfirm;
import appeng.container.implementations.ContainerOptimizePatterns;
import appeng.crafting.v2.CraftingJobV2;
import appeng.tile.misc.TilePatternOptimizationMatrix;
public class ContainerFluidCraftConfirm extends ContainerCraftConfirm {
public ContainerFluidCraftConfirm(final InventoryPlayer ip, final ITerminalHost te) {
@@ -35,6 +40,9 @@ public class ContainerFluidCraftConfirm extends ContainerCraftConfirm {
if (ah instanceof PartFluidPatternTerminalEx) {
originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
}
if (ah instanceof PartLevelTerminal) {
originalGui = GuiType.LEVEL_TERMINAL;
}
if (ah instanceof IWirelessTerminal) {
ItemStack terminal = ((IWirelessTerminal) ah).getItemStack();
if (terminal.getItem() instanceof ItemBaseWirelessTerminal) {
@@ -57,4 +65,34 @@ public class ContainerFluidCraftConfirm extends ContainerCraftConfirm {
originalGui);
}
}
@Override
public void optimizePatterns() {
// only V2 supported
IGrid grid = this.getGrid();
if (result instanceof CraftingJobV2 && !this.isSimulation()
&& grid != null
&& !grid.getMachines(TilePatternOptimizationMatrix.class).isEmpty()) {
final IActionHost ah = this.getActionHost();
if (ah instanceof IWirelessTerminal) {
InventoryHandler.openGui(
this.getInventoryPlayer().player,
getWorld(),
new BlockPos(((IWirelessTerminal) ah).getInventorySlot(), 0, 0),
ForgeDirection.UNKNOWN,
GuiType.FLUID_OPTIMIZE_PATTERNS_ITEM);
} else if (this.getOpenContext() != null) {
InventoryHandler.openGui(
this.getInventoryPlayer().player,
getWorld(),
new BlockPos(this.getOpenContext().getTile()),
Objects.requireNonNull(this.getOpenContext().getSide()),
GuiType.FLUID_OPTIMIZE_PATTERNS);
}
if (this.getPlayerInv().player.openContainer instanceof ContainerOptimizePatterns cop) {
cop.setResult(result);
}
}
}
}
@@ -2,17 +2,16 @@ package com.glodblock.github.client.gui.container;
import net.minecraft.entity.player.InventoryPlayer;
import com.glodblock.github.client.gui.container.base.FCContainerFluidConfigurable;
import com.glodblock.github.common.parts.PartFluidExportBus;
import com.glodblock.github.common.parts.base.FCSharedFluidBus;
import appeng.api.config.SchedulingMode;
import appeng.api.config.Settings;
import appeng.api.config.YesNo;
import appeng.api.util.IConfigManager;
import appeng.tile.inventory.AppEngInternalAEInventory;
import com.glodblock.github.client.gui.container.base.FCContainerFluidConfigurable;
import com.glodblock.github.common.parts.PartFluidExportBus;
import com.glodblock.github.common.parts.base.FCSharedFluidBus;
import com.glodblock.github.util.Ae2Reflect;
public class ContainerFluidIO extends FCContainerFluidConfigurable {
private final FCSharedFluidBus bus;
@@ -34,7 +33,7 @@ public class ContainerFluidIO extends FCContainerFluidConfigurable {
@Override
protected void loadSettingsFromHost(IConfigManager cm) {
super.loadSettingsFromHost(cm);
if (Ae2Reflect.getUpgradeableHost(this) instanceof PartFluidExportBus) {
if (this.getUpgradeable() instanceof PartFluidExportBus) {
this.setCraftingMode((YesNo) cm.getSetting(Settings.CRAFT_ONLY));
this.setSchedulingMode((SchedulingMode) cm.getSetting(Settings.SCHEDULING_MODE));
}
@@ -8,17 +8,17 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import appeng.api.storage.data.IAEFluidStack;
import appeng.container.AEBaseContainer;
import appeng.container.slot.IOptionalSlotHost;
import appeng.util.item.AEFluidStack;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.inventory.IDualHost;
import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
import com.glodblock.github.network.SPacketFluidUpdate;
import appeng.api.storage.data.IAEFluidStack;
import appeng.container.AEBaseContainer;
import appeng.container.slot.IOptionalSlotHost;
import appeng.util.item.AEFluidStack;
public class ContainerFluidInterface extends AEBaseContainer implements IOptionalSlotHost {
private final IDualHost tile;
@@ -1,21 +1,20 @@
package com.glodblock.github.client.gui.container;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import appeng.api.config.*;
import appeng.api.implementations.IUpgradeableHost;
import appeng.container.guisync.GuiSync;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.util.Platform;
import com.glodblock.github.client.gui.container.base.FCContainerFluidConfigurable;
import com.glodblock.github.common.parts.PartFluidLevelEmitter;
import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
import com.glodblock.github.util.Ae2Reflect;
import appeng.api.config.RedstoneMode;
import appeng.api.config.SecurityPermissions;
import appeng.api.config.Settings;
import appeng.client.gui.widgets.MEGuiTextField;
import appeng.container.guisync.GuiSync;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.util.Platform;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -24,7 +23,7 @@ public class ContainerFluidLevelEmitter extends FCContainerFluidConfigurable {
private final PartFluidLevelEmitter lvlEmitter;
@SideOnly(Side.CLIENT)
private GuiTextField textField;
private MEGuiTextField textField;
@GuiSync(2)
public long EmitterValue = -1;
@@ -38,10 +37,6 @@ public class ContainerFluidLevelEmitter extends FCContainerFluidConfigurable {
return this.lvlEmitter;
}
protected IUpgradeableHost getUpgradeable() {
return Ae2Reflect.getUpgradeableHost(this);
}
public AppEngInternalAEInventory getFakeFluidInv() {
return (AppEngInternalAEInventory) this.lvlEmitter.getInventoryByName("config");
}
@@ -49,15 +44,12 @@ public class ContainerFluidLevelEmitter extends FCContainerFluidConfigurable {
@Override
protected void setupConfig() {
final IInventory inv = this.getUpgradeable().getInventoryByName("config");
final int y = 40;
final int x = 80 + 44;
this.addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(inv, null, this, 0, x, y, 0, 0, 0));
this.addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(inv, null, this, 0, 17, 42, 0, 0, 0));
}
@SideOnly(Side.CLIENT)
public void setTextField(final GuiTextField level) {
public void setTextField(final MEGuiTextField level) {
this.textField = level;
this.textField.setText(String.valueOf(this.EmitterValue));
}
public void setLevel(final long l, final EntityPlayer player) {
@@ -86,8 +78,7 @@ public class ContainerFluidLevelEmitter extends FCContainerFluidConfigurable {
if (Platform.isServer()) {
this.EmitterValue = this.lvlEmitter.getReportingValue();
this.setRedStoneMode(
(RedstoneMode) Ae2Reflect.getUpgradeableHost(this).getConfigManager()
.getSetting(Settings.REDSTONE_EMITTER));
(RedstoneMode) this.getUpgradeable().getConfigManager().getSetting(Settings.REDSTONE_EMITTER));
}
this.standardDetectAndSendChanges();
@@ -98,6 +89,10 @@ public class ContainerFluidLevelEmitter extends FCContainerFluidConfigurable {
if (field.equals("EmitterValue")) {
if (this.textField != null) {
this.textField.setText(String.valueOf(this.EmitterValue));
if (String.valueOf(oldValue).equals("-1")) {
this.textField.setCursorPositionEnd();
}
}
}
}
@@ -3,7 +3,6 @@ package com.glodblock.github.client.gui.container;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
@@ -13,9 +12,16 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
import org.apache.commons.lang3.tuple.MutablePair;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.base.FCContainerMonitor;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.network.CPacketFluidUpdate;
import com.glodblock.github.network.SPacketFluidUpdate;
import com.glodblock.github.network.SPacketMEUpdateBuffer;
import com.glodblock.github.util.Util;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
@@ -37,19 +43,22 @@ import appeng.container.slot.SlotRestrictedInput;
import appeng.me.helpers.ChannelPowerSrc;
import appeng.util.Platform;
import appeng.util.item.AEFluidStack;
import appeng.util.item.AEItemStack;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.base.FCContainerMonitor;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.network.CPacketFluidUpdate;
import com.glodblock.github.network.SPacketFluidUpdate;
import com.glodblock.github.network.SPacketMEUpdateBuffer;
import com.glodblock.github.util.Util;
public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
protected final IItemList<IAEFluidStack> fluids = AEApi.instance().storage().createFluidList();
/**
* Index of tuple which indicates remaining tanks that are remaining (not emptied/filled)
*/
protected static final int REM_IDX = 0;
/**
* Index of tuple which indicates remaining tanks that are acted upon (emptied/filled)
*/
protected static final int ACT_IDX = 1;
/**
* Index of tuple which indicates tanks that are partially emptied/filled
*/
protected static final int PARTIAL_IDX = 2;
public ContainerFluidMonitor(final InventoryPlayer ip, final ITerminalHost monitorable) {
this(ip, monitorable, true);
@@ -113,11 +122,8 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
Slot clickSlot = (Slot) this.inventorySlots.get(idx);
if ((clickSlot instanceof SlotPlayerInv || clickSlot instanceof SlotPlayerHotBar) && clickSlot.getHasStack()
&& Util.FluidUtil.isFluidContainer(clickSlot.getStack())) {
ItemStack tis = clickSlot.getStack();
Map<Integer, IAEFluidStack> tmp = new HashMap<>();
tmp.put(0, ItemFluidDrop.getAeFluidStack(AEItemStack.create(tis)));
int index = Util.findItemInPlayerInvSlot(p, clickSlot.getStack());
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(tmp, tis, index));
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(index));
}
}
return super.transferStackInSlot(p, idx);
@@ -194,120 +200,353 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
this.dropItem(is);
}
public void postChange(Iterable<IAEFluidStack> change, ItemStack fluidContainer, EntityPlayer player,
int slotIndex) {
for (IAEFluidStack fluid : change) {
IAEFluidStack nfluid = this.monitor.getStorageList().findPrecise(fluid);
ItemStack out = fluidContainer.copy();
out.stackSize = 1;
if (Util.FluidUtil.isEmpty(fluidContainer) && fluid != null) {
// add fluid to tanks
if (nfluid.getStackSize() <= 0) continue;
final IAEFluidStack toExtract = nfluid.copy();
MutablePair<Integer, ItemStack> fillStack = Util.FluidUtil.fillStack(out, toExtract.getFluidStack());
if (fillStack.right == null || fillStack.left <= 0) continue;
toExtract.setStackSize((long) fillStack.left * fluidContainer.stackSize);
// The real result may don't match simulation result.
if (fillStack.right.getItem() instanceof IFluidContainerItem) {
IAEFluidStack real = this.host.getFluidInventory()
.extractItems(toExtract, Actionable.MODULATE, this.getActionSource());
if (real == null) continue;
// Refill the container
out = fluidContainer.copy();
out.stackSize = 1;
fillStack = Util.FluidUtil.fillStack(out, real.getFluidStack());
fillStack.right.stackSize = (int) (real.getStackSize() / fillStack.left);
out.stackSize = fillStack.right.stackSize;
if ((int) (real.getStackSize() % fillStack.left) > 0) {
this.dropItem(
Util.FluidUtil.setFluidContainerAmount(
fillStack.right,
(int) (real.getStackSize() % fillStack.left)),
1);
out.stackSize++;
}
} else if (FluidContainerRegistry.isContainer(fillStack.right)) {
IAEFluidStack real = this.host.getFluidInventory()
.extractItems(toExtract, Actionable.MODULATE, this.getActionSource());
if (real == null) continue;
// Refill the container
out = fluidContainer.copy();
out.stackSize = 1;
fillStack = Util.FluidUtil.fillStack(out, real.getFluidStack());
fillStack.right.stackSize = (int) (real.getStackSize() / fillStack.left);
out.stackSize = fillStack.right.stackSize;
toExtract.setStackSize((long) fillStack.right.stackSize * fillStack.left);
}
this.dropItem(fillStack.right);
} else if (!Util.FluidUtil.isEmpty(fluidContainer)) {
// add fluid to ae network
AEFluidStack fluidStack = Util.getAEFluidFromItem(fluidContainer);
final IAEFluidStack aeFluidStack = fluidStack.copy();
// simulate result is incorrect. so I'm using other solution and ec2 both mod have same issues
final IAEFluidStack notInserted = this.host.getFluidInventory()
.injectItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
MutablePair<Integer, ItemStack> drainStack = Util.FluidUtil
.drainStack(out.copy(), aeFluidStack.getFluidStack());
if (notInserted != null && notInserted.getStackSize() > 0) {
if (fluidStack.getStackSize() == notInserted.getStackSize()) continue;
aeFluidStack.decStackSize(notInserted.getStackSize());
/**
* Two operations, insert and extract.
*
* @param slotIndex The slot. If index == -1, the cursor held itemstack. Else, slotIndex indicates which slot was
* shift clicked on.
*/
public void postChange(IAEFluidStack fluid, EntityPlayer player, int slotIndex, boolean shift) {
ItemStack targetStack;
if (slotIndex == -1) {
targetStack = player.inventory.getItemStack();
} else {
targetStack = player.inventory.getStackInSlot(slotIndex);
}
// The primary output itemstack
if (Util.FluidUtil.isEmpty(targetStack) && fluid != null) {
// Situation 1.a: Empty fluid container, and nonnull slot
extractFluid(fluid, player, slotIndex, shift);
} else if (!Util.FluidUtil.isEmpty(targetStack)) {
// Situation 2.a: We are holding a non-empty container.
insertFluid(player, slotIndex, shift);
// End of situation 2.a
}
// No op (Any other situation)
this.detectAndSendChanges();
}
if (drainStack.left > aeFluidStack.getStackSize()
&& FluidContainerRegistry.isContainer(drainStack.right)) {
aeFluidStack.setStackSize(drainStack.left - aeFluidStack.getStackSize());
this.host.getFluidInventory()
.extractItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
continue;
}
/**
* The insert operation. For input, we have a filled container stack. For outputs, we have the following:
* <ol>
* <li>Leftover filled container stack</li>
* <li>Empty containers</li>
* <li>Partially filled container x1</li>
* </ol>
* In order above, the itemstack at `slotIndex` is transformed into the output.
*/
private void insertFluid(EntityPlayer player, int slotIndex, boolean shift) {
final ItemStack targetStack;
if (slotIndex == -1) {
targetStack = player.inventory.getItemStack();
} else {
targetStack = player.inventory.getStackInSlot(slotIndex);
}
final int containersRequestedToInsert = shift ? targetStack.stackSize : 1;
this.dropItem(drainStack.right, (int) (aeFluidStack.getStackSize() / drainStack.left)); // drop
// empty
// item
out.stackSize = (int) (notInserted.getStackSize() / drainStack.left);
if (drainStack.right.getItem() instanceof IFluidContainerItem) {
if (notInserted.getStackSize() % drainStack.left > 0) {
fluidStack.setStackSize((notInserted.getStackSize() % drainStack.left));
((IFluidContainerItem) drainStack.right.getItem())
.fill(drainStack.right, fluidStack.getFluidStack(), true);
this.dropItem(drainStack.right, 1);
}
} else if (FluidContainerRegistry.isContainer(drainStack.right)) {
if (notInserted.getStackSize() % drainStack.left > 0) {
aeFluidStack.setStackSize(aeFluidStack.getStackSize() % drainStack.left);
this.host.getFluidInventory()
.extractItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
out.stackSize++;
}
}
if (slotIndex == -1) out.stackSize = fluidContainer.stackSize - out.stackSize;
} else {
if (slotIndex == -1) {
out.stackSize = fluidContainer.stackSize;
} else {
out.stackSize = (int) (fluidContainer.stackSize
- (aeFluidStack.getStackSize() / drainStack.left));
}
this.dropItem(drainStack.right, fluidContainer.stackSize); // drop empty item
}
} else {
continue;
// Step 1: Determine container characteristics and verify fluid to be extractable
final int fluidPerContainer;
final FluidStack fluidStackPerContainer;
final boolean partialInsertSupported;
if (targetStack.getItem() instanceof IFluidContainerItem fcItem) {
ItemStack test = targetStack.copy();
test.stackSize = 1;
fluidStackPerContainer = fcItem.drain(test, Integer.MAX_VALUE, false);
if (fluidStackPerContainer == null || fluidStackPerContainer.amount == 0) {
return;
}
if (slotIndex == -1) {
player.inventory.getItemStack().stackSize = player.inventory.getItemStack().stackSize - out.stackSize;
if (player.inventory.getItemStack().stackSize > 0) {
FluidCraft.proxy.netHandler.sendTo(
new SPacketFluidUpdate(new HashMap<>(), player.inventory.getItemStack()),
(EntityPlayerMP) player);
} else {
player.inventory.setItemStack(null);
FluidCraft.proxy.netHandler
.sendTo(new SPacketFluidUpdate(new HashMap<>()), (EntityPlayerMP) player);
}
fluidPerContainer = fluidStackPerContainer.amount;
partialInsertSupported = true;
} else if (FluidContainerRegistry.isContainer(targetStack)) {
ItemStack emptyTank = FluidContainerRegistry.drainFluidContainer(targetStack);
if (emptyTank == null) {
return;
}
fluidStackPerContainer = FluidContainerRegistry.getFluidForFilledItem(targetStack);
fluidPerContainer = fluidStackPerContainer.amount;
partialInsertSupported = false;
} else {
return;
}
// Step 2: determine network capacity
final IAEFluidStack totalFluid = AEFluidStack.create(fluidStackPerContainer);
totalFluid.setStackSize((long) fluidPerContainer * containersRequestedToInsert);
final IAEFluidStack notInsertable = this.host.getFluidInventory()
.injectItems(totalFluid, Actionable.SIMULATE, this.getActionSource());
final long insertableFluid;
if (notInsertable == null || notInsertable.getStackSize() == 0) {
insertableFluid = totalFluid.getStackSize();
} else {
long insertable = totalFluid.getStackSize() - notInsertable.getStackSize();
if (partialInsertSupported) {
insertableFluid = insertable;
} else {
player.inventory.setInventorySlotContents(slotIndex, out.stackSize > 0 ? out : null);
// avoid remainder
insertableFluid = insertable - (insertable % fluidPerContainer);
}
}
this.detectAndSendChanges();
totalFluid.setStackSize(insertableFluid);
// Step 3: perform insert
final long totalInserted;
final IAEFluidStack notInserted = this.host.getFluidInventory()
.injectItems(totalFluid, Actionable.MODULATE, this.getActionSource());
if (notInserted != null && notInserted.getStackSize() > 0) {
// User has a setup that causes discrepancy between simulation and modulation. Likely double storage bus.
long total = totalFluid.getStackSize() - notInserted.getStackSize();
if (partialInsertSupported) {
totalInserted = total;
} else {
// We cant have partially filled containers -> user will receive a fluid packet as last resort
long overflowAmount = fluidPerContainer - (total % fluidPerContainer);
IAEFluidStack overflow = AEFluidStack.create(fluidStackPerContainer);
overflow.setStackSize(overflowAmount);
dropItem(ItemFluidPacket.newStack(overflow));
totalInserted = total + overflowAmount;
}
} else {
totalInserted = totalFluid.getStackSize();
}
// Step 4: calculate outputs
final int emptiedTanks;
final int partialDrain;
if (fluidPerContainer > 0) {
emptiedTanks = (int) (totalInserted / fluidPerContainer);
partialDrain = (int) (totalInserted % fluidPerContainer);
} else {
emptiedTanks = containersRequestedToInsert;
partialDrain = 0;
}
final int partialTanks = partialDrain > 0 && partialInsertSupported ? 1 : 0;
final int usedTanks = emptiedTanks + partialTanks;
final int untouchedTanks = targetStack.stackSize - usedTanks;
final ItemStack emptiedTanksStack;
final ItemStack partialTanksStack;
if (targetStack.getItem() instanceof IFluidContainerItem fcItem) {
if (emptiedTanks > 0) {
final ItemStack testDrainStack = targetStack.copy();
testDrainStack.stackSize = 1;
fcItem.drain(testDrainStack, fluidPerContainer, true);
if (testDrainStack.stackSize == 0) {
emptiedTanksStack = null;
} else {
emptiedTanksStack = testDrainStack.copy();
emptiedTanksStack.stackSize = emptiedTanks;
}
} else {
emptiedTanksStack = null;
}
if (partialTanks > 0) {
partialTanksStack = targetStack.copy();
partialTanksStack.stackSize = 1;
fcItem.drain(partialTanksStack, partialDrain, true);
} else {
partialTanksStack = null;
}
} else {
if (emptiedTanks > 0) {
emptiedTanksStack = FluidContainerRegistry.drainFluidContainer(targetStack);
emptiedTanksStack.stackSize = emptiedTanks;
} else {
emptiedTanksStack = null;
}
// Not possible > see Step 2 and Step 3
partialTanksStack = null;
}
// Done. Put the output in the inventory or ground, and update stack size.
boolean shouldSendStack = true;
if (slotIndex == -1) {
// Item is in mouse hand
if (untouchedTanks > 0) {
targetStack.stackSize = untouchedTanks;
adjustStack(targetStack);
dropItem(emptiedTanksStack);
dropItem(partialTanksStack);
} else if (emptiedTanksStack != null) {
adjustStack(emptiedTanksStack);
player.inventory.setItemStack(emptiedTanksStack);
dropItem(partialTanksStack);
} else if (partialTanksStack != null) {
player.inventory.setItemStack(partialTanksStack);
} else {
player.inventory.setItemStack(null);
shouldSendStack = false;
}
} else {
// Shift clicked in
if (untouchedTanks > 0) {
targetStack.stackSize = untouchedTanks;
adjustStack(targetStack);
dropItem(emptiedTanksStack);
dropItem(partialTanksStack);
} else if (emptiedTanksStack != null) {
adjustStack(emptiedTanksStack);
player.inventory.setInventorySlotContents(slotIndex, emptiedTanksStack);
dropItem(partialTanksStack);
} else if (partialTanksStack != null) {
player.inventory.setInventorySlotContents(slotIndex, partialTanksStack);
} else {
player.inventory.setInventorySlotContents(slotIndex, null);
}
}
if (shouldSendStack) {
FluidCraft.proxy.netHandler.sendTo(
new SPacketFluidUpdate(new HashMap<>(), player.inventory.getItemStack()),
(EntityPlayerMP) player);
} else {
FluidCraft.proxy.netHandler.sendTo(new SPacketFluidUpdate(new HashMap<>()), (EntityPlayerMP) player);
}
}
/**
* The extract operation. For input, we have an empty container stack. For outputs, we have the following:
* <ol>
* <li>Leftover empty container stack</li>
* <li>Filled containers (full)</li>
* <li>Partially filled container x1</li>
* </ol>
* In order above, the itemstack at `slotIndex` is transformed into the output.
*/
private void extractFluid(IAEFluidStack clientRequestedFluid, EntityPlayer player, int slotIndex, boolean shift) {
if (slotIndex != -1) {
// shift-click from inventory cant fill fluids
return;
}
final ItemStack targetStack = player.inventory.getItemStack();
final int containersRequestedToExtract = shift ? targetStack.stackSize : 1;
final FluidStack clientRequestedFluidStack = clientRequestedFluid.getFluidStack();
clientRequestedFluidStack.amount = Integer.MAX_VALUE;
// Step 1: Determine container characteristics and verify fluid to be insertable
final int fluidPerContainer;
final boolean partialInsertSupported;
if (targetStack.getItem() instanceof IFluidContainerItem fcItem) {
ItemStack testStack = targetStack.copy();
testStack.stackSize = 1;
fluidPerContainer = fcItem.fill(testStack, clientRequestedFluidStack, false);
if (fluidPerContainer == 0) {
return;
}
partialInsertSupported = true;
} else if (FluidContainerRegistry.isContainer(targetStack)) {
fluidPerContainer = FluidContainerRegistry.getContainerCapacity(clientRequestedFluidStack, targetStack);
partialInsertSupported = false;
} else {
return;
}
// Step 2: determine fluid in network
final IAEFluidStack totalRequestedFluid = clientRequestedFluid.copy();
totalRequestedFluid.setStackSize((long) fluidPerContainer * containersRequestedToExtract);
final IAEFluidStack availableFluid = this.host.getFluidInventory()
.extractItems(totalRequestedFluid, Actionable.SIMULATE, this.getActionSource());
if (availableFluid == null || availableFluid.getStackSize() == 0) {
return;
}
if (availableFluid.getStackSize() != totalRequestedFluid.getStackSize() && !partialInsertSupported) {
availableFluid.decStackSize(availableFluid.getStackSize() % fluidPerContainer);
}
// Step 3: perform extract
final IAEFluidStack extracted = this.host.getFluidInventory()
.extractItems(availableFluid, Actionable.MODULATE, this.getActionSource());
final long totalExtracted = extracted != null ? extracted.getStackSize() : 0;
// Step 4: calculate outputs
final int filledTanks = (int) (totalExtracted / fluidPerContainer);
final int partialFill = (int) (totalExtracted % fluidPerContainer);
final int partialTanks = partialFill > 0 && partialInsertSupported ? 1 : 0;
final int usedTanks = filledTanks + partialTanks;
final int untouchedTanks = targetStack.stackSize - usedTanks;
final ItemStack filledTanksStack;
final ItemStack partialTanksStack;
if (targetStack.getItem() instanceof IFluidContainerItem fcItem) {
if (filledTanks > 0) {
filledTanksStack = targetStack.copy();
filledTanksStack.stackSize = 1;
FluidStack toInsert = extracted.getFluidStack().copy();
toInsert.amount = fluidPerContainer;
fcItem.fill(filledTanksStack, toInsert, true);
filledTanksStack.stackSize = filledTanks;
} else {
filledTanksStack = null;
}
if (partialTanks > 0) {
partialTanksStack = targetStack.copy();
partialTanksStack.stackSize = 1;
FluidStack toInsert = extracted.getFluidStack().copy();
toInsert.amount = partialFill;
fcItem.fill(partialTanksStack, toInsert, true);
} else {
partialTanksStack = null;
}
} else {
if (filledTanks > 0) {
FluidStack toInsert = extracted.getFluidStack().copy();
toInsert.amount = fluidPerContainer;
filledTanksStack = FluidContainerRegistry.fillFluidContainer(toInsert, targetStack);
filledTanksStack.stackSize = filledTanks;
} else {
filledTanksStack = null;
}
if (partialFill > 0) {
// User has a setup that causes discrepancy between simulation and modulation. Likely double storage
// bus.
// We cant have partially filled containers -> user will receive a fluid packet as last resort
IAEFluidStack overflow = extracted.copy();
overflow.setStackSize(partialFill);
dropItem(ItemFluidPacket.newStack(overflow));
}
partialTanksStack = null;
}
// Done. Put the output in the inventory or ground, and update stack size.
// We can assume slotIndex == -1, since we don't actually allow extraction via shift click.
boolean shouldSendStack = true;
if (untouchedTanks > 0) {
ItemStack emptyStack = player.inventory.getItemStack();
emptyStack.stackSize = untouchedTanks;
adjustStack(emptyStack);
dropItem(filledTanksStack);
dropItem(partialTanksStack);
} else if (filledTanksStack != null) {
adjustStack(filledTanksStack);
player.inventory.setItemStack(filledTanksStack);
dropItem(partialTanksStack);
} else if (partialTanksStack != null) {
player.inventory.setItemStack(partialTanksStack);
} else {
player.inventory.setItemStack(null);
shouldSendStack = false;
}
if (shouldSendStack) {
FluidCraft.proxy.netHandler.sendTo(
new SPacketFluidUpdate(new HashMap<>(), player.inventory.getItemStack()),
(EntityPlayerMP) player);
} else {
FluidCraft.proxy.netHandler.sendTo(new SPacketFluidUpdate(new HashMap<>()), (EntityPlayerMP) player);
}
}
void adjustStack(ItemStack stack) {
if (stack != null && stack.stackSize > stack.getMaxStackSize()) {
dropItem(stack, stack.stackSize - stack.getMaxStackSize());
stack.stackSize = stack.getMaxStackSize();
}
}
protected boolean isEssentiaMode() {
@@ -0,0 +1,69 @@
package com.glodblock.github.client.gui.container;
import java.util.Objects;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.glodblock.github.common.item.ItemBaseWirelessTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
import com.glodblock.github.common.parts.PartLevelTerminal;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.util.BlockPos;
import appeng.api.networking.security.IActionHost;
import appeng.api.storage.ITerminalHost;
import appeng.container.implementations.ContainerOptimizePatterns;
public class ContainerFluidOptimizePatterns extends ContainerOptimizePatterns {
public ContainerFluidOptimizePatterns(InventoryPlayer ip, ITerminalHost te) {
super(ip, te);
}
public World getWorld() {
return this.getPlayerInv().player.worldObj;
}
@Override
public void switchToOriginalGUI() {
GuiType originalGui = null;
final IActionHost ah = this.getActionHost();
if (ah instanceof PartFluidPatternTerminal) {
originalGui = GuiType.FLUID_PATTERN_TERMINAL;
}
if (ah instanceof PartFluidPatternTerminalEx) {
originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
}
if (ah instanceof PartLevelTerminal) {
originalGui = GuiType.LEVEL_TERMINAL;
}
if (ah instanceof IWirelessTerminal) {
ItemStack terminal = ((IWirelessTerminal) ah).getItemStack();
if (terminal.getItem() instanceof ItemBaseWirelessTerminal) {
originalGui = ((ItemBaseWirelessTerminal) terminal.getItem()).guiGuiType(terminal);
}
}
if (ah instanceof IWirelessTerminal) {
InventoryHandler.openGui(
this.getInventoryPlayer().player,
getWorld(),
new BlockPos(((IWirelessTerminal) ah).getInventorySlot(), 0, 0),
ForgeDirection.UNKNOWN,
originalGui);
} else if (this.getOpenContext() != null) {
InventoryHandler.openGui(
this.getInventoryPlayer().player,
getWorld(),
new BlockPos(this.getOpenContext().getTile()),
Objects.requireNonNull(this.getOpenContext().getSide()),
originalGui);
}
}
}
@@ -4,11 +4,11 @@ import static com.glodblock.github.loader.ItemAndBlockHolder.PACKET;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.container.AEBaseContainer;
import com.glodblock.github.common.tile.TileFluidPacketDecoder;
import com.glodblock.github.inventory.slot.FCSlotRestrictedInput;
import appeng.container.AEBaseContainer;
public class ContainerFluidPacketDecoder extends AEBaseContainer {
public ContainerFluidPacketDecoder(InventoryPlayer ipl, TileFluidPacketDecoder tile) {
@@ -9,12 +9,6 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.storage.data.IAEItemStack;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotRestrictedInput;
import appeng.helpers.InventoryAction;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.item.ItemFluidEncodedPattern;
import com.glodblock.github.common.item.ItemFluidPacket;
@@ -27,6 +21,12 @@ import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.FluidPatternDetails;
import com.glodblock.github.util.Util;
import appeng.api.AEApi;
import appeng.api.storage.data.IAEItemStack;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotRestrictedInput;
import appeng.helpers.InventoryAction;
public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPatternConsumer {
private final TileFluidPatternEncoder tile;
@@ -106,7 +106,10 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPa
}
private static IAEItemStack[] collectAeInventory(AeStackInventory<IAEItemStack> inv) {
// see note at top of DensePatternDetails
/*
* AE2 API documentation says the input/output arrays can contain nulls, but their use of the API directly
* contradicts that, so we just go by behaviour and filter out nulls.
*/
List<IAEItemStack> acc = new ArrayList<>();
for (IAEItemStack stack : inv) {
if (stack != null) {
@@ -130,20 +133,20 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPa
if (slot instanceof SlotFluidConvertingFake) {
final ItemStack stack = player.inventory.getItemStack();
switch (action) {
case PICKUP_OR_SET_DOWN:
case PICKUP_OR_SET_DOWN -> {
if (stack == null) {
slot.putStack(null);
} else {
((SlotFluidConvertingFake) slot).putConvertedStack(stack.copy());
}
break;
case PLACE_SINGLE:
}
case PLACE_SINGLE -> {
if (stack != null) {
((SlotFluidConvertingFake) slot)
.putConvertedStack(Objects.requireNonNull(Util.copyStackWithSize(stack, 1)));
}
break;
case SPLIT_OR_PLACE_SINGLE:
}
case SPLIT_OR_PLACE_SINGLE -> {
ItemStack inSlot = slot.getStack();
if (inSlot != null) {
if (stack == null) {
@@ -161,7 +164,8 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPa
((SlotFluidConvertingFake) slot)
.putConvertedStack(Objects.requireNonNull(Util.copyStackWithSize(stack, 1)));
}
break;
}
default -> {}
}
} else {
super.doAction(player, action, slotId, id);
@@ -7,6 +7,8 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import com.glodblock.github.client.gui.container.base.FCContainerEncodeTerminal;
import appeng.api.storage.ITerminalHost;
import appeng.container.slot.OptionalSlotFake;
import appeng.container.slot.SlotFakeCraftingMatrix;
@@ -14,8 +16,6 @@ import appeng.container.slot.SlotPatternOutputs;
import appeng.container.slot.SlotPatternTerm;
import appeng.util.Platform;
import com.glodblock.github.client.gui.container.base.FCContainerEncodeTerminal;
public class ContainerFluidPatternTerminal extends FCContainerEncodeTerminal {
public ContainerFluidPatternTerminal(final InventoryPlayer ip, final ITerminalHost monitorable) {
@@ -153,9 +153,9 @@ public class ContainerFluidPatternTerminal extends FCContainerEncodeTerminal {
}
@Override
public void doubleStacks(boolean isShift) {
public void doubleStacks(int val) {
if (!isCraftingMode()) {
super.doubleStacks(isShift);
super.doubleStacks(val);
}
}
}
@@ -5,14 +5,14 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import com.glodblock.github.client.gui.container.base.FCContainerEncodeTerminal;
import appeng.api.storage.ITerminalHost;
import appeng.container.slot.IOptionalSlotHost;
import appeng.container.slot.OptionalSlotFake;
import appeng.helpers.InventoryAction;
import appeng.util.Platform;
import com.glodblock.github.client.gui.container.base.FCContainerEncodeTerminal;
public class ContainerFluidPatternTerminalEx extends FCContainerEncodeTerminal {
private static final int CRAFTING_GRID_PAGES = 2;
@@ -5,23 +5,27 @@ import java.util.Iterator;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import com.glodblock.github.client.gui.container.base.FCContainerFluidConfigurable;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.common.parts.PartFluidStorageBus;
import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
import appeng.api.AEApi;
import appeng.api.config.*;
import appeng.api.config.AccessRestriction;
import appeng.api.config.SecurityPermissions;
import appeng.api.config.Settings;
import appeng.api.config.StorageFilter;
import appeng.api.config.Upgrades;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IItemList;
import appeng.container.guisync.GuiSync;
import appeng.container.slot.SlotRestrictedInput;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.util.IterationCounter;
import appeng.util.Platform;
import appeng.util.iterators.NullIterator;
import com.glodblock.github.client.gui.container.base.FCContainerFluidConfigurable;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.common.parts.PartFluidStorageBus;
import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
import com.glodblock.github.util.Ae2Reflect;
public class ContainerFluidStorageBus extends FCContainerFluidConfigurable {
public final PartFluidStorageBus bus;
@@ -46,8 +50,8 @@ public class ContainerFluidStorageBus extends FCContainerFluidConfigurable {
protected void setupConfig() {
final int xo = 8;
final int yo = 23 + 6;
final IInventory upgrades = Ae2Reflect.getUpgradeList(this).getInventoryByName("upgrades");
final IInventory config = Ae2Reflect.getUpgradeList(this).getInventoryByName("config");
final IInventory upgrades = getUpgradeable().getInventoryByName("upgrades");
final IInventory config = getUpgradeable().getInventoryByName("config");
for (int y = 0; y < 7; y++) {
for (int x = 0; x < 9; x++) {
this.addSlotToContainer(
@@ -99,7 +103,7 @@ public class ContainerFluidStorageBus extends FCContainerFluidConfigurable {
@Override
protected boolean isValidForConfig(int slot, IAEFluidStack fs) {
if (this.supportCapacity()) {
final int upgrades = Ae2Reflect.getUpgradeList(this).getInstalledUpgrades(Upgrades.CAPACITY);
final int upgrades = getUpgradeable().getInstalledUpgrades(Upgrades.CAPACITY);
final int y = slot / 9;
return y < upgrades + 2;
}
@@ -121,11 +125,9 @@ public class ContainerFluidStorageBus extends FCContainerFluidConfigurable {
this.verifyPermissions(SecurityPermissions.BUILD, false);
if (Platform.isServer()) {
this.setReadWriteMode(
(AccessRestriction) Ae2Reflect.getUpgradeList(this).getConfigManager().getSetting(Settings.ACCESS));
this.setReadWriteMode((AccessRestriction) getUpgradeable().getConfigManager().getSetting(Settings.ACCESS));
this.setStorageFilter(
(StorageFilter) Ae2Reflect.getUpgradeList(this).getConfigManager()
.getSetting(Settings.STORAGE_FILTER));
(StorageFilter) getUpgradeable().getConfigManager().getSetting(Settings.STORAGE_FILTER));
}
this.standardDetectAndSendChanges();
@@ -133,8 +135,8 @@ public class ContainerFluidStorageBus extends FCContainerFluidConfigurable {
@Override
public boolean isSlotEnabled(final int idx) {
if (Ae2Reflect.getUpgradeList(this).getInstalledUpgrades(Upgrades.ORE_FILTER) > 0) return false;
final int upgrades = Ae2Reflect.getUpgradeList(this).getInstalledUpgrades(Upgrades.CAPACITY);
if (getUpgradeable().getInstalledUpgrades(Upgrades.ORE_FILTER) > 0) return false;
final int upgrades = getUpgradeable().getInstalledUpgrades(Upgrades.CAPACITY);
return upgrades > (idx - 2);
}
@@ -152,7 +154,7 @@ public class ContainerFluidStorageBus extends FCContainerFluidConfigurable {
Iterator<IAEFluidStack> i = new NullIterator<>();
if (cellInv != null) {
final IItemList<IAEFluidStack> list = cellInv
.getAvailableItems(AEApi.instance().storage().createFluidList());
.getAvailableItems(AEApi.instance().storage().createFluidList(), IterationCounter.fetchNewId());
i = list.iterator();
}
@@ -8,15 +8,15 @@ import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import appeng.api.storage.data.IAEFluidStack;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotNormal;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.ITankDump;
import com.glodblock.github.common.tile.TileIngredientBuffer;
import com.glodblock.github.network.SPacketFluidUpdate;
import appeng.api.storage.data.IAEFluidStack;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotNormal;
public class ContainerIngredientBuffer extends AEBaseContainer implements ITankDump {
private final TileIngredientBuffer tile;
@@ -1,74 +1,25 @@
package com.glodblock.github.client.gui.container;
import java.io.IOException;
import java.util.*;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.config.*;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridNode;
import appeng.api.networking.security.IActionHost;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketCompressedNBT;
import appeng.helpers.DualityInterface;
import appeng.helpers.IInterfaceHost;
import appeng.helpers.InventoryAction;
import appeng.items.misc.ItemEncodedPattern;
import appeng.parts.AEBasePart;
import appeng.parts.misc.PartInterface;
import appeng.parts.p2p.PartP2PInterface;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.misc.TileInterface;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.inv.AdaptorIInventory;
import appeng.util.inv.AdaptorPlayerHand;
import appeng.util.inv.ItemSlot;
import appeng.util.inv.WrapperInvSlot;
import com.glodblock.github.client.gui.container.base.FCBaseContainer;
import com.glodblock.github.common.parts.PartFluidInterface;
import com.glodblock.github.common.tile.TileFluidInterface;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import appeng.container.implementations.ContainerInterfaceTerminal;
import appeng.helpers.InventoryAction;
import appeng.util.Platform;
public class ContainerInterfaceWireless extends FCBaseContainer {
/**
* this stuff is all server side..
*/
private static long autoBase = Long.MIN_VALUE;
private final Multimap<IInterfaceHost, ContainerInterfaceWireless.InvTracker> diList = HashMultimap.create();
private final Map<Long, ContainerInterfaceWireless.InvTracker> byId = new HashMap<Long, ContainerInterfaceWireless.InvTracker>();
// private final Map<Long, InvTracker> byId = new HashMap<>();
private IGrid grid;
private NBTTagCompound data = new NBTTagCompound();
ContainerInterfaceTerminal delegateContainer;
public ContainerInterfaceWireless(final InventoryPlayer ip, final IWirelessTerminal monitorable) {
super(ip, monitorable);
if (Platform.isServer()) {
this.grid = monitorable.getActionableNode().getGrid();
}
this.bindPlayerInventory(ip, 14, 0);
}
delegateContainer = new ContainerInterfaceTerminal(ip, monitorable);
private Set<IGridNode> getMachineNodes() {
Set<IGridNode> union = new HashSet<>();
this.grid.getMachines(TileFluidInterface.class).forEach(union::add);
this.grid.getMachines(TileInterface.class).forEach(union::add);
this.grid.getMachines(PartFluidInterface.class).forEach(union::add);
this.grid.getMachines(PartInterface.class).forEach(union::add);
this.grid.getMachines(PartP2PInterface.class).forEach(union::add);
return union;
this.bindPlayerInventory(ip, 14, 3);
}
@Override
@@ -78,347 +29,16 @@ public class ContainerInterfaceWireless extends FCBaseContainer {
}
super.detectAndSendChanges();
if (this.grid == null) {
return;
}
int total = 0;
boolean missing = false;
final IActionHost host = this.getActionHost();
if (host != null) {
final IGridNode agn = host.getActionableNode();
if (agn != null && agn.isActive()) {
for (final IGridNode gn : this.getMachineNodes()) {
ContainerInterfaceWireless.InterfaceCheck interfaceCheck = new ContainerInterfaceWireless.InterfaceCheck()
.invoke(gn);
total += interfaceCheck.getTotal();
missing |= interfaceCheck.isMissing();
}
}
}
if (total != this.diList.size() || missing) {
this.regenList(this.data);
} else {
for (final ContainerInterfaceWireless.InvTracker inv : diList.values()) {
for (int x = 0; x < inv.client.getSizeInventory(); x++) {
if (this.isDifferent(inv.server.getStackInSlot(inv.offset + x), inv.client.getStackInSlot(x))) {
this.addItems(this.data, inv, x, 1);
}
}
}
}
if (!this.data.hasNoTags()) {
try {
NetworkHandler.instance
.sendTo(new PacketCompressedNBT(this.data), (EntityPlayerMP) this.getPlayerInv().player);
} catch (final IOException e) {
// :P
}
this.data = new NBTTagCompound();
}
delegateContainer.detectAndSendChanges();
}
@Override
public void doAction(final EntityPlayerMP player, final InventoryAction action, final int slot, final long id) {
final ContainerInterfaceWireless.InvTracker inv = this.byId.get(id);
if (inv != null) {
final ItemStack is = inv.server.getStackInSlot(slot + inv.offset);
final boolean hasItemInHand = player.inventory.getItemStack() != null;
final InventoryAdaptor playerHand = new AdaptorPlayerHand(player);
final WrapperInvSlot slotInv = new ContainerInterfaceWireless.PatternInvSlot(inv.server);
final IInventory theSlot = slotInv.getWrapper(slot + inv.offset);
final InventoryAdaptor interfaceSlot = new AdaptorIInventory(theSlot);
IInventory interfaceHandler = inv.server;
boolean canInsert = true;
switch (action) {
case PICKUP_OR_SET_DOWN:
if (hasItemInHand) {
for (int s = 0; s < interfaceHandler.getSizeInventory(); s++) {
if (Platform.isSameItemPrecise(
interfaceHandler.getStackInSlot(s),
player.inventory.getItemStack())) {
canInsert = false;
break;
}
}
if (canInsert) {
ItemStack inSlot = theSlot.getStackInSlot(0);
if (inSlot == null) {
player.inventory.setItemStack(interfaceSlot.addItems(player.inventory.getItemStack()));
} else {
inSlot = inSlot.copy();
final ItemStack inHand = player.inventory.getItemStack().copy();
theSlot.setInventorySlotContents(0, null);
player.inventory.setItemStack(null);
player.inventory.setItemStack(interfaceSlot.addItems(inHand.copy()));
if (player.inventory.getItemStack() == null) {
player.inventory.setItemStack(inSlot);
} else {
player.inventory.setItemStack(inHand);
theSlot.setInventorySlotContents(0, inSlot);
}
}
}
} else {
final IInventory mySlot = slotInv.getWrapper(slot + inv.offset);
mySlot.setInventorySlotContents(0, playerHand.addItems(mySlot.getStackInSlot(0)));
}
break;
case SPLIT_OR_PLACE_SINGLE:
if (hasItemInHand) {
for (int s = 0; s < interfaceHandler.getSizeInventory(); s++) {
if (Platform.isSameItemPrecise(
interfaceHandler.getStackInSlot(s),
player.inventory.getItemStack())) {
canInsert = false;
break;
}
}
if (canInsert) {
ItemStack extra = playerHand.removeItems(1, null, null);
if (extra != null && !interfaceSlot.containsItems()) {
extra = interfaceSlot.addItems(extra);
}
if (extra != null) {
playerHand.addItems(extra);
}
}
} else if (is != null) {
ItemStack extra = interfaceSlot.removeItems((is.stackSize + 1) / 2, null, null);
if (extra != null) {
extra = playerHand.addItems(extra);
}
if (extra != null) {
interfaceSlot.addItems(extra);
}
}
break;
case SHIFT_CLICK:
final IInventory mySlot = slotInv.getWrapper(slot + inv.offset);
final InventoryAdaptor playerInv = InventoryAdaptor.getAdaptor(player, ForgeDirection.UNKNOWN);
mySlot.setInventorySlotContents(0, mergeToPlayerInventory(playerInv, mySlot.getStackInSlot(0)));
break;
case MOVE_REGION:
final InventoryAdaptor playerInvAd = InventoryAdaptor.getAdaptor(player, ForgeDirection.UNKNOWN);
for (int x = 0; x < inv.client.getSizeInventory(); x++) {
inv.server.setInventorySlotContents(
x + inv.offset,
mergeToPlayerInventory(playerInvAd, inv.server.getStackInSlot(x + inv.offset)));
}
break;
case CREATIVE_DUPLICATE:
if (player.capabilities.isCreativeMode && !hasItemInHand) {
player.inventory.setItemStack(is == null ? null : is.copy());
}
break;
default:
return;
}
this.updateHeld(player);
}
}
private ItemStack mergeToPlayerInventory(InventoryAdaptor playerInv, ItemStack stack) {
if (stack == null) return null;
for (ItemSlot slot : playerInv) {
if (Platform.isSameItemPrecise(slot.getItemStack(), stack)) {
if (slot.getItemStack().stackSize < slot.getItemStack().getMaxStackSize()) {
++slot.getItemStack().stackSize;
return null;
}
}
}
return playerInv.addItems(stack);
}
private void regenList(final NBTTagCompound data) {
this.byId.clear();
this.diList.clear();
final IActionHost host = this.getActionHost();
if (host != null) {
final IGridNode agn = host.getActionableNode();
if (agn != null && agn.isActive()) {
for (final IGridNode gn : this.getMachineNodes()) {
final IInterfaceHost ih = (IInterfaceHost) gn.getMachine();
final DualityInterface dual = ih.getInterfaceDuality();
if (gn.isActive() && dual.getConfigManager().getSetting(Settings.INTERFACE_TERMINAL) == YesNo.YES) {
for (int i = 0; i <= dual.getInstalledUpgrades(Upgrades.PATTERN_CAPACITY); ++i) {
this.diList.put(
ih,
new ContainerInterfaceWireless.InvTracker(
dual,
dual.getPatterns(),
dual.getTermName(),
i * 9,
9));
}
}
}
}
}
data.setBoolean("clear", true);
for (final ContainerInterfaceWireless.InvTracker inv : this.diList.values()) {
this.byId.put(inv.which, inv);
this.addItems(data, inv, 0, inv.client.getSizeInventory());
}
delegateContainer.doAction(player, action, slot, id);
}
@Override
protected boolean isWirelessTerminal() {
return true;
}
private boolean isDifferent(final ItemStack a, final ItemStack b) {
if (a == null && b == null) {
return false;
}
if (a == null || b == null) {
return true;
}
return !ItemStack.areItemStacksEqual(a, b);
}
private void addItems(final NBTTagCompound data, final ContainerInterfaceWireless.InvTracker inv, final int offset,
final int length) {
final String name = '=' + Long.toString(inv.which, Character.MAX_RADIX);
final NBTTagCompound tag = data.getCompoundTag(name);
if (tag.hasNoTags()) {
tag.setLong("sortBy", inv.sortBy);
tag.setString("un", inv.unlocalizedName);
tag.setInteger("x", inv.X);
tag.setInteger("y", inv.Y);
tag.setInteger("z", inv.Z);
tag.setInteger("dim", inv.dim);
tag.setInteger("side", inv.side.ordinal());
}
for (int x = 0; x < length; x++) {
final NBTTagCompound itemNBT = new NBTTagCompound();
final ItemStack is = inv.server.getStackInSlot(x + offset + inv.offset);
// "update" client side.
inv.client.setInventorySlotContents(offset + x, is == null ? null : is.copy());
if (is != null) {
is.writeToNBT(itemNBT);
}
tag.setTag(Integer.toString(x + offset), itemNBT);
}
data.setTag(name, tag);
}
private static class InvTracker {
private final long sortBy;
private final long which = autoBase++;
private final String unlocalizedName;
private final IInventory client;
private final IInventory server;
private final int offset;
private final int X;
private final int Y;
private final int Z;
private final int dim;
private final ForgeDirection side;
public InvTracker(final DualityInterface dual, final IInventory patterns, final String unlocalizedName,
int offset, int size) {
this.server = patterns;
this.client = new AppEngInternalInventory(null, size);
this.unlocalizedName = unlocalizedName;
this.sortBy = dual.getSortValue() + offset << 16;
this.offset = offset;
X = dual.getLocation().x;
Y = dual.getLocation().y;
Z = dual.getLocation().z;
dim = dual.getLocation().getDimension();
if (dual.getHost() instanceof AEBasePart) {
side = ((AEBasePart) dual.getHost()).getSide();
} else {
side = ForgeDirection.UNKNOWN;
}
}
}
private static class PatternInvSlot extends WrapperInvSlot {
public PatternInvSlot(final IInventory inv) {
super(inv);
}
@Override
public boolean isItemValid(final ItemStack itemstack) {
return itemstack != null && itemstack.getItem() instanceof ItemEncodedPattern;
}
}
private class InterfaceCheck {
int total = 0;
boolean missing = false;
public InterfaceCheck() {}
public int getTotal() {
return total;
}
public boolean isMissing() {
return missing;
}
public ContainerInterfaceWireless.InterfaceCheck invoke(IGridNode gn) {
if (gn.isActive()) {
final IInterfaceHost ih = (IInterfaceHost) gn.getMachine();
if (ih.getInterfaceDuality().getConfigManager().getSetting(Settings.INTERFACE_TERMINAL) == YesNo.NO
|| ih instanceof PartP2PInterface && ((PartP2PInterface) ih).isOutput()) {
return this;
}
final Collection<ContainerInterfaceWireless.InvTracker> t = ContainerInterfaceWireless.this.diList
.get(ih);
if (t.isEmpty()) {
missing = true;
} else {
final DualityInterface dual = ih.getInterfaceDuality();
for (ContainerInterfaceWireless.InvTracker it : t) {
if (!it.unlocalizedName.equals(dual.getTermName())) {
missing = true;
}
}
}
total += (ih.getInterfaceDuality().getInstalledUpgrades(Upgrades.PATTERN_CAPACITY) + 1);
}
return this;
}
}
}
@@ -9,6 +9,9 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraftforge.common.util.ForgeDirection;
import com.glodblock.github.client.gui.container.base.FCContainerMonitor;
import com.glodblock.github.network.SPacketMEUpdateBuffer;
import appeng.api.AEApi;
import appeng.api.implementations.tiles.IViewCellStorage;
import appeng.api.networking.IGrid;
@@ -26,9 +29,6 @@ import appeng.container.slot.SlotRestrictedInput;
import appeng.me.helpers.ChannelPowerSrc;
import appeng.util.Platform;
import com.glodblock.github.client.gui.container.base.FCContainerMonitor;
import com.glodblock.github.network.SPacketMEUpdateBuffer;
public class ContainerItemMonitor extends FCContainerMonitor<IAEItemStack> {
private final IItemList<IAEItemStack> items = AEApi.instance().storage().createItemList();
@@ -3,10 +3,10 @@ package com.glodblock.github.client.gui.container;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import appeng.container.slot.SlotNormal;
import com.glodblock.github.common.tile.TileLargeIngredientBuffer;
import appeng.container.slot.SlotNormal;
public class ContainerLargeIngredientBuffer extends ContainerIngredientBuffer {
public ContainerLargeIngredientBuffer(InventoryPlayer ipl, TileLargeIngredientBuffer tile) {
@@ -1,22 +1,30 @@
package com.glodblock.github.client.gui.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import appeng.container.AEBaseContainer;
import appeng.util.item.AEItemStack;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.tile.TileLevelMaintainer;
import com.glodblock.github.inventory.AeItemStackHandler;
import com.glodblock.github.inventory.slot.SlotFluidConvertingFake;
import com.glodblock.github.network.SPacketLevelMaintainerGuiUpdate;
import appeng.api.config.SecurityPermissions;
import appeng.container.AEBaseContainer;
import appeng.helpers.InventoryAction;
import appeng.util.Platform;
public class ContainerLevelMaintainer extends AEBaseContainer {
private final TileLevelMaintainer tile;
private final SlotFluidConvertingFake[] requestSlots = new SlotFluidConvertingFake[TileLevelMaintainer.REQ_COUNT];
private static final int UPDATE_INTERVAL = 20;
private boolean isFirstUpdate = true;
private int updateCount = UPDATE_INTERVAL;
public ContainerLevelMaintainer(InventoryPlayer ipl, TileLevelMaintainer tile) {
super(ipl, tile);
this.tile = tile;
@@ -37,15 +45,63 @@ public class ContainerLevelMaintainer extends AEBaseContainer {
return this.requestSlots;
}
@Override
public void doAction(EntityPlayerMP player, InventoryAction action, int slotId, long id) {
if (getSlot(slotId) instanceof SlotFluidConvertingFake slot) {
final ItemStack stack = player.inventory.getItemStack();
switch (action) {
case PICKUP_OR_SET_DOWN, PLACE_SINGLE, SPLIT_OR_PLACE_SINGLE -> {
if (stack == null) {
slot.putStack(null);
} else {
slot.putConvertedStack(stack);
}
}
default -> {}
}
} else {
super.doAction(player, action, slotId, id);
}
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int idx) {
for (SlotFluidConvertingFake slot : this.getRequestSlots()) {
if (Platform.isClient()) {
return null;
}
for (int i = 0; i < this.getRequestSlots().length; i++) {
SlotFluidConvertingFake slot = this.getRequestSlots()[i];
if (!slot.getHasStack()) {
slot.setAeStack(AEItemStack.create(((Slot) this.inventorySlots.get(idx)).getStack()), true);
ItemStack itemStack = this.inventorySlots.get(idx).getStack();
tile.updateStack(i, itemStack.copy());
break;
}
}
this.detectAndSendChanges();
return null;
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
if (Platform.isClient()) {
return;
}
this.verifyPermissions(SecurityPermissions.BUILD, false);
if (this.updateCount++ >= UPDATE_INTERVAL) {
this.updateGui();
}
}
public void updateGui() {
FluidCraft.proxy.netHandler.sendTo(
new SPacketLevelMaintainerGuiUpdate(this.tile.requests, !this.isFirstUpdate),
(EntityPlayerMP) this.getInventoryPlayer().player);
this.isFirstUpdate = false;
this.updateCount = 0;
}
}
@@ -0,0 +1,241 @@
package com.glodblock.github.client.gui.container;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import org.jetbrains.annotations.Nullable;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.api.registries.ILevelViewable;
import com.glodblock.github.api.registries.LevelItemInfo;
import com.glodblock.github.client.gui.container.base.FCBaseContainer;
import com.glodblock.github.common.parts.PartLevelTerminal;
import com.glodblock.github.coremod.registries.LevelTerminalRegistry;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.network.SPacketLevelTerminalUpdate;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridHost;
import appeng.api.networking.IGridNode;
import appeng.api.networking.security.IActionHost;
import appeng.api.storage.ITerminalHost;
import appeng.api.util.DimensionalCoord;
import appeng.util.Platform;
public class ContainerLevelTerminal extends FCBaseContainer {
/**
* this stuff is all server side
*/
private int nextId = 0;
private final Map<IGridHost, ContainerLevelTerminal.InvTracker> tracked = new HashMap<>();
private final Map<Long, ContainerLevelTerminal.InvTracker> trackedById = new HashMap<>();
private IGrid grid;
private SPacketLevelTerminalUpdate updatePacket;
private boolean isPacketDirty;
private boolean wasOff;
private int ticks = 0;
public ContainerLevelTerminal(final InventoryPlayer ip, final ITerminalHost monitorable) {
super(ip, monitorable);
if (Platform.isServer()) {
if (monitorable instanceof PartLevelTerminal terminal) {
grid = terminal.getActionableNode().getGrid();
} else if (monitorable instanceof IWirelessTerminal wirelessTerminal) {
grid = wirelessTerminal.getActionableNode().getGrid();
}
updatePacket = this.updateList();
if (updatePacket != null) {
this.isPacketDirty = true;
} else {
updatePacket = new SPacketLevelTerminalUpdate();
this.isPacketDirty = false;
}
}
this.bindPlayerInventory(ip, 14, 0);
}
@Override
public void detectAndSendChanges() {
if (Platform.isClient()) {
return;
}
super.detectAndSendChanges();
if (this.grid == null) {
return;
}
final IActionHost host = this.getActionHost();
if (!host.getActionableNode().isActive()) {
if (!wasOff) {
SPacketLevelTerminalUpdate update = new SPacketLevelTerminalUpdate();
update.addDisconnectEntry();
wasOff = true;
FluidCraft.proxy.netHandler.sendTo(update, (EntityPlayerMP) this.getPlayerInv().player);
}
return;
}
wasOff = false;
if (isPacketDirty) {
FluidCraft.proxy.netHandler.sendTo(updatePacket, (EntityPlayerMP) this.getPlayerInv().player);
updatePacket = new SPacketLevelTerminalUpdate();
isPacketDirty = false;
} else if (++ticks % 20 == 0) {
ticks = 0;
SPacketLevelTerminalUpdate updateNew = this.updateList();
if (updateNew != null) {
FluidCraft.proxy.netHandler.sendTo(updateNew, (EntityPlayerMP) this.getPlayerInv().player);
}
}
}
@Nullable
private SPacketLevelTerminalUpdate updateList() {
SPacketLevelTerminalUpdate update = null;
var supported = LevelTerminalRegistry.instance().getSupportedClasses();
Set<IGridHost> visited = new HashSet<>();
for (Class<? extends ILevelViewable> clz : supported) {
boolean isAdopted = LevelTerminalRegistry.instance().isAdopted(clz);
Class<? extends IGridHost> machineClass = isAdopted ? LevelTerminalRegistry.instance().getAdopted(clz)
: clz;
for (IGridNode gridNode : grid.getMachines(machineClass)) {
final IGridHost gridHost = gridNode.getMachine();
final ILevelViewable machine = isAdopted
? LevelTerminalRegistry.instance().getAdapter(clz).adapt(gridHost)
: (ILevelViewable) gridHost;
visited.add(gridHost);
/* First check if we are already tracking this node */
if (tracked.containsKey(gridHost)) {
ContainerLevelTerminal.InvTracker knownTracker = tracked.get(gridHost);
/* Name changed? */
String name = machine.getCustomName();
if (!Objects.equals(knownTracker.name, name)) {
knownTracker.name = name;
if (update == null) update = new SPacketLevelTerminalUpdate();
update.addRenameEntry(knownTracker.id, name);
}
LevelItemInfo[] prev = knownTracker.infoList;
LevelItemInfo[] curr = machine.getLevelItemInfoList();
if (prev.length == curr.length) {
for (int i = 0; i < prev.length; i++) {
if (prev[i] == null && curr[i] == null) continue;
if (prev[i] == null) {
knownTracker.infoList[i] = curr[i];
if (update == null) update = new SPacketLevelTerminalUpdate();
update.addOverwriteSlotEntry(knownTracker.id, i, curr[i]);
} else if (curr[i] == null) {
knownTracker.infoList[i] = null;
if (update == null) update = new SPacketLevelTerminalUpdate();
update.addOverwriteSlotEntry(knownTracker.id, i, null);
} else if (!ItemStack.areItemStacksEqual(prev[i].stack, curr[i].stack)
|| prev[i].quantity == curr[i].quantity
|| prev[i].batchSize == curr[i].batchSize
|| prev[i].state == curr[i].state) {
knownTracker.infoList[i] = curr[i];
if (update == null) update = new SPacketLevelTerminalUpdate();
update.addOverwriteSlotEntry(knownTracker.id, i, curr[i]);
}
}
} else {
knownTracker.infoList = curr;
if (update == null) update = new SPacketLevelTerminalUpdate();
update.addOverwriteAllSlotEntry(knownTracker.id, curr);
}
} else {
/* Add a new entry */
if (update == null) update = new SPacketLevelTerminalUpdate();
ContainerLevelTerminal.InvTracker entry = new ContainerLevelTerminal.InvTracker(nextId++, machine);
update.addNewEntry(
entry.id,
entry.x,
entry.y,
entry.z,
entry.dim,
entry.side.ordinal(),
entry.rows,
entry.rowSize,
entry.name,
entry.infoList);
tracked.put(gridHost, entry);
trackedById.put(entry.id, entry);
}
}
}
/* Now find any entries that we need to remove */
Iterator<Map.Entry<IGridHost, ContainerLevelTerminal.InvTracker>> it = tracked.entrySet().iterator();
while (it.hasNext()) {
var entry = it.next();
if (visited.contains(entry.getKey())) {
continue;
}
if (update == null) update = new SPacketLevelTerminalUpdate();
update.addRemoveEntry(entry.getValue().id);
trackedById.remove(entry.getValue().id);
it.remove();
}
return update;
}
@Override
protected boolean isWirelessTerminal() {
return false;
}
private static class InvTracker {
private final long id;
private String name;
private final int rowSize;
private final int rows;
private final int x;
private final int y;
private final int z;
private final int dim;
private final ForgeDirection side;
private LevelItemInfo[] infoList;
public InvTracker(long id, ILevelViewable machine) {
DimensionalCoord location = machine.getLocation();
this.id = id;
this.name = machine.getCustomName();
this.rowSize = machine.rowSize();
this.rows = machine.rows();
this.x = location.x;
this.y = location.y;
this.z = location.z;
this.dim = location.getDimension();
this.side = machine.getSide();
this.infoList = machine.getLevelItemInfoList();
}
}
}
@@ -0,0 +1,17 @@
package com.glodblock.github.client.gui.container;
import net.minecraft.entity.player.InventoryPlayer;
import com.glodblock.github.inventory.item.IWirelessTerminal;
public class ContainerLevelWireless extends ContainerLevelTerminal {
public ContainerLevelWireless(InventoryPlayer ip, IWirelessTerminal monitorable) {
super(ip, monitorable);
}
@Override
protected boolean isWirelessTerminal() {
return true;
}
}
@@ -0,0 +1,106 @@
package com.glodblock.github.client.gui.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import com.glodblock.github.client.gui.container.base.FCBaseContainer;
import com.glodblock.github.inventory.item.IItemTerminal;
import com.glodblock.github.inventory.item.IWirelessMagnetFilter;
import com.glodblock.github.inventory.item.WirelessMagnet;
import appeng.api.storage.ITerminalHost;
import appeng.container.guisync.GuiSync;
import appeng.container.slot.AppEngSlot;
import appeng.container.slot.IOptionalSlotHost;
import appeng.container.slot.OptionalSlotFake;
import appeng.container.slot.SlotFake;
import appeng.container.slot.SlotPatternOutputs;
import appeng.util.Platform;
public class ContainerMagnetFilter extends FCBaseContainer implements IOptionalSlotHost {
@GuiSync(101)
public WirelessMagnet.ListMode listMode;
@GuiSync(102)
public boolean nbt;
@GuiSync(103)
public boolean meta;
@GuiSync(104)
public boolean ore;
@GuiSync(105)
public boolean oreDict;
@GuiSync(106)
public String oreDictFilter;
protected OptionalSlotFake[] filterSlots;
protected final IInventory filter;
public ContainerMagnetFilter(InventoryPlayer ip, ITerminalHost monitorable) {
super(ip, monitorable);
this.filter = ((IItemTerminal) monitorable).getInventoryByName("config");
this.filterSlots = new OptionalSlotFake[27];
oreDictFilter = ((IWirelessMagnetFilter) getHost()).getOreDictFilter();
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 9; x++) {
this.addSlotToContainer(
this.filterSlots[x + y * 9] = new SlotPatternOutputs(
this.filter,
this,
x + y * 9,
8 + x * 18,
58 + y * 18,
0,
0,
1));
this.filterSlots[x + y * 9].setRenderDisabled(false);
}
}
bindPlayerInventory(ip, 0, 126);
}
@Override
protected boolean isWirelessTerminal() {
return true;
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p, int idx) {
AppEngSlot clickSlot = (AppEngSlot) this.inventorySlots.get(idx);
if (clickSlot == null || !clickSlot.getHasStack()) return null;
ItemStack tis = clickSlot.getStack();
for (SlotFake slot : this.filterSlots) {
if (!slot.getHasStack()) {
slot.putStack(tis);
detectAndSendChanges();
break;
}
}
return super.transferStackInSlot(p, idx);
}
@Override
public void detectAndSendChanges() {
if (Platform.isServer() && this.getPortableCell() instanceof IWirelessMagnetFilter) {
IWirelessMagnetFilter host = (IWirelessMagnetFilter) this.getHost();
this.listMode = host.getListMode();
this.meta = host.getMetaMode();
this.nbt = host.getNBTMode();
this.ore = host.getOreMode();
this.oreDict = host.getOreDictMode();
this.oreDictFilter = host.getOreDictFilter();
}
super.detectAndSendChanges();
}
@Override
public boolean isSlotEnabled(int idx) {
return true;
}
}
@@ -2,11 +2,11 @@ package com.glodblock.github.client.gui.container;
import net.minecraft.entity.player.InventoryPlayer;
import com.glodblock.github.common.tile.TileOCPatternEditor;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotRestrictedInput;
import com.glodblock.github.common.tile.TileOCPatternEditor;
public class ContainerOCPatternEditor extends AEBaseContainer {
public ContainerOCPatternEditor(InventoryPlayer ipl, TileOCPatternEditor tile) {
@@ -0,0 +1,38 @@
package com.glodblock.github.client.gui.container;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.world.World;
import appeng.api.config.SecurityPermissions;
import appeng.api.networking.IGrid;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.IActionHost;
import appeng.api.networking.security.PlayerSource;
import appeng.api.storage.ITerminalHost;
import appeng.container.AEBaseContainer;
public class ContainerPatternMulti extends AEBaseContainer {
public ContainerPatternMulti(final InventoryPlayer ip, final ITerminalHost te) {
super(ip, te);
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
this.verifyPermissions(SecurityPermissions.CRAFT, false);
}
public IGrid getGrid() {
final IActionHost h = ((IActionHost) this.getTarget());
return h.getActionableNode().getGrid();
}
public World getWorld() {
return this.getPlayerInv().player.worldObj;
}
public BaseActionSource getActionSrc() {
return new PlayerSource(this.getPlayerInv().player, (IActionHost) this.getTarget());
}
}
@@ -4,7 +4,6 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import appeng.api.config.SecurityPermissions;
import appeng.api.storage.ITerminalHost;
import appeng.container.AEBaseContainer;
import appeng.container.guisync.GuiSync;
import appeng.container.slot.SlotInaccessible;
@@ -17,7 +16,7 @@ public class ContainerPatternValueAmount extends AEBaseContainer {
@GuiSync(11)
public int valueIndex;
public ContainerPatternValueAmount(final InventoryPlayer ip, final ITerminalHost te) {
public ContainerPatternValueAmount(final InventoryPlayer ip, final Object te) {
super(ip, te);
this.patternValue = new SlotInaccessible(new AppEngInternalInventory(null, 1), 0, 34, 53);
this.addSlotToContainer(patternValue);
@@ -0,0 +1,154 @@
package com.glodblock.github.client.gui.container;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.item.FCBaseItemCell;
import com.glodblock.github.common.tile.TileSuperStockReplenisher;
import com.glodblock.github.inventory.slot.OptionalFluidSlotFake;
import com.glodblock.github.network.SPacketSuperStockReplenisherUpdate;
import appeng.api.storage.data.IAEStack;
import appeng.container.AEBaseContainer;
import appeng.container.slot.IOptionalSlotHost;
import appeng.container.slot.SlotPatternOutputs;
import appeng.container.slot.SlotRestrictedInput;
import appeng.items.storage.ItemBasicStorageCell;
import appeng.util.item.AEItemStack;
public class ContainerSuperStockReplenisher extends AEBaseContainer implements IOptionalSlotHost {
private final TileSuperStockReplenisher tile;
private final IInventory configFluids;
private final IInventory configItems;
private int lastUpdated = 0;
public ContainerSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockReplenisher tile) {
super(ipl, tile);
this.tile = tile;
configFluids = tile.getConfigFluid();
configItems = tile.getConfigItems();
final IInventory cell = tile.getCell();
final int x = 8;
final int fy = 8;
this.addSlotToContainer(
new SlotRestrictedInput(
SlotRestrictedInput.PlacableItemType.WORKBENCH_CELL,
cell,
0,
173,
fy,
this.getInventoryPlayer()));
for (int i = 0; i < 9; i++) {
addSlotToContainer(new OptionalFluidSlotFake(configFluids, this, i, x, fy, i, 0, 0));
}
final int io = 29;
for (int y = 0; y < 7; y++) {
for (int ix = 0; ix < 9; ix++) {
this.addSlotToContainer(new SlotPatternOutputs(configItems, this, y * 9 + ix, x, io, ix, y, y));
}
}
bindPlayerInventory(ipl, 0, 251 - 82);
}
@Override
public ItemStack slotClick(int slotId, int clickedButton, int mode, EntityPlayer player) {
if (slotId == 0 && player.inventory.getItemStack() == null && isConfigurated()) {
return null;
}
return super.slotClick(slotId, clickedButton, mode, player);
}
@Override
public boolean isSlotEnabled(int idx) {
return true;
}
@Override
public void addCraftingToCrafters(ICrafting p_75132_1_) {
super.addCraftingToCrafters(p_75132_1_);
lastUpdated = 24;
}
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
if (lastUpdated > 20) {
lastUpdated = 0;
Map<Integer, IAEStack<?>> tmp = new HashMap<>();
for (int i = 0; i < tile.getInternalFluid().getSlots(); i++) {
tmp.put(i, tile.getInternalFluid().getFluidInSlot(i));
}
for (int i = 0; i < tile.getInternalInventory().getSizeInventory(); i++) {
tmp.put(i + 100, AEItemStack.create(tile.getInternalInventory().getStackInSlot(i)));
}
for (final Object g : this.crafters) {
if (g instanceof EntityPlayer) {
FluidCraft.proxy.netHandler.sendTo(new SPacketSuperStockReplenisherUpdate(tmp), (EntityPlayerMP) g);
}
}
}
lastUpdated++;
}
private boolean isConfigurated() {
for (int i = 0; i < configItems.getSizeInventory(); i++) {
if (configItems.getStackInSlot(i) != null) {
return true;
}
}
for (int i = 0; i < configFluids.getSizeInventory(); i++) {
if (configFluids.getStackInSlot(i) != null) {
return true;
}
}
return false;
}
@Override
public boolean isValidForSlot(Slot s, ItemStack is) {
if (s.slotNumber == 0 && s.getHasStack() && isConfigurated()) {
long currentBytes = 0;
long newBytes = -1;
if (s.getStack().getItem() instanceof ItemBasicStorageCell ibsc) {
currentBytes = ibsc.getBytesLong(is);
} else if (s.getStack().getItem() instanceof FCBaseItemCell fcbic) {
currentBytes = fcbic.getBytes(is);
}
if (is.getItem() instanceof ItemBasicStorageCell ibsc) {
newBytes = ibsc.getBytesLong(is);
} else if (is.getItem() instanceof FCBaseItemCell fcbic) {
newBytes = fcbic.getBytes(is);
}
if (currentBytes > newBytes) {
return false;
}
}
return super.isValidForSlot(s, is);
}
public TileSuperStockReplenisher getTile() {
return tile;
}
}
@@ -2,33 +2,43 @@ package com.glodblock.github.client.gui.container.base;
import net.minecraft.entity.player.InventoryPlayer;
import com.glodblock.github.inventory.item.IFluidPortableCell;
import com.glodblock.github.inventory.item.IWirelessExtendCard;
import com.glodblock.github.inventory.item.WirelessMagnet;
import com.glodblock.github.util.Util;
import appeng.api.storage.ITerminalHost;
import appeng.container.AEBaseContainer;
import com.glodblock.github.inventory.item.IFluidPortableCell;
import com.glodblock.github.util.Util;
import appeng.container.guisync.GuiSync;
import appeng.util.Platform;
public abstract class FCBaseContainer extends AEBaseContainer {
private int ticks;
private final double powerMultiplier = 0.5;
private IFluidPortableCell host;
private ITerminalHost host;
private int slot = -1;
private final InventoryPlayer ip;
@GuiSync(105)
public boolean restock = false;
@GuiSync(106)
public WirelessMagnet.Mode mode = WirelessMagnet.Mode.Off;
public FCBaseContainer(InventoryPlayer ip, ITerminalHost monitorable) {
super(ip, monitorable);
this.ip = ip;
this.host = monitorable;
if (isWirelessTerminal()) {
host = (IFluidPortableCell) monitorable;
this.slot = lockSlot();
}
}
private int lockSlot() {
if (isWirelessTerminal()) {
if (this.host != null) {
final int slotIndex = this.host.getInventorySlot();
if (this.host instanceof IFluidPortableCell) {
final int slotIndex = ((IFluidPortableCell) this.host).getInventorySlot();
if (Util.GuiHelper.decodeInvType(slotIndex).getLeft() == Util.GuiHelper.InvType.PLAYER_INV) {
this.lockPlayerInventorySlot(slotIndex);
}
@@ -50,7 +60,14 @@ public abstract class FCBaseContainer extends AEBaseContainer {
this.slot,
this.ticks,
this.getPowerMultiplier(),
this.host);
((IFluidPortableCell) this.host));
}
if (Platform.isServer()) {
if (this.host instanceof IWirelessExtendCard wec) {
this.mode = wec.getMagnetCardMode();
this.restock = wec.isRestock();
}
}
super.detectAndSendChanges();
}
@@ -59,4 +76,14 @@ public abstract class FCBaseContainer extends AEBaseContainer {
return this.powerMultiplier;
}
public ITerminalHost getHost() {
return this.host;
}
public IFluidPortableCell getPortableCell() {
if (this.host instanceof IFluidPortableCell fpc) {
return fpc;
}
return null;
}
}
@@ -1,6 +1,10 @@
package com.glodblock.github.client.gui.container.base;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import net.minecraft.entity.player.EntityPlayer;
@@ -13,25 +17,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.definitions.IDefinitions;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEItemStack;
import appeng.container.guisync.GuiSync;
import appeng.container.slot.*;
import appeng.helpers.IContainerCraftingPacket;
import appeng.helpers.InventoryAction;
import appeng.items.misc.ItemEncodedPattern;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.inventory.IAEAppEngInventory;
import appeng.tile.inventory.InvOperation;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import com.glodblock.github.client.gui.container.ContainerItemMonitor;
import com.glodblock.github.common.item.ItemFluidDrop;
@@ -43,9 +29,32 @@ import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.FluidPatternDetails;
import com.glodblock.github.util.Util;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.definitions.IDefinitions;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEItemStack;
import appeng.container.guisync.GuiSync;
import appeng.container.slot.IOptionalSlotHost;
import appeng.container.slot.OptionalSlotFake;
import appeng.container.slot.SlotFake;
import appeng.container.slot.SlotFakeCraftingMatrix;
import appeng.container.slot.SlotPatternTerm;
import appeng.container.slot.SlotRestrictedInput;
import appeng.helpers.IContainerCraftingPacket;
import appeng.helpers.InventoryAction;
import appeng.items.misc.ItemEncodedPattern;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.inventory.IAEAppEngInventory;
import appeng.tile.inventory.InvOperation;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
implements IAEAppEngInventory, IOptionalSlotHost, IContainerCraftingPacket, IPatternConsumer {
public static final int MULTIPLE_OF_BUTTON_CLICK = 2;
public static final int MULTIPLE_OF_BUTTON_CLICK_ON_SHIFT = 8;
protected final IItemPatternTerminal patternTerminal;
protected final AppEngInternalInventory cOut = new AppEngInternalInventory(null, 1);
protected final IInventory crafting;
@@ -115,7 +124,7 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
return;
}
if (action == InventoryAction.MOVE_REGION) {
super.doAction(player, InventoryAction.SPLIT_OR_PLACE_SINGLE, slotId, id);
super.doAction(player, InventoryAction.MOVE_REGION, slotId, id);
return;
}
if (action == InventoryAction.PICKUP_SINGLE) {
@@ -124,19 +133,21 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
}
Slot slot = getSlot(slotId);
ItemStack stack = player.inventory.getItemStack();
if (Util.getFluidFromItem(stack) == null || Util.getFluidFromItem(stack).amount <= 0) {
FluidStack fluid = Util.getFluidFromItem(stack);
if (fluid == null || fluid.amount <= 0) {
super.doAction(player, action, slotId, id);
return;
}
if (validPatternSlot(slot)
&& (stack.getItem() instanceof IFluidContainerItem || FluidContainerRegistry.isContainer(stack))) {
FluidStack fluid = null;
if (validPatternSlot(slot)) {
switch (action) {
case PICKUP_OR_SET_DOWN:
fluid = Util.getFluidFromItem(stack);
case PICKUP_OR_SET_DOWN -> {
slot.putStack(ItemFluidPacket.newStack(fluid));
break;
case SPLIT_OR_PLACE_SINGLE:
return;
}
case SPLIT_OR_PLACE_SINGLE -> {
fluid = Util.getFluidFromItem(Util.copyStackWithSize(stack, 1));
FluidStack origin = ItemFluidPacket.getFluidStack(slot.getStack());
if (fluid != null && fluid.equals(origin)) {
@@ -144,13 +155,11 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
if (fluid.amount <= 0) fluid = null;
}
slot.putStack(ItemFluidPacket.newStack(fluid));
break;
return;
}
default -> {}
}
if (fluid == null) {
super.doAction(player, action, slotId, id);
return;
}
return;
}
super.doAction(player, action, slotId, id);
}
@@ -248,13 +257,22 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
return hasFluid && search; // search=false -> outputs were empty
}
protected ItemStack stampAuthor(ItemStack patternStack) {
if (patternStack.stackTagCompound == null) {
patternStack.stackTagCompound = new NBTTagCompound();
}
patternStack.stackTagCompound.setString("author", getPlayerInv().player.getCommandSenderName());
return patternStack;
}
protected void encodeFluidPattern() {
ItemStack patternStack = new ItemStack(ItemAndBlockHolder.PATTERN);
FluidPatternDetails pattern = new FluidPatternDetails(patternStack);
pattern.setInputs(collectInventory(this.craftingSlots));
pattern.setOutputs(collectInventory(this.outputSlots));
pattern.setCanBeSubstitute(this.beSubstitute ? 1 : 0);
patternSlotOUT.putStack(pattern.writeToStack());
pattern.setCombine(this.combine ? 1 : 0);
patternSlotOUT.putStack(stampAuthor(pattern.writeToStack()));
}
protected static IAEItemStack[] collectInventory(Slot[] slots) {
@@ -431,6 +449,7 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
encodedValue.setBoolean("beSubstitute", this.beSubstitute);
encodedValue.setBoolean("prioritize", this.prioritize);
output.setTagCompound(encodedValue);
stampAuthor(output);
this.patternSlotOUT.putStack(output);
}
@@ -474,8 +493,7 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
protected NBTBase createItemTag(final ItemStack i) {
final NBTTagCompound c = new NBTTagCompound();
if (i != null) {
i.writeToNBT(c);
c.setInteger("Count", i.stackSize);
Util.writeItemStackToNBT(i, c);
}
return c;
}
@@ -523,15 +541,89 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
return false;
}
public void doubleStacks(boolean isShift) {
if (canDoubleStacks(craftingSlots) && canDoubleStacks(outputSlots)) {
doubleStacksInternal(this.craftingSlots);
doubleStacksInternal(this.outputSlots);
if (isShift && (containsItem(outputSlots) || containsItem(craftingSlots))) {
while (canDoubleStacks(craftingSlots) && canDoubleStacks(outputSlots)) {
doubleStacksInternal(this.craftingSlots);
doubleStacksInternal(this.outputSlots);
public void doubleStacks(int val) {
multiplyOrDivideStacks(
((val & 1) != 0 ? MULTIPLE_OF_BUTTON_CLICK_ON_SHIFT : MULTIPLE_OF_BUTTON_CLICK)
* ((val & 2) != 0 ? -1 : 1));
}
static boolean canMultiplyOrDivide(SlotFake[] slots, int mult) {
if (mult > 0) {
for (Slot s : slots) {
ItemStack st = s.getStack();
if (st == null) continue;
final long count;
if (st.getItem() instanceof ItemFluidPacket) {
count = ItemFluidPacket.getFluidAmount(st);
} else {
count = s.getStack().stackSize;
}
long result = count * mult;
if (result > Integer.MAX_VALUE) {
return false;
}
}
return true;
} else if (mult < 0) {
mult = Math.abs(mult);
for (Slot s : slots) {
ItemStack st = s.getStack();
if (st == null) continue;
final int count;
if (st.getItem() instanceof ItemFluidPacket) {
count = ItemFluidPacket.getFluidAmount(st);
} else {
count = s.getStack().stackSize;
}
if (count % mult != 0) {
return false;
}
}
return true;
}
return false;
}
static void multiplyOrDivideStacksInternal(SlotFake[] slots, int mult) {
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
if (mult > 0) {
for (final Slot s : enabledSlots) {
ItemStack st = s.getStack();
if (st != null) {
if (st.getItem() instanceof ItemFluidPacket) {
ItemFluidPacket.setFluidAmount(st, ItemFluidPacket.getFluidAmount(st) * mult);
} else {
st.stackSize *= mult;
s.putStack(st);
}
}
}
} else if (mult < 0) {
mult = Math.abs(mult);
for (final Slot s : enabledSlots) {
ItemStack st = s.getStack();
if (st != null) {
if (st.getItem() instanceof ItemFluidPacket) {
ItemFluidPacket.setFluidAmount(st, ItemFluidPacket.getFluidAmount(st) / mult);
} else {
st.stackSize /= mult;
s.putStack(st);
}
}
}
}
}
/**
* Multiply or divide a number
*
* @param multi Positive numbers are multiplied and negative numbers are divided
*/
public void multiplyOrDivideStacks(int multi) {
if (!isCraftingMode()) {
if (canMultiplyOrDivide(this.craftingSlots, multi) && canMultiplyOrDivide(this.outputSlots, multi)) {
multiplyOrDivideStacksInternal(this.craftingSlots, multi);
multiplyOrDivideStacksInternal(this.outputSlots, multi);
}
this.detectAndSendChanges();
}
@@ -10,6 +10,12 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
import com.glodblock.github.network.SPacketFluidUpdate;
import com.glodblock.github.util.Util;
import appeng.api.config.Upgrades;
import appeng.api.implementations.IUpgradeableHost;
import appeng.api.storage.data.IAEFluidStack;
@@ -19,13 +25,6 @@ import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.util.Platform;
import appeng.util.item.AEFluidStack;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
import com.glodblock.github.network.SPacketFluidUpdate;
import com.glodblock.github.util.Ae2Reflect;
import com.glodblock.github.util.Util;
public abstract class FCContainerFluidConfigurable extends ContainerUpgradeable {
public FCContainerFluidConfigurable(InventoryPlayer ip, IUpgradeableHost te) {
@@ -64,7 +63,7 @@ public abstract class FCContainerFluidConfigurable extends ContainerUpgradeable
protected void setupConfig() {
this.setupUpgrades();
final IInventory inv = Ae2Reflect.getUpgradeList(this).getInventoryByName("config");
final IInventory inv = getUpgradeable().getInventoryByName("config");
final int y = 40;
final int x = 80;
this.addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(inv, null, this, 0, x, y, 0, 0, 0));
@@ -84,7 +83,7 @@ public abstract class FCContainerFluidConfigurable extends ContainerUpgradeable
protected boolean isValidForConfig(int slot, IAEFluidStack fs) {
if (this.supportCapacity()) {
// assumes 4 slots per upgrade
final int upgrades = Ae2Reflect.getUpgradeList(this).getInstalledUpgrades(Upgrades.CAPACITY);
final int upgrades = getUpgradeable().getInstalledUpgrades(Upgrades.CAPACITY);
if (slot > 0 && upgrades < 1) {
return false;
@@ -98,7 +97,7 @@ public abstract class FCContainerFluidConfigurable extends ContainerUpgradeable
@Override
protected void standardDetectAndSendChanges() {
if (Platform.isServer()) {
// clear out config items that are no longer valid (eg capacity upgrade removed)
// clear out config items that are no longer valid (for instance, capacity upgrade removed)
final AppEngInternalAEInventory inv = this.getFakeFluidInv();
final Map<Integer, IAEFluidStack> tmp = new HashMap<>();
for (int i = 0; i < inv.getSizeInventory(); ++i) {
@@ -1,6 +1,8 @@
package com.glodblock.github.client.gui.container.base;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nonnull;
@@ -10,12 +12,33 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.item.ItemStack;
import appeng.api.config.*;
import com.glodblock.github.inventory.item.BaseWirelessInventory;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.network.SPacketMEUpdateBuffer;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import appeng.api.config.Actionable;
import appeng.api.config.CraftingAllow;
import appeng.api.config.PinsState;
import appeng.api.config.PowerMultiplier;
import appeng.api.config.SecurityPermissions;
import appeng.api.config.Settings;
import appeng.api.config.SortDir;
import appeng.api.config.SortOrder;
import appeng.api.config.TypeFilter;
import appeng.api.config.ViewItems;
import appeng.api.networking.IGridNode;
import appeng.api.networking.crafting.ICraftingCPU;
import appeng.api.networking.crafting.ICraftingGrid;
import appeng.api.networking.energy.IEnergyGrid;
import appeng.api.networking.security.PlayerSource;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.IMEMonitorHandlerReceiver;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.ITerminalPins;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.util.IConfigManager;
import appeng.api.util.IConfigurableObject;
@@ -24,21 +47,22 @@ import appeng.container.slot.SlotRestrictedInput;
import appeng.core.AELog;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.helpers.IPinsHandler;
import appeng.helpers.WirelessTerminalGuiObject;
import appeng.items.contents.PinsHandler;
import appeng.util.ConfigManager;
import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.network.SPacketMEUpdateBuffer;
public abstract class FCContainerMonitor<T extends IAEStack<T>> extends FCBaseContainer
implements IConfigManagerHost, IConfigurableObject, IMEMonitorHandlerReceiver<T> {
implements IConfigManagerHost, IConfigurableObject, IMEMonitorHandlerReceiver<T>, IPinsHandler {
protected final SlotRestrictedInput[] cellView = new SlotRestrictedInput[5];
protected final IConfigManager clientCM;
protected final ITerminalHost host;
protected PinsHandler pinsHandler = null;
@GuiSync(99)
public boolean canAccessViewCells = false;
@@ -63,6 +87,14 @@ public abstract class FCContainerMonitor<T extends IAEStack<T>> extends FCBaseCo
this.clientCM.registerSetting(Settings.VIEW_MODE, ViewItems.ALL);
this.clientCM.registerSetting(Settings.SORT_DIRECTION, SortDir.ASCENDING);
this.clientCM.registerSetting(Settings.TYPE_FILTER, TypeFilter.ALL);
this.clientCM.registerSetting(Settings.PINS_STATE, PinsState.DISABLED); // use for GUI
if (Platform.isServer()) {
if (monitorable instanceof ITerminalPins t && !(monitorable instanceof BaseWirelessInventory bwi
&& bwi.getChannel() == StorageChannel.FLUIDS)) {
pinsHandler = t.getPinsHandler(ip.player);
}
}
}
public IMEMonitor<T> getMonitor() {
@@ -98,6 +130,16 @@ public abstract class FCContainerMonitor<T extends IAEStack<T>> extends FCBaseCo
}
}
}
if (pinsHandler != null) {
if (clientCM.getSetting(Settings.PINS_STATE) != pinsHandler.getPinsState()) {
this.clientCM.putSetting(Settings.PINS_STATE, pinsHandler.getPinsState());
updatePins(true);
} else {
updatePins(false);
}
}
processItemList();
this.updatePowerStatus();
final boolean oldAccessible = this.canAccessViewCells;
@@ -115,6 +157,84 @@ public abstract class FCContainerMonitor<T extends IAEStack<T>> extends FCBaseCo
}
}
private int lastUpdate = 0;
public void updatePins(boolean forceUpdate) {
if (pinsHandler == null || !(host instanceof ITerminalPins itp)) return;
boolean isActive = pinsHandler.getPinsState() != PinsState.DISABLED;
++lastUpdate;
if (!forceUpdate && lastUpdate <= 20) return;
lastUpdate = 0;
if (isActive) {
final ICraftingGrid cc = itp.getGrid().getCache(ICraftingGrid.class);
final ImmutableList<ICraftingCPU> cpuList = cc.getCpus().asList();
List<IAEItemStack> craftedItems = new ArrayList<>();
// fetch the first available crafting output
for (int i = 0; i < cpuList.size(); i++) {
ICraftingCPU cpu = cpuList.get(i);
if (cpu.getCraftingAllowMode() != CraftingAllow.ONLY_NONPLAYER && cpu.getFinalOutput() != null
&& cpu.getCurrentJobSource() instanceof PlayerSource src
&& src.player == pinsHandler.getPlayer()) {
if (craftedItems.contains(cpu.getFinalOutput())) {
continue; // skip if already added
}
if (cpu.isBusy()) craftedItems.add(0, cpu.getFinalOutput().copy());
else craftedItems.add(cpu.getFinalOutput().copy());
}
}
pinsHandler.addItemsToPins(craftedItems);
}
pinsHandler.update(forceUpdate);
onListUpdate(); // notify the repo that the pins have changed
}
@Override
public void setPin(ItemStack is, int idx) {
if (pinsHandler == null || !(host instanceof ITerminalPins itp)) return;
if (is == null) {
final ICraftingGrid cc = itp.getGrid().getCache(ICraftingGrid.class);
final ImmutableSet<ICraftingCPU> cpuSet = cc.getCpus();
for (ICraftingCPU cpu : cpuSet) {
if (cpu.getCraftingAllowMode() != CraftingAllow.ONLY_NONPLAYER && cpu.getFinalOutput() != null
&& cpu.getFinalOutput().isSameType(getPin(idx))) {
if (!cpu.isBusy()) {
cpu.resetFinalOutput();
} else {
return;
}
}
}
}
pinsHandler.setPin(idx, is);
updatePins(true);
}
@Override
public ItemStack getPin(int idx) {
if (pinsHandler == null) return null;
return pinsHandler.getPin(idx);
}
public void setPinsState(PinsState pinsState) {
if (pinsHandler == null) return;
clientCM.putSetting(Settings.PINS_STATE, pinsState);
pinsHandler.setPinsState(pinsState);
updatePins(true);
}
public PinsState getPinsState() {
return pinsHandler != null ? pinsHandler.getPinsState() : PinsState.DISABLED;
}
public PinsHandler getPinsHandler() {
return pinsHandler;
}
protected abstract void processItemList();
protected boolean isInvalid() {
@@ -210,21 +330,17 @@ public abstract class FCContainerMonitor<T extends IAEStack<T>> extends FCBaseCo
@Override
public void onListUpdate() {
for (final Object c : this.crafters) {
if (c instanceof ICrafting) {
final ICrafting cr = (ICrafting) c;
if (c instanceof final ICrafting cr) {
this.queueInventory(cr);
}
}
}
@Override
public void updateSetting(final IConfigManager manager, final Enum settingName, final Enum newValue) {
public void updateSetting(final IConfigManager manager, @SuppressWarnings("rawtypes") final Enum settingName,
@SuppressWarnings("rawtypes") final Enum newValue) {
if (this.getGui() != null) {
this.getGui().updateSetting(manager, settingName, newValue);
}
}
public ITerminalHost getHost() {
return this.host;
}
}
@@ -1,17 +1,24 @@
package com.glodblock.github.client.me;
import java.util.Iterator;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Pattern;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.widgets.IScrollSource;
import appeng.client.gui.widgets.ISortSource;
import net.minecraftforge.fluids.Fluid;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.crossmod.thaumcraft.AspectUtil;
import com.glodblock.github.util.FluidSorters;
import appeng.api.config.SearchBoxMode;
import appeng.api.config.Settings;
import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.widgets.IScrollSource;
import appeng.client.gui.widgets.ISortSource;
import appeng.core.AEConfig;
public class EssentiaRepo extends FluidRepo {
@@ -19,21 +26,118 @@ public class EssentiaRepo extends FluidRepo {
super(src, sortSrc);
}
@SuppressWarnings("deprecation")
@Override
public void updateView() {
super.updateView();
Iterator<IAEItemStack> it1 = this.view.iterator();
while (it1.hasNext()) {
IAEFluidStack fluid = ItemFluidDrop.getAeFluidStack(it1.next());
if (!AspectUtil.isEssentiaGas(fluid)) {
it1.remove();
if (this.paused) {
// Update existing view with new data
for (int i = 0; i < this.view.size(); i++) {
IAEItemStack entry = this.view.get(i);
IAEItemStack serverEntry = this.list.findPrecise(entry);
if (serverEntry == null) {
entry.setStackSize(0);
} else {
this.view.set(i, serverEntry);
}
}
// Append newly added item stacks to the end of the view
Set<IAEItemStack> viewSet = new HashSet<>(this.view);
ArrayList<IAEItemStack> entriesToAdd = new ArrayList<>();
for (IAEItemStack serverEntry : this.list) {
if (!viewSet.contains(serverEntry)) {
entriesToAdd.add(serverEntry);
}
}
addEntriesToView(entriesToAdd);
} else {
this.view.clear();
this.view.ensureCapacity(this.list.size());
addEntriesToView(this.list);
}
// Do not sort if paused
if (!this.paused) {
final Enum<?> SortBy = this.sortSrc.getSortBy();
final Enum<?> SortDir = this.sortSrc.getSortDir();
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
FluidSorters.init();
if (SortBy == SortOrder.MOD) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_MOD);
} else if (SortBy == SortOrder.AMOUNT) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_SIZE);
} else if (SortBy == SortOrder.INVTWEAKS) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
} else {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_NAME);
}
}
Iterator<ItemStack> it2 = this.dsp.iterator();
while (it2.hasNext()) {
FluidStack fluid = ItemFluidDrop.getFluidStack(it2.next());
// Update the display
this.dsp.clear();
this.dsp.ensureCapacity(this.list.size());
for (final IAEItemStack is : this.view) {
this.dsp.add(is.getItemStack());
}
}
private void addEntriesToView(Iterable<IAEItemStack> entries) {
final Enum<?> viewMode = this.sortSrc.getSortDisplay();
final Enum<?> searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
if (searchMode == SearchBoxMode.NEI_AUTOSEARCH || searchMode == SearchBoxMode.NEI_MANUAL_SEARCH) {
this.updateNEI(this.searchString);
}
String innerSearch = this.searchString;
if (innerSearch.startsWith("@")) {
innerSearch = innerSearch.substring(1);
}
Pattern m;
try {
m = Pattern.compile(innerSearch.toLowerCase(), Pattern.CASE_INSENSITIVE);
} catch (final Throwable ignore) {
try {
m = Pattern.compile(Pattern.quote(innerSearch.toLowerCase()), Pattern.CASE_INSENSITIVE);
} catch (final Throwable __) {
return;
}
}
for (IAEItemStack is : entries) {
if (!AspectUtil.isEssentiaGas(ItemFluidDrop.getAeFluidStack(is))) {
continue;
}
if (this.myPartitionList != null) {
if (!this.myPartitionList.isListed(is)) {
continue;
}
}
if (viewMode == ViewItems.CRAFTABLE && !is.isCraftable()) {
continue;
}
if (viewMode == ViewItems.CRAFTABLE) {
is = is.copy();
is.setStackSize(0);
}
if (viewMode == ViewItems.STORED && is.getStackSize() == 0) {
continue;
}
Fluid fluid = ItemFluidDrop.getAeFluidStack(is).getFluid();
if (!AspectUtil.isEssentiaGas(fluid)) {
it2.remove();
continue;
}
if (m.matcher(fluid.getLocalizedName().toLowerCase()).find()) {
this.view.add(is);
}
}
}
@@ -13,6 +13,8 @@ package com.glodblock.github.client.me;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Pattern;
import javax.annotation.Nonnull;
@@ -20,43 +22,48 @@ import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import appeng.api.AEApi;
import appeng.api.config.*;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.client.gui.widgets.IScrollSource;
import appeng.client.gui.widgets.ISortSource;
import appeng.client.me.ItemRepo;
import appeng.core.AEConfig;
import appeng.items.storage.ItemViewCell;
import appeng.util.prioitylist.IPartitionList;
import com.glodblock.github.api.FluidCraftAPI;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.util.FluidSorters;
import com.glodblock.github.util.Util;
import appeng.api.AEApi;
import appeng.api.config.SearchBoxMode;
import appeng.api.config.Settings;
import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IDisplayRepo;
import appeng.api.storage.data.IItemList;
import appeng.client.gui.widgets.IScrollSource;
import appeng.client.gui.widgets.ISortSource;
import appeng.core.AEConfig;
import appeng.items.storage.ItemViewCell;
import appeng.util.prioitylist.IPartitionList;
import cpw.mods.fml.relauncher.ReflectionHelper;
public class FluidRepo extends ItemRepo {
public class FluidRepo implements IDisplayRepo {
private final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
protected final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
protected final ArrayList<IAEItemStack> view = new ArrayList<>();
protected final ArrayList<ItemStack> dsp = new ArrayList<>();
private final IScrollSource src;
private final ISortSource sortSrc;
protected final IScrollSource src;
protected final ISortSource sortSrc;
private int rowSize = 9;
protected int rowSize = 9;
private String searchString = "";
private IPartitionList<IAEItemStack> myPartitionList;
protected String searchString = "";
protected IPartitionList<IAEItemStack> myPartitionList;
protected boolean paused = false;
private String NEIWord = null;
private boolean hasPower;
public FluidRepo(final IScrollSource src, final ISortSource sortSrc) {
super(src, sortSrc);
this.src = src;
this.sortSrc = sortSrc;
}
@Override
public IAEItemStack getReferenceItem(int idx) {
idx += this.src.getCurrentScroll() * this.rowSize;
@@ -66,6 +73,7 @@ public class FluidRepo extends ItemRepo {
return this.view.get(idx);
}
@Override
public ItemStack getItem(int idx) {
idx += this.src.getCurrentScroll() * this.rowSize;
@@ -75,10 +83,7 @@ public class FluidRepo extends ItemRepo {
return this.dsp.get(idx);
}
void setSearch(final String search) {
this.searchString = search == null ? "" : search;
}
@Override
public void postUpdate(final IAEItemStack is) {
final IAEItemStack st = this.list.findPrecise(is);
if (st != null) {
@@ -89,18 +94,69 @@ public class FluidRepo extends ItemRepo {
}
}
@Override
public void setViewCell(final ItemStack[] list) {
this.myPartitionList = ItemViewCell.createFilter(list);
this.updateView();
}
@SuppressWarnings("deprecation")
@Override
public void updateView() {
this.view.clear();
if (this.paused) {
// Update existing view with new data
for (int i = 0; i < this.view.size(); i++) {
IAEItemStack entry = this.view.get(i);
IAEItemStack serverEntry = this.list.findPrecise(entry);
if (serverEntry == null) {
entry.setStackSize(0);
} else {
this.view.set(i, serverEntry);
}
}
// Append newly added item stacks to the end of the view
Set<IAEItemStack> viewSet = new HashSet<>(this.view);
ArrayList<IAEItemStack> entriesToAdd = new ArrayList<>();
for (IAEItemStack serverEntry : this.list) {
if (!viewSet.contains(serverEntry)) {
entriesToAdd.add(serverEntry);
}
}
addEntriesToView(entriesToAdd);
} else {
this.view.clear();
this.view.ensureCapacity(this.list.size());
addEntriesToView(this.list);
}
// Do not sort if paused
if (!paused) {
final Enum<?> SortBy = this.sortSrc.getSortBy();
final Enum<?> SortDir = this.sortSrc.getSortDir();
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
FluidSorters.init();
if (SortBy == SortOrder.MOD) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_MOD);
} else if (SortBy == SortOrder.AMOUNT) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_SIZE);
} else if (SortBy == SortOrder.INVTWEAKS) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
} else {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_NAME);
}
}
this.dsp.clear();
this.view.ensureCapacity(this.list.size());
this.dsp.ensureCapacity(this.list.size());
for (final IAEItemStack is : this.view) {
this.dsp.add(is.getItemStack());
}
}
private void addEntriesToView(Iterable<IAEItemStack> entries) {
final Enum<?> viewMode = this.sortSrc.getSortDisplay();
final Enum<?> searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
if (searchMode == SearchBoxMode.NEI_AUTOSEARCH || searchMode == SearchBoxMode.NEI_MANUAL_SEARCH) {
@@ -126,7 +182,7 @@ public class FluidRepo extends ItemRepo {
}
}
for (IAEItemStack is : this.list) {
for (IAEItemStack is : entries) {
if (this.myPartitionList != null) {
if (!this.myPartitionList.isListed(is)) {
continue;
@@ -145,7 +201,13 @@ public class FluidRepo extends ItemRepo {
if (viewMode == ViewItems.STORED && is.getStackSize() == 0) {
continue;
}
Fluid fluid = ItemFluidDrop.getAeFluidStack(is).getFluid();
if (FluidCraftAPI.instance().isBlacklistedInDisplay(fluid.getClass())) {
continue;
}
if (searchMod) {
if (m.matcher(Util.getFluidModID(fluid).toLowerCase()).find()
|| m.matcher(Util.getFluidModName(fluid).toLowerCase()).find()) {
@@ -157,29 +219,9 @@ public class FluidRepo extends ItemRepo {
}
}
}
final Enum<?> SortBy = this.sortSrc.getSortBy();
final Enum<?> SortDir = this.sortSrc.getSortDir();
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
FluidSorters.init();
if (SortBy == SortOrder.MOD) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_MOD);
} else if (SortBy == SortOrder.AMOUNT) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_SIZE);
} else if (SortBy == SortOrder.INVTWEAKS) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
} else {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_NAME);
}
for (final IAEItemStack is : this.view) {
this.dsp.add(is.getItemStack());
}
}
private void updateNEI(final String filter) {
protected void updateNEI(final String filter) {
try {
if (this.NEIWord == null || !this.NEIWord.equals(filter)) {
final Class<?> c = ReflectionHelper
@@ -199,19 +241,23 @@ public class FluidRepo extends ItemRepo {
}
}
@Override
public int size() {
return this.view.size();
}
@Override
public void clear() {
this.list.resetStatus();
}
@Override
public boolean hasPower() {
return this.hasPower;
}
public void setPower(final boolean hasPower) {
@Override
public void setPowered(final boolean hasPower) {
this.hasPower = hasPower;
}
@@ -230,4 +276,21 @@ public class FluidRepo extends ItemRepo {
public void setSearchString(@Nonnull final String searchString) {
this.searchString = searchString;
}
@Override
public boolean isPaused() {
return this.paused;
}
@Override
public void setPaused(boolean paused) {
if (this.paused != paused) {
this.paused = paused;
// Update view when un-paused
if (!paused) {
updateView();
}
}
}
}
@@ -19,6 +19,9 @@ import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.render.tank.ModelCertusTank;
import com.glodblock.github.common.tile.TileCertusQuartzTank;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.ModAndClassUtil;
import com.mitchej123.hodgepodge.textures.IPatchedTextureAtlasSprite;
import cpw.mods.fml.client.registry.ClientRegistry;
public class ItemCertusQuartzTankRender implements IItemRenderer {
@@ -65,6 +68,9 @@ public class ItemCertusQuartzTankRender implements IItemRenderer {
if (storedFluid != null && storedFluid.getFluid() != null) {
IIcon fluidIcon = storedFluid.getFluid().getIcon();
if (fluidIcon == null) fluidIcon = FluidRegistry.LAVA.getIcon();
if (ModAndClassUtil.HODGEPODGE && fluidIcon instanceof IPatchedTextureAtlasSprite) {
((IPatchedTextureAtlasSprite) fluidIcon).markNeedsAnimationUpdate();
}
Tessellator tessellator = Tessellator.instance;
RenderBlocks renderer = new RenderBlocks();
GL11.glScalef(1, 1, -1);
@@ -13,7 +13,9 @@ import org.lwjgl.opengl.GL11;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.RenderUtil;
import com.mitchej123.hodgepodge.textures.IPatchedTextureAtlasSprite;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -50,6 +52,10 @@ public class ItemPacketRender implements IItemRenderer {
}
IIcon icon = fluid == null ? FluidRegistry.WATER.getStillIcon() : fluid.getFluid().getStillIcon();
if (ModAndClassUtil.HODGEPODGE && icon instanceof IPatchedTextureAtlasSprite) {
((IPatchedTextureAtlasSprite) icon).markNeedsAnimationUpdate();
}
if (RGB != 0xFFFFFF) {
GL11.glColor3f((RGB >> 16 & 0xFF) / 255.0F, (RGB >> 8 & 0xFF) / 255.0F, (RGB & 0xFF) / 255.0F);
}
@@ -14,6 +14,7 @@ import org.lwjgl.opengl.GL11;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.tile.TileWalrus;
import com.glodblock.github.loader.ItemAndBlockHolder;
import cpw.mods.fml.client.registry.ClientRegistry;
public class ItemWalrusRender implements IItemRenderer {
@@ -36,15 +37,12 @@ public class ItemWalrusRender implements IItemRenderer {
Minecraft.getMinecraft().renderEngine.bindTexture(this.textureWalrus);
GL11.glPushMatrix();
switch (type) {
case EQUIPPED_FIRST_PERSON:
case EQUIPPED_FIRST_PERSON -> {
GL11.glRotated(180, 0, 1, 0);
GL11.glTranslatef(-1F, 0.5F, -0.5F);
break;
case INVENTORY:
GL11.glTranslatef(-0.5F, -0.5F, -0.1F);
break;
default:
break;
}
case INVENTORY -> GL11.glTranslatef(-0.5F, -0.5F, -0.1F);
default -> {}
}
this.modelWalrus.renderAll();
GL11.glPopMatrix();
Loaded 100 of 371 files, more files were not shown because too many files have changed in this diff. Show more