Compare commits

...
135 Commits
Author SHA1 Message Date
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
138 changed files with 3625 additions and 2397 deletions

No files matched your search

+20 -16
View File
@@ -34,26 +34,30 @@
* For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph
*/
dependencies {
api('com.github.GTNewHorizons:NotEnoughItems:2.5.25-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-347-GTNH:dev')
api('com.github.GTNewHorizons:NotEnoughItems:2.7.40-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-600-GTNH:dev')
api('curse.maven:cofh-core-69162:2388751')
api('com.github.GTNewHorizons:waila:1.7.2:dev')
api('com.github.GTNewHorizons:waila:1.8.4:dev')
api("com.github.GTNewHorizons:GTNHLib:0.6.21:dev")
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.11.2:dev")
compileOnly("com.github.GTNewHorizons:GTNHLib:0.2.10:dev") { transitive = false }
compileOnly('com.github.GTNewHorizons:Baubles:1.0.4:dev')
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.34:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ForestryMC:4.8.8:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.7.1:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.140:dev') {
exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework'
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.12.0:dev") {
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
}
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.1.7-GTNH:dev')
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.35:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ForestryMC:4.10.7:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.9.12:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.279:dev') {
exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework'
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
}
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:OpenComputers:1.10.9-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.6.4-GTNH:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.4.40:dev") { transitive = false }
compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.13-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.7.7-GTNH:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.6.53:dev") { transitive = false }
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.2.3:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.3.4:dev")
}
+21 -10
View File
@@ -3,7 +3,7 @@
gtnh.settings.blowdryerTag = 0.2.0
# Human-readable mod name, available for mcmod.info population.
modName = Fluid Craft For AE2
modName = AE2 Fluid Crafting
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
# Conventionally lowercase.
@@ -14,7 +14,7 @@ modId = ae2fc
modGroup = com.glodblock.github
# Whether to use modGroup as the maven publishing group.
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
# When false, com.github.GTNewHorizons is used.
useModGroupForPublishing = false
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
@@ -45,24 +45,24 @@ enableModernJavaSyntax = true
# Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
enableGenericInjection = false
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 =
generateGradleTokenClass = com.glodblock.github.FCTags
# Name of the token containing the project's current version to generate/replace.
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenVersion = VERSION
# [DEPRECATED] Mod ID replacement token.
gradleTokenModId = GRADLETOKEN_MODID
gradleTokenModId =
# [DEPRECATED] Mod name replacement token.
gradleTokenModName = GRADLETOKEN_MODNAME
gradleTokenModName =
# [DEPRECATED] Mod Group replacement token.
gradleTokenGroupName = GRADLETOKEN_GROUPNAME
gradleTokenGroupName =
# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
@@ -70,7 +70,7 @@ 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 = FluidCraft.java
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.
@@ -85,6 +85,11 @@ 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
@@ -117,9 +122,15 @@ minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true
# Adds the GTNH maven, CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
# 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.
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+5 -3
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/.
@@ -84,7 +86,7 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
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
@@ -203,7 +205,7 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# * 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.
Vendored
+2
View File
@@ -13,6 +13,8 @@
@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 ##########################################################################
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.21'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.38'
}
@@ -36,9 +36,9 @@ import cpw.mods.fml.common.network.NetworkRegistry;
dependencies = "required-after:appliedenergistics2@[rv3-beta-238,);required-after:CoFHCore;required-after:Baubles;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;
@@ -76,7 +76,12 @@ 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();
@@ -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());
}
}
}
@@ -3,6 +3,7 @@ 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;
@@ -16,10 +17,14 @@ 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.client.gui.widgets.GuiTabButton;
import appeng.container.AEBaseContainer;
import appeng.helpers.InventoryAction;
public class GuiCraftingStatus extends appeng.client.gui.implementations.GuiCraftingStatus {
@@ -77,4 +82,20 @@ public class GuiCraftingStatus extends appeng.client.gui.implementations.GuiCraf
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(),
0,
hoveredAEStack));
return;
}
super.mouseClicked(xCoord, yCoord, btn);
}
}
@@ -42,6 +42,7 @@ public class GuiDualInterface extends GuiUpgradeable {
private GuiTabButton priority;
private GuiTabButton switcher;
private GuiImgButton BlockMode;
private GuiImgButton SmartBlockMode;
private GuiToggleButton interfaceMode;
private GuiImgButton insertionMode;
private GuiImgButton sidelessMode;
@@ -58,7 +59,6 @@ public class GuiDualInterface extends GuiUpgradeable {
}
@Override
@SuppressWarnings("unchecked")
protected void addButtons() {
this.priority = new GuiTabButton(
this.guiLeft + 154,
@@ -82,6 +82,9 @@ public class GuiDualInterface extends GuiUpgradeable {
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(
@@ -156,7 +159,9 @@ 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);
}
@@ -213,6 +218,8 @@ public class GuiDualInterface extends GuiUpgradeable {
NetworkHandler.instance.sendToServer(new PacketConfigButton(Settings.INTERFACE_TERMINAL, backwards));
} else if (btn == this.BlockMode) {
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.BlockMode.getSetting(), backwards));
} else if (btn == this.SmartBlockMode) {
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.SmartBlockMode.getSetting(), backwards));
} else if (btn == this.insertionMode) {
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.insertionMode.getSetting(), backwards));
} else if (btn == this.doublePatterns) {
@@ -236,10 +243,6 @@ public class GuiDualInterface extends GuiUpgradeable {
}
}
private boolean isPart() {
return this.host instanceof PartFluidInterface;
}
private boolean isTile() {
return this.host instanceof TileFluidInterface;
}
@@ -3,6 +3,8 @@ package com.glodblock.github.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import org.lwjgl.input.Mouse;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.base.FCGuiAmount;
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
@@ -17,12 +19,18 @@ 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));
}
@@ -30,6 +38,14 @@ public class GuiFluidCraftAmount extends FCGuiAmount {
@Override
public void initGui() {
super.initGui();
this.buttonList.add(
this.craftingMode = new GuiImgButton(
this.guiLeft + 10,
this.guiTop + 53,
Settings.CRAFTING_MODE,
CraftingMode.STANDARD));
this.amountBox.setText("1");
this.amountBox.setSelectionPos(0);
}
@@ -55,8 +71,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");
@@ -55,7 +55,6 @@ public class GuiFluidCraftingWireless extends GuiItemMonitor {
}
@Override
@SuppressWarnings("unchecked")
public void initGui() {
super.initGui();
this.buttonList.add(
@@ -66,7 +66,6 @@ public class GuiFluidInterface extends AEBaseGui {
}
@Override
@SuppressWarnings("unchecked")
public void initGui() {
super.initGui();
this.switcher = new GuiTabButton(
@@ -3,6 +3,9 @@ package com.glodblock.github.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
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;
@@ -14,15 +17,17 @@ import appeng.api.config.Settings;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.gui.implementations.GuiUpgradeable;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiNumberBox;
import appeng.client.gui.widgets.MEGuiTextField;
import appeng.core.AEConfig;
import appeng.core.AELog;
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 MEGuiTextField amountTextField;
private GuiButton plus1;
private GuiButton plus10;
private GuiButton plus100;
@@ -31,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) {
@@ -41,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
@@ -68,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);
}
@@ -89,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;
@@ -111,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
@@ -124,75 +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) {
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);
}
}
}
}
@@ -6,10 +6,12 @@ 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;
@@ -24,6 +26,7 @@ import appeng.container.slot.OptionalSlotFake;
import appeng.container.slot.SlotFakeCraftingMatrix;
import appeng.container.slot.SlotPatternTerm;
import appeng.core.localization.GuiText;
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) {
@@ -11,6 +11,7 @@ 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;
@@ -21,6 +22,7 @@ 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 {
@@ -37,7 +39,6 @@ public class GuiFluidPatternTerminalEx extends FCGuiEncodeTerminal {
}
@Override
@SuppressWarnings("unchecked")
public void initGui() {
super.initGui();
@@ -179,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();
@@ -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);
File diff suppressed because it is too large. Load diff
@@ -2,11 +2,10 @@ package com.glodblock.github.client.gui;
import static com.glodblock.github.client.gui.container.ContainerLevelMaintainer.createLevelValues;
import java.awt.Rectangle;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Pattern;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
@@ -16,8 +15,10 @@ 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;
@@ -41,7 +42,6 @@ import com.glodblock.github.network.CPacketLevelTerminalCommands;
import com.glodblock.github.util.FCGuiColors;
import com.glodblock.github.util.NameConst;
import com.glodblock.github.util.Util;
import com.gtnewhorizon.gtnhlib.util.parsing.MathExpressionParser;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.DimensionalCoord;
@@ -54,11 +54,12 @@ import appeng.core.AELog;
import appeng.core.features.AEFeature;
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 cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional;
@Optional.Interface(modid = "NotEnoughItems", iface = "codechicken.nei.api.INEIGuiHandler")
@@ -68,7 +69,7 @@ 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 FCGuiTextField input;
private Widget focusedWidget;
private int lastWorkingTick;
private int refreshTick;
private final CoFHFontRenderer render;
@@ -78,10 +79,6 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
protected Util.DimensionalCoordSide originalBlockPos;
protected GuiTabButton originalGuiBtn;
protected static final boolean isGTNHLibLoaded = Loader.isModLoaded("gtnhlib");
protected static final Pattern numberPattern = isGTNHLibLoaded ? MathExpressionParser.EXPRESSION_PATTERN
: Pattern.compile("^[0-9]+");
public GuiLevelMaintainer(InventoryPlayer ipl, TileLevelMaintainer tile) {
super(new ContainerLevelMaintainer(ipl, tile));
this.cont = (ContainerLevelMaintainer) inventorySlots;
@@ -153,12 +150,13 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
State state = State.values()[data.getInteger(TLMTags.State.tagName)];
component[idx].getQty().textField.setText(String.valueOf(quantity));
component[idx].getBatch().textField.setText(String.valueOf(batch));
component[idx].getQty().validate();
component[idx].getBatch().validate();
component[idx].setEnable(isEnable);
component[idx].setState(state);
}
}
@SuppressWarnings("unchecked")
public void initGui() {
super.initGui();
this.lastWorkingTick = this.refreshTick;
@@ -209,7 +207,7 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
int tick = this.refreshTick;
int interval = 20;
if (tick > lastWorkingTick + interval && this.input == null) {
if (tick > lastWorkingTick + interval && this.focusedWidget == null) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.Refresh));
lastWorkingTick = this.refreshTick;
}
@@ -235,11 +233,11 @@ 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);
}
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(
@@ -257,42 +255,41 @@ 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 (!numberPattern.matcher(this.input.getText()).matches()) {
this.input.setTextColor(0xFF0000);
} else {
this.input.setTextColor(0xFFFFFF);
}
this.focusedWidget.validate();
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
this.input.setFocused(false);
this.input = null;
this.component[this.focusedWidget.componentIndex].submit();
this.focusedWidget.textField.setFocused(false);
this.focusedWidget = null;
}
}
}
@@ -354,18 +351,21 @@ 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
public boolean handleDragNDrop(GuiContainer gui, int mouseX, int mouseY, ItemStack draggedStack, int button) {
if (draggedStack != null) {
draggedStack.stackSize = 0;
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 (getSlotArea(slot).contains(mouseX, mouseY) && draggedStack != null) {
if (slotAtPosition.equals(slot)) {
ItemStack itemStack = createLevelValues(draggedStack.copy());
itemStack.getTagCompound().setInteger(TLMTags.Index.tagName, i);
slot.putStack(itemStack);
@@ -393,9 +393,8 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
private final FCGuiLineField line;
private State state;
@SuppressWarnings("unchecked")
public Component(Widget qtyInput, Widget batchInput, GuiFCImgButton submitBtn, GuiFCImgButton enableBtn,
GuiFCImgButton disableBtn, FCGuiLineField line, List buttonList) {
GuiFCImgButton disableBtn, FCGuiLineField line, List<GuiButton> buttonList) {
this.qty = qtyInput;
this.batch = batchInput;
this.enable = enableBtn;
@@ -409,39 +408,38 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
}
public int getIndex() {
return this.qty.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 (isGTNHLibLoaded) {
long value = (long) MathExpressionParser.parse(widget.textField.getText());
widget.textField.setText(String.valueOf(value));
}
if (!widget.textField.getText().isEmpty()
&& numberPattern.matcher(widget.textField.getText()).matches()) {
String str = widget.textField.getText().replaceAll("^(0+)", "");
widget.textField.setText(str.isEmpty() ? "0" : str);
FluidCraft.proxy.netHandler.sendToServer(
new CPacketLevelMaintainer(widget.action, widget.idx, widget.textField.getText()));
widget.textField.setTextColor(0xFFFFFF);
return true;
} else {
widget.textField.setTextColor(0xFF0000);
return false;
}
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);
}
if (batch.getAmount() != null) {
this.send(batch);
}
didSomething = true;
} else if (this.enable == btn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.Enable, this.getIndex()));
@@ -453,9 +451,9 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
return didSomething;
}
public FCGuiTextField isMouseIn(final int xCoord, final int yCoord) {
if (this.qty.textField.isMouseIn(xCoord, yCoord)) return this.getQty().textField;
if (this.batch.textField.isMouseIn(xCoord, yCoord)) return this.getBatch().textField;
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;
}
@@ -540,28 +538,41 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
private class Widget {
public final int idx;
public final int componentIndex;
public final Action action;
private final FCGuiTextField textField;
public final FCGuiTextField textField;
private final String tooltip;
private Long amount;
public Widget(FCGuiTextField textField, String tooltip, int idx, Action 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(16); // this length is enough to be useful
this.idx = idx;
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)));
}
@@ -571,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)) {
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;
}
}
}
@@ -12,6 +12,7 @@ import static com.glodblock.github.network.SPacketLevelTerminalUpdate.PacketRena
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
@@ -27,6 +28,7 @@ import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
@@ -34,7 +36,6 @@ import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
@@ -65,7 +66,6 @@ import appeng.api.config.TerminalStyle;
import appeng.api.config.YesNo;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.WorldCoord;
import appeng.client.gui.IGuiTooltipHandler;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiScrollbar;
@@ -96,6 +96,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
public static final int VIEW_WIDTH = 174;
public static final int VIEW_LEFT = 8;
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/level_terminal.png");
private static final RenderItem renderItem = new RenderItem();
protected int offsetY;
private static final int offsetX = 21;
protected static String searchFieldOutputsText = "";
@@ -120,7 +121,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
private final LevelTerminalList masterList = new LevelTerminalList();
private final List<String> extraOptionsText = new ArrayList<>(2);
private static final float ITEM_STACK_Z = 100.0f;
private static final float SLOT_Z = 0.5f;
private static final float ITEM_STACK_OVERLAY_Z = 200.0f;
private static final float SLOT_HOVER_Z = 310.0f;
private static final float TOOLTIP_Z = 410.0f;
@@ -176,7 +176,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
}
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
super.initGui();
@@ -283,7 +282,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
}
}
@SuppressWarnings("unchecked")
@Override
public void drawScreen(final int mouseX, final int mouseY, final float btn) {
terminalStyleBox.set(AEConfig.instance.settings.getSetting(Settings.TERMINAL_STYLE));
@@ -349,8 +347,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
if (btn == terminalStyleBox) {
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
reinitialize();
super.scheduleGuiResize();
}
iBtn.set(next);
@@ -359,11 +356,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
super.actionPerformed(btn);
}
private void reinitialize() {
buttonList.clear();
initGui();
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
mc.getTextureManager().bindTexture(TEX_BG);
@@ -392,7 +384,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
GL11.glPushMatrix();
GL11.glTranslatef(offsetX + VIEW_LEFT, offsetY + HEADER_HEIGHT, 0);
tooltipStack = null;
masterList.hoveredEntry = null;
drawViewport(mouseX - offsetX - VIEW_LEFT, mouseY - offsetY - HEADER_HEIGHT - 1);
GL11.glPopMatrix();
GL11.glPopAttrib();
@@ -513,7 +504,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
Tessellator.instance.startDrawingQuads();
int relY = 0;
final int slotLeftMargin = (VIEW_WIDTH - entry.rowSize * 18);
float lastZLevel = aeRenderItem.zLevel;
float lastZLevel = renderItem.zLevel;
entry.dispY = viewY;
/* PASS 1: BG */
@@ -595,17 +586,15 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
long quantity = data.getLong(TLMTags.Quantity.tagName);
long batch = data.getLong(TLMTags.Batch.tagName);
State state = State.values()[data.getInteger(TLMTags.State.tagName)];
NBTTagCompound linkTag = data.getCompoundTag(TLMTags.Link.tagName);
GL11.glPushMatrix();
GL11.glTranslatef(colLeft, viewY + rowYTop + 1, ITEM_STACK_Z);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
itemStack.stackSize = 0;
aeRenderItem.setAeStack(null);
aeRenderItem.zLevel = ITEM_STACK_Z - MAGIC_RENDER_ITEM_Z;
aeRenderItem.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), itemStack, 0, 0);
aeRenderItem.renderItemOverlayIntoGUI(fontRendererObj, mc.getTextureManager(), itemStack, 0, 0);
renderItem.zLevel = ITEM_STACK_Z - MAGIC_RENDER_ITEM_Z;
renderItem.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), itemStack, 0, 0);
renderItem.renderItemOverlayIntoGUI(fontRendererObj, mc.getTextureManager(), itemStack, 0, 0);
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z - ITEM_STACK_Z);
int color = switch (state) {
case Idle -> FCGuiColors.StateIdle.getColor();
@@ -648,14 +637,12 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
GL11.glTranslatef(0.0f, 0.0f, SLOT_HOVER_Z);
drawRect(colLeft, viewY + 1 + rowYTop, -2 + colRight, viewY - 1 + rowYBot, 0x77FFFFFF);
GL11.glTranslatef(0.0f, 0.0f, -SLOT_HOVER_Z);
masterList.hoveredEntry = entry;
entry.hoveredSlotIdx = slotIdx;
}
GL11.glDisable(GL11.GL_LIGHTING);
}
}
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
aeRenderItem.zLevel = lastZLevel;
renderItem.zLevel = lastZLevel;
return relY + 1;
}
@@ -706,9 +693,8 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
}
}
@SuppressWarnings("unchecked")
@Override
public void drawHoveringText(List textLines, int x, int y, FontRenderer font) {
public void drawHoveringText(List<String> textLines, int x, int y, FontRenderer font) {
if (!textLines.isEmpty()) {
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.disableStandardItemLighting();
@@ -894,10 +880,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
return;
}
if (owCmd.onlineValid) {
entry.online = owCmd.online;
}
if (owCmd.itemsValid) {
if (owCmd.allItemUpdate) {
entry.fullItemUpdate(owCmd.items, owCmd.validIndices.length);
@@ -988,7 +970,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
private final List<LevelTerminalSection> visibleSections = new ArrayList<>();
private boolean isDirty;
private int height;
private LevelTerminalEntry hoveredEntry;
LevelTerminalList() {
isDirty = true;
@@ -1230,8 +1211,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
GuiFCImgButton highlightButton;
GuiFCImgButton renameButton;
GuiFCImgButton configButton;
/** Nullable - icon that represents the interface */
ItemStack selfItemStack;
/** Nullable - icon that represents the interface's "target" */
ItemStack displayItemStack;
LevelTerminalSection section;
@@ -1240,16 +1219,13 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
int rows, rowSize;
int guiHeight;
int dispY = -9999;
boolean online;
boolean[] filteredRecipes;
int numItems = 0;
private int hoveredSlotIdx = -1;
LevelTerminalEntry(long id, String name, int rows, int rowSize, boolean online) {
this.id = id;
this.rows = rows;
this.rowSize = rowSize;
this.online = online;
if (StatCollector.canTranslate(name)) {
customName = StatCollector.translateToLocal(name);
} else {
@@ -1279,7 +1255,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
}
LevelTerminalEntry setIcons(ItemStack selfItemStack, ItemStack displayItemStack) {
this.selfItemStack = selfItemStack;
this.displayItemStack = displayItemStack;
return this;
@@ -1327,8 +1302,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
}
public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) {
final EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (!section.visible || mouseButton < 0 || mouseButton > 2) {
return false;
}
@@ -1343,7 +1316,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
dim,
ForgeDirection.getOrientation(side),
"");
if (isCtrlKeyDown() && isShiftKeyDown() && hasInfinityBoosterCard(player)) {
if (isCtrlKeyDown() && isShiftKeyDown() && hasInfinityBoosterCard(mc.thePlayer)) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketLevelTerminalCommands(
Action.EDIT,
@@ -1361,23 +1334,12 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
blockPos.getDimension(),
blockPos.getSide()));
} else {
/* View in world */
WorldCoord blockPos2 = new WorldCoord((int) player.posX, (int) player.posY, (int) player.posZ);
if (mc.theWorld.provider.dimensionId != dim) {
player.addChatMessage(
new ChatComponentTranslation(PlayerMessages.InterfaceInOtherDim.getName(), dim));
} else {
BlockPosHighlighter.highlightBlock(
blockPos,
System.currentTimeMillis() + 500 * WorldCoord.getTaxicabDistance(blockPos, blockPos2));
player.addChatMessage(
new ChatComponentTranslation(
PlayerMessages.InterfaceHighlighted.getName(),
blockPos.x,
blockPos.y,
blockPos.z));
}
player.closeScreen();
BlockPosHighlighter.highlightBlocks(
mc.thePlayer,
Collections.singletonList(blockPos),
PlayerMessages.LevelEmitterHighlighted.getName(),
PlayerMessages.LevelEmitterInAnotherDim.getName());
mc.thePlayer.closeScreen();
}
return true;
}
@@ -1393,25 +1355,17 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
// send packet to server, request an update
InventoryAction action = switch (mouseButton) {
case 0 -> {
// pickup / set-down.
yield null;
}
case 1 -> {
yield null;
}
case 0 -> null; // pickup / set-down.
case 1 -> null;
case 2 -> {
// creative dupe:
if (player.capabilities.isCreativeMode) {
if (mc.thePlayer.capabilities.isCreativeMode) {
yield InventoryAction.CREATIVE_DUPLICATE;
} else {
yield InventoryAction.AUTO_CRAFT;
}
}
default -> {
// drop item:
yield null;
}
default -> null;// drop item:
};
if (action != null) {
@@ -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,154 @@
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 long addOrderAmount(final int i) {
return i + getAmount();
}
@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;
}
}
}
@@ -46,7 +46,6 @@ public class GuiRenamer extends AEBaseGui implements IDropToFillTextField {
this.textField.setMaxStringLength(32);
}
@SuppressWarnings("unchecked")
@Override
public void initGui() {
super.initGui();
@@ -13,7 +13,6 @@ import com.glodblock.github.client.gui.GuiFluidCraftingWireless;
import com.glodblock.github.client.gui.GuiFluidPatternExWireless;
import com.glodblock.github.client.gui.GuiFluidPatternWireless;
import com.glodblock.github.client.gui.GuiFluidPortableCell;
import com.glodblock.github.client.gui.GuiInterfaceWireless;
import com.glodblock.github.client.gui.GuiLevelWireless;
import com.glodblock.github.client.gui.container.base.FCBaseContainer;
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
@@ -61,7 +60,6 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
public abstract void setOffsetY(int y);
@SuppressWarnings("unchecked")
protected void drawSwitchGuiBtns() {
if (!drawSwitchGuiBtn) return;
if (!termBtns.isEmpty()) {
@@ -103,16 +101,14 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
this.setOffsetY(this.getOffsetY() + 20);
termBtns.add(this.FluidTerminal);
}
if (!(this instanceof GuiInterfaceWireless)) {
this.buttonList.add(
this.InterfaceTerminal = new GuiFCImgButton(
this.guiLeft - 18,
this.getOffsetY(),
"INTERFACE_TEM",
"YES"));
this.setOffsetY(this.getOffsetY() + 20);
termBtns.add(this.InterfaceTerminal);
}
this.buttonList.add(
this.InterfaceTerminal = new GuiFCImgButton(
this.guiLeft - 18,
this.getOffsetY(),
"INTERFACE_TEM",
"YES"));
this.setOffsetY(this.getOffsetY() + 20);
termBtns.add(this.InterfaceTerminal);
if (!(this instanceof GuiLevelWireless)) {
this.buttonList.add(
this.LevelTerminal = new GuiFCImgButton(this.guiLeft - 18, this.getOffsetY(), "LEVEL_TEM", "YES"));
@@ -131,12 +127,33 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
}
}
@SuppressWarnings("unchecked")
protected void addSwitchGuiBtns() {
if (!drawSwitchGuiBtn) return;
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
protected void actionPerformed(final GuiButton btn) {
if (btn instanceof GuiFCImgButton) {
@@ -39,7 +39,6 @@ public abstract class FCGuiAmount extends AEBaseGui {
}
@Override
@SuppressWarnings("unchecked")
public void initGui() {
super.initGui();
@@ -5,6 +5,7 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import com.glodblock.github.FluidCraft;
@@ -116,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"));
@@ -70,6 +70,7 @@ import appeng.util.item.AEItemStack;
import codechicken.nei.LayoutManager;
import codechicken.nei.util.TextHistory;
// 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 {
@@ -102,7 +103,6 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
protected GuiImgButton searchStringSave;
protected GuiImgButton typeFilter;
protected boolean hasShiftKeyDown = false;
private boolean reInitializationRequested = false;
@SuppressWarnings("unchecked")
public FCGuiMonitor(final InventoryPlayer inventoryPlayer, final ITerminalHost te, final FCContainerMonitor<T> c) {
@@ -161,19 +161,15 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
}
iBtn.set(next);
if (next.getClass() == SearchBoxMode.class || next.getClass() == TerminalStyle.class) {
this.reInitalize();
memoryText = this.searchField.getText();
super.scheduleGuiResize();
}
}
}
super.actionPerformed(btn);
}
protected void reInitalize() {
reInitializationRequested = true;
}
@Override
@SuppressWarnings("unchecked")
public void initGui() {
Keyboard.enableRepeatEvents(true);
@@ -217,6 +213,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
}
super.initGui();
this.setScrollBar();
// full size : 204
// extra slots : 72
// slot 18
@@ -419,6 +416,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++) {
@@ -590,6 +590,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);
@@ -667,11 +679,6 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
@Override
public void updateScreen() {
if (reInitializationRequested) {
reInitializationRequested = false;
this.buttonList.clear();
this.initGui();
}
this.repo.setPowered(this.monitorableContainer.isPowered());
super.updateScreen();
}
@@ -692,12 +699,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));
}
@@ -778,14 +786,4 @@ 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 handleKeyboardInput() {
super.handleKeyboardInput();
hasShiftKeyDown |= isShiftKeyDown();
if (hasShiftKeyDown && !Keyboard.getEventKeyState()) { // keyup
this.repo.updateView();
hasShiftKeyDown = false;
}
}
}
@@ -6,6 +6,7 @@ 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;
@@ -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);
@@ -1,6 +1,5 @@
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;
@@ -14,6 +13,7 @@ import appeng.api.config.RedstoneMode;
import appeng.api.config.SecurityPermissions;
import appeng.api.config.Settings;
import appeng.api.implementations.IUpgradeableHost;
import appeng.client.gui.widgets.MEGuiTextField;
import appeng.container.guisync.GuiSync;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.util.Platform;
@@ -25,7 +25,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;
@@ -50,15 +50,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) {
@@ -99,6 +96,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();
}
}
}
}
@@ -314,8 +314,15 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
}
// Step 4: calculate outputs
final int emptiedTanks = (int) (totalInserted / fluidPerContainer);
final int partialDrain = (int) (totalInserted % fluidPerContainer);
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;
@@ -325,10 +332,15 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
if (targetStack.getItem() instanceof IFluidContainerItem fcItem) {
if (emptiedTanks > 0) {
emptiedTanksStack = targetStack.copy();
emptiedTanksStack.stackSize = 1;
fcItem.drain(emptiedTanksStack, fluidPerContainer, true);
emptiedTanksStack.stackSize = emptiedTanks;
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;
}
@@ -383,8 +395,7 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
} else if (partialTanksStack != null) {
player.inventory.setInventorySlotContents(slotIndex, partialTanksStack);
} else {
player.inventory.setItemStack(null);
shouldSendStack = false;
player.inventory.setInventorySlotContents(slotIndex, null);
}
}
if (shouldSendStack) {
@@ -165,6 +165,7 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPa
.putConvertedStack(Objects.requireNonNull(Util.copyStackWithSize(stack, 1)));
}
}
default -> {}
}
} else {
super.doAction(player, action, slotId, id);
@@ -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);
}
}
}
@@ -23,6 +23,7 @@ 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;
@@ -156,7 +157,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();
}
@@ -19,7 +19,7 @@ public class ContainerInterfaceWireless extends FCBaseContainer {
delegateContainer = new ContainerInterfaceTerminal(ip, monitorable);
this.bindPlayerInventory(ip, 14, 0);
this.bindPlayerInventory(ip, 14, 3);
}
@Override
@@ -93,6 +93,7 @@ public class ContainerLevelMaintainer extends AEBaseContainer {
createLevelValues(Objects.requireNonNull(Util.copyStackWithSize(stack, 1))));
}
}
default -> {}
}
} else {
super.doAction(player, action, slotId, id);
@@ -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());
}
}
@@ -53,6 +53,8 @@ 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;
@@ -155,6 +157,7 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
slot.putStack(ItemFluidPacket.newStack(fluid));
return;
}
default -> {}
}
}
@@ -268,6 +271,7 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
pattern.setInputs(collectInventory(this.craftingSlots));
pattern.setOutputs(collectInventory(this.outputSlots));
pattern.setCanBeSubstitute(this.beSubstitute ? 1 : 0);
pattern.setCombine(this.combine ? 1 : 0);
patternSlotOUT.putStack(stampAuthor(pattern.writeToStack()));
}
@@ -537,52 +541,89 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
return false;
}
static boolean canDouble(SlotFake[] slots, int mult) {
for (Slot s : slots) {
ItemStack st = s.getStack();
if (st != null) {
if (st.getItem() instanceof ItemFluidPacket) {
long result = (long) ItemFluidPacket.getFluidAmount(st) * mult;
if (result > Integer.MAX_VALUE) {
return false;
}
} else {
long result = (long) s.getStack().stackSize * mult;
if (result > Integer.MAX_VALUE) {
return false;
}
}
}
}
return true;
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 void doubleStacksInternal(SlotFake[] slots, int mult) {
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());
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;
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);
}
}
}
}
}
public void doubleStacks(boolean isShift) {
/**
* Multiply or divide a number
*
* @param multi Positive numbers are multiplied and negative numbers are divided
*/
public void multiplyOrDivideStacks(int multi) {
if (!isCraftingMode()) {
if (isShift) {
if (canDouble(this.craftingSlots, 8) && canDouble(this.outputSlots, 8)) {
doubleStacksInternal(this.craftingSlots, 8);
doubleStacksInternal(this.outputSlots, 8);
}
} else {
if (canDouble(this.craftingSlots, 2) && canDouble(this.outputSlots, 2)) {
doubleStacksInternal(this.craftingSlots, 2);
doubleStacksInternal(this.outputSlots, 2);
}
if (canMultiplyOrDivide(this.craftingSlots, multi) && canMultiplyOrDivide(this.outputSlots, multi)) {
multiplyOrDivideStacksInternal(this.craftingSlots, multi);
multiplyOrDivideStacksInternal(this.outputSlots, multi);
}
this.detectAndSendChanges();
}
@@ -224,7 +224,8 @@ public abstract class FCContainerMonitor<T extends IAEStack<T>> extends FCBaseCo
}
@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);
}
@@ -1,11 +1,11 @@
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.Fluid;
import net.minecraftforge.fluids.FluidStack;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.crossmod.thaumcraft.AspectUtil;
@@ -15,7 +15,6 @@ 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.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.widgets.IScrollSource;
import appeng.client.gui.widgets.ISortSource;
@@ -27,14 +26,64 @@ public class EssentiaRepo extends FluidRepo {
super(src, sortSrc);
}
@SuppressWarnings("deprecation")
@Override
public void updateView() {
if (needUpdateView()) 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 (!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);
}
}
// Update the display
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) {
@@ -58,7 +107,11 @@ public class EssentiaRepo extends FluidRepo {
}
}
for (IAEItemStack is : needUpdateView() ? this.list : this.cache) {
for (IAEItemStack is : entries) {
if (!AspectUtil.isEssentiaGas(ItemFluidDrop.getAeFluidStack(is))) {
continue;
}
if (this.myPartitionList != null) {
if (!this.myPartitionList.isListed(is)) {
continue;
@@ -87,44 +140,6 @@ public class EssentiaRepo extends FluidRepo {
this.view.add(is);
}
}
if (needUpdateView()) {
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);
}
} else {
this.cache.clear();
}
for (final IAEItemStack is : this.view) {
this.dsp.add(is.getItemStack());
}
this.lastSearchString = this.searchString;
Iterator<IAEItemStack> it1 = this.view.iterator();
while (it1.hasNext()) {
IAEFluidStack fluid = ItemFluidDrop.getAeFluidStack(it1.next());
if (!AspectUtil.isEssentiaGas(fluid)) {
it1.remove();
}
}
Iterator<ItemStack> it2 = this.dsp.iterator();
while (it2.hasNext()) {
FluidStack fluid = ItemFluidDrop.getFluidStack(it2.next());
if (!AspectUtil.isEssentiaGas(fluid)) {
it2.remove();
}
}
}
}
@@ -10,11 +10,11 @@
package com.glodblock.github.client.me;
import static net.minecraft.client.gui.GuiScreen.isShiftKeyDown;
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;
@@ -47,15 +47,14 @@ public class FluidRepo implements IDisplayRepo {
protected final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
protected final ArrayList<IAEItemStack> view = new ArrayList<>();
protected final ArrayList<ItemStack> dsp = new ArrayList<>();
protected final ArrayList<IAEItemStack> cache = new ArrayList<>();
protected final IScrollSource src;
protected final ISortSource sortSrc;
protected int rowSize = 9;
protected String searchString = "";
protected String lastSearchString = "";
protected IPartitionList<IAEItemStack> myPartitionList;
protected boolean paused = false;
private String NEIWord = null;
private boolean hasPower;
@@ -90,33 +89,74 @@ public class FluidRepo implements IDisplayRepo {
if (st != null) {
st.reset();
st.add(is);
if (isShiftKeyDown() && this.view.contains(st)) {
this.view.get(this.view.indexOf(st)).setStackSize(st.getStackSize());
}
} else {
if (isShiftKeyDown()) this.cache.add(is);
this.list.add(is);
}
}
protected boolean needUpdateView() {
return !isShiftKeyDown() || !this.lastSearchString.equals(this.searchString);
}
@Override
public void setViewCell(final ItemStack[] list) {
this.myPartitionList = ItemViewCell.createFilter(list);
this.updateView();
}
@SuppressWarnings("deprecation")
@Override
public void updateView() {
if (needUpdateView()) 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) {
@@ -142,7 +182,7 @@ public class FluidRepo implements IDisplayRepo {
}
}
for (IAEItemStack is : needUpdateView() ? this.list : this.cache) {
for (IAEItemStack is : entries) {
if (this.myPartitionList != null) {
if (!this.myPartitionList.isListed(is)) {
continue;
@@ -179,30 +219,6 @@ public class FluidRepo implements IDisplayRepo {
}
}
}
if (needUpdateView()) {
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);
}
} else {
this.cache.clear();
}
for (final IAEItemStack is : this.view) {
this.dsp.add(is.getItemStack());
}
this.lastSearchString = this.searchString;
}
protected void updateNEI(final String filter) {
@@ -260,4 +276,21 @@ public class FluidRepo implements IDisplayRepo {
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();
}
}
}
}
@@ -10,6 +10,7 @@ import net.minecraftforge.client.model.IModelCustom;
import org.lwjgl.opengl.GL11;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.tile.TileWalrus;
public class RenderBlockWalrus extends TileEntitySpecialRenderer {
@@ -19,16 +20,28 @@ public class RenderBlockWalrus extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTickTime) {
Minecraft.getMinecraft().renderEngine.bindTexture(this.textureWalrus);
if (!(tileentity instanceof TileWalrus Tile)) return;
float scale = Tile.getWalrusScale();
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y, z + 0.5);
int orientation = tileentity.getBlockMetadata();
if (orientation == 4) {
GL11.glRotatef(90, 0, 1, 0);
} else if (orientation == 5) {
GL11.glRotatef(-90, 0, 1, 0);
} else if (orientation == 3) {
GL11.glRotatef(180, 0, 1, 0);
int orientation = Tile.getBlockMetadata();
switch (orientation) {
case 2:
GL11.glTranslated(x + 0.5, y, z + 1 - scale * .655); // centering walrus model
break;
case 3:
GL11.glTranslated(x + 0.5, y, z + scale * .655);
GL11.glRotatef(180, 0, 1, 0);
break;
case 4:
GL11.glTranslated(x + 1 - scale * .655, y, z + 0.5);
GL11.glRotatef(90, 0, 1, 0);
break;
case 5:
GL11.glTranslated(x + scale * .655, y, z + 0.5);
GL11.glRotatef(-90, 0, 1, 0);
break;
}
GL11.glScalef(scale, scale, scale);
this.modelWalrus.renderAll();
GL11.glPopMatrix();
}
@@ -48,7 +48,7 @@ public class BlockFluidBuffer extends FCBaseBlock {
if (fs == null && ias != null) {
player.addChatMessage(
new ChatComponentText(
Tooltip.fluidFormat(ias.getFluid().getLocalizedName(), ias.getStackSize())));
Tooltip.fluidFormat(ias.getFluidStack().getLocalizedName(), ias.getStackSize())));
return false;
} else {
tile.setFluid(fs);
@@ -52,20 +52,20 @@ public class BlockWalrus extends BaseBlockContainer {
int l = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
if (l == 0) {
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
}
if (l == 1) {
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
}
if (l == 2) {
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
}
if (l == 3) {
if (l == 1) {
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
}
if (l == 2) {
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
}
if (l == 3) {
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
}
}
@Override
@@ -75,12 +75,28 @@ public class BlockWalrus extends BaseBlockContainer {
@Override
public void setBlockBoundsBasedOnState(IBlockAccess blockAccess, int x, int y, int z) {
switch (ForgeDirection.getOrientation(blockAccess.getBlockMetadata(x, y, z))) {
case NORTH -> setBlockBounds(0.0F, 0.0F, -1.0F, 1.0F, 1.0F, 1.0F);
case EAST -> setBlockBounds(0.0F, 0.0F, 0.0F, 2.0F, 1.0F, 1.0F);
case SOUTH -> setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 2.0F);
case WEST -> setBlockBounds(-1.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
default -> setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
TileEntity tileentity = blockAccess.getTileEntity(x, y, z);
if (tileentity instanceof TileWalrus Tile) {
float scale = Tile.getWalrusScale();
switch (ForgeDirection.getOrientation(blockAccess.getBlockMetadata(x, y, z))) {
case NORTH -> setBlockBounds(
-(scale / 2 - 0.5F),
0.0F,
-scale * 2F + 1.0F,
(scale / 2 + 0.5f),
scale,
1.0F);
case EAST -> setBlockBounds(0.0F, 0.0F, -(scale / 2 - 0.5F), 2.0F * scale, scale, (scale / 2 + 0.5f));
case SOUTH -> setBlockBounds(-(scale / 2 - 0.5F), 0.F, 0.F, (scale / 2 + 0.5f), scale, 2.0F * scale);
case WEST -> setBlockBounds(
-scale * 2F + 1.0F,
0.0F,
-(scale / 2 - 0.5F),
1.0F,
scale,
(scale / 2 + 0.5f));
default -> setBlockBounds(0.0F, 0.0F, 0.0F, scale, scale, scale);
}
}
}
@@ -102,4 +118,17 @@ public class BlockWalrus extends BaseBlockContainer {
toolTip.add(NameConst.i18n(NameConst.TT_SHIFT_FOR_MORE));
}
}
@Override
public boolean onBlockActivated(World worldObj, int x, int y, int z, EntityPlayer entityplayer, int blockID,
float offsetX, float offsetY, float offsetZ) {
TileEntity tileentity = worldObj.getTileEntity(x, y, z);
if (!(tileentity instanceof TileWalrus Tile)) return false;
if (entityplayer.isSneaking()) {
Tile.setWalrusScale(Tile.getWalrusScale() / 2);
} else {
Tile.setWalrusScale(Tile.getWalrusScale() * 2);
}
return true;
}
}
@@ -23,8 +23,7 @@ public class BaseItemBlockContainer extends ItemBlock {
@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings("unchecked")
public void addInformation(final ItemStack itemStack, final EntityPlayer player, final List toolTip,
public void addInformation(final ItemStack itemStack, final EntityPlayer player, final List<String> toolTip,
final boolean advancedToolTips) {
blockType.addInformation(itemStack, player, toolTip, advancedToolTips);
}
@@ -1,6 +1,7 @@
package com.glodblock.github.common.item;
import java.text.NumberFormat;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.List;
@@ -16,8 +17,8 @@ import net.minecraftforge.common.util.ForgeDirection;
import com.glodblock.github.api.FluidCraftAPI;
import com.glodblock.github.common.storage.CellType;
import com.glodblock.github.common.storage.FluidCellInventory;
import com.glodblock.github.common.storage.FluidCellInventoryHandler;
import com.glodblock.github.common.storage.IFluidCellInventory;
import com.glodblock.github.common.storage.IStorageFluidCell;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.NameConst;
@@ -33,14 +34,16 @@ import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IItemList;
import appeng.core.features.AEFeature;
import appeng.core.localization.GuiText;
import appeng.helpers.ICellRestriction;
import appeng.items.AEBaseItem;
import appeng.items.contents.CellConfig;
import appeng.items.contents.CellUpgrades;
import appeng.util.InventoryAdaptor;
import appeng.util.IterationCounter;
import appeng.util.Platform;
import appeng.util.ReadableNumberConverter;
public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluidCell {
public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluidCell, ICellRestriction {
protected CellType component;
protected long totalBytes;
@@ -61,7 +64,6 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
this.component = null;
}
@SuppressWarnings("all")
public FCBaseItemCell(final Optional<String> subName) {
super(subName);
}
@@ -92,12 +94,12 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
@Override
public void addCheckedInformation(final ItemStack stack, final EntityPlayer player, final List<String> lines,
final boolean displayMoreInfo) {
final boolean displayMoreInfo) {
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell()
.getCellInventory(stack, null, StorageChannel.FLUIDS);
.getCellInventory(stack, null, StorageChannel.FLUIDS);
if (inventory instanceof final FluidCellInventoryHandler handler) {
final IFluidCellInventory cellInventory = handler.getCellInv();
final FluidCellInventory cellInventory = (FluidCellInventory) handler.getCellInv();
if (cellInventory != null) {
lines.add(
@@ -118,7 +120,7 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
+ GuiText.Of.getLocal()
+ " "
+ EnumChatFormatting.DARK_GREEN
+ cellInventory.getTotalFluidTypes()
+ cellInventory.getMaxFluidTypes()
+ " "
+ EnumChatFormatting.GRAY
+ GuiText.Types.getLocal());
@@ -144,7 +146,7 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
if (handler.isPreformatted()) {
final String list = (handler.getIncludeExcludeMode() == IncludeExclude.WHITELIST ? GuiText.Included
: GuiText.Excluded).getLocal();
: GuiText.Excluded).getLocal();
lines.add(GuiText.Partitioned.getLocal() + " - " + list + ' ' + GuiText.Precise.getLocal());
if (GuiScreen.isShiftKeyDown()) {
@@ -159,6 +161,17 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
lines.add(GuiText.Sticky.getLocal());
}
}
List<Object> restricted = handler.getRestricted();
if (restricted != null && ((long) restricted.get(0) != 0 || (byte) restricted.get(1) != 0)) {
lines.add(GuiText.Restricted.getLocal());
if (GuiScreen.isShiftKeyDown()) {
NumberFormat nf = NumberFormat.getNumberInstance();
if ((long) restricted.get(0) != 0)
lines.add(GuiText.MaxFluid.getLocal() + " " + nf.format((long) restricted.get(0)) + " mB");
if ((byte) restricted.get(1) != 0)
lines.add(GuiText.MaxTypes.getLocal() + " " + restricted.get(1));
}
}
}
}
}
@@ -190,7 +203,7 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
@Override
public IInventory getUpgradesInventory(ItemStack is) {
return new CellUpgrades(is, 2);
return new CellUpgrades(is, 5);
}
@Override
@@ -213,6 +226,29 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
Platform.openNbtData(is).setString("FuzzyMode", fzMode.name());
}
@Override
public String getCellData(ItemStack is) {
return totalBytes + ","
+ this.getTotalTypes(null)
+ ","
+ this.getBytesPerType(null)
+ ","
+ 256 * 8
+ ","
+ Platform.openNbtData(is).getByte("cellRestrictionTypes")
+ ","
+ Platform.openNbtData(is).getLong("cellRestrictionAmount")
+ ","
+ "fluid";
}
@Override
public void setCellRestriction(ItemStack is, String newData) {
List<String> data = Arrays.asList(newData.split(",", 2));
Platform.openNbtData(is).setByte("cellRestrictionTypes", Byte.parseByte(data.get(0)));
Platform.openNbtData(is).setLong("cellRestrictionAmount", Long.parseLong(data.get(1)));
}
@SuppressWarnings("unchecked")
protected boolean disassembleDrive(final ItemStack stack, final World world, final EntityPlayer player) {
if (player.isSneaking()) {
@@ -224,7 +260,8 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
.getCellInventory(stack, null, StorageChannel.FLUIDS);
if (inv != null && playerInventory.getCurrentItem() == stack) {
final InventoryAdaptor ia = InventoryAdaptor.getAdaptor(player, ForgeDirection.UNKNOWN);
final IItemList<IAEFluidStack> list = inv.getAvailableItems(StorageChannel.FLUIDS.createList());
final IItemList<IAEFluidStack> list = inv
.getAvailableItems(StorageChannel.FLUIDS.createList(), IterationCounter.fetchNewId());
if (list.isEmpty() && ia != null) {
playerInventory.setInventorySlotContents(playerInventory.currentItem, null);
@@ -0,0 +1,93 @@
package com.glodblock.github.common.item;
import java.util.List;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import com.glodblock.github.api.FluidCraftAPI;
import com.glodblock.github.common.storage.IFluidCellInventory;
import com.glodblock.github.common.storage.IFluidCellInventoryHandler;
import com.glodblock.github.common.storage.IStorageFluidCell;
import com.glodblock.github.util.NameConst;
import appeng.api.AEApi;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.items.AEBaseItem;
import appeng.items.contents.CellUpgrades;
public abstract class ItemBaseInfinityStorageCell extends AEBaseItem implements IStorageFluidCell {
@Override
public long getBytes(ItemStack cellItem) {
return 0;
}
@Override
public int getBytesPerType(ItemStack cellItem) {
return 0;
}
@Override
public boolean isBlackListed(ItemStack cellItem, IAEFluidStack requestedAddition) {
return requestedAddition == null || requestedAddition.getFluid() == null
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
}
@Override
public boolean storableInStorageCell() {
return false;
}
@Override
public boolean isStorageCell(ItemStack i) {
return true;
}
@Override
public double getIdleDrain(ItemStack is) {
return 0;
}
@Override
public int getTotalTypes(ItemStack cellItem) {
return 0;
}
@Override
public IInventory getUpgradesInventory(ItemStack is) {
return new CellUpgrades(is, 0);
}
@Override
public void addCheckedInformation(final ItemStack stack, final EntityPlayer player, final List<String> lines,
final boolean displayMoreInfo) {
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell()
.getCellInventory(stack, null, StorageChannel.FLUIDS);
if (inventory instanceof final IFluidCellInventoryHandler handler) {
final IFluidCellInventory cellInventory = handler.getCellInv();
if (GuiScreen.isCtrlKeyDown()) {
if (!cellInventory.getContents().isEmpty()) {
lines.add(StatCollector.translateToLocal(NameConst.TT_CELL_CONTENTS));
for (IAEFluidStack fluid : cellInventory.getContents()) {
if (fluid != null) {
lines.add(String.format(" %s %s", StatCollector.translateToLocal(NameConst.TT_INFINITY_FLUID_STORAGE_TIPS), fluid.getFluidStack().getLocalizedName()));
}
}
} else {
lines.add(StatCollector.translateToLocal(NameConst.TT_CELL_EMPTY));
}
} else {
lines.add(StatCollector.translateToLocal(NameConst.TT_CTRL_FOR_MORE));
}
}
}
}
@@ -1,6 +1,8 @@
package com.glodblock.github.common.item;
import static com.glodblock.github.loader.recipe.WirelessTerminalEnergyRecipe.getEnergyCard;
import static com.glodblock.github.loader.recipe.WirelessTerminalRecipe.getInfinityBoosterCard;
import static com.glodblock.github.util.Util.DimensionalCoordSide.hasEnergyCard;
import static com.glodblock.github.util.Util.hasInfinityBoosterCard;
import java.util.List;
@@ -33,6 +35,7 @@ public class ItemBaseWirelessTerminal extends ToolWirelessTerminal implements II
protected GuiType type;
public static String infinityBoosterCard = "infinityBoosterCard";
public static String infinityEnergyCard = "InfinityEnergyCard";
public ItemBaseWirelessTerminal(GuiType t) {
super();
@@ -41,7 +44,8 @@ public class ItemBaseWirelessTerminal extends ToolWirelessTerminal implements II
@Override
public ItemStack onItemRightClick(final ItemStack item, final World w, final EntityPlayer player) {
if (player.isSneaking()) return removeInfinityBoosterCard(player, item);
if (player.isSneaking()) return removeInfinityBoosterCard(player, item); // todo: doesn't work in universal
// terminal
if (ForgeEventFactory.onItemUseStart(player, item, 1) > 0) {
if (Platform.isClient()) {
return item;
@@ -98,6 +102,9 @@ public class ItemBaseWirelessTerminal extends ToolWirelessTerminal implements II
if (hasInfinityBoosterCard(stack)) {
lines.add(" " + EnumChatFormatting.GOLD + getInfinityBoosterCard().getDisplayName());
}
if (hasEnergyCard(stack)) {
lines.add(" " + EnumChatFormatting.GOLD + getEnergyCard().getDisplayName());
}
} else {
lines.add(NameConst.i18n(NameConst.TT_CTRL_FOR_MORE));
}
@@ -105,6 +112,9 @@ public class ItemBaseWirelessTerminal extends ToolWirelessTerminal implements II
@Override
public boolean canHandle(final ItemStack is) {
if (is == null) {
return false;
}
return is.getItem() instanceof ItemBaseWirelessTerminal;
}
@@ -43,7 +43,7 @@ public class ItemBasicFluidStorageCell extends FCBaseItemCell
this.totalBytes = kilobytes * 1024;
this.component = whichCell;
this.housingValue = housingValue;
setUnlocalizedName(NameConst.ITEM_FLUID_STORAGE + kilobytes);
setUnlocalizedName(NameConst.ITEM_FLUID_STORAGE + "." + kilobytes);
switch (this.component) {
case Cell1kPart -> {
@@ -1,36 +1,23 @@
package com.glodblock.github.common.item;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.api.FluidCraftAPI;
import com.glodblock.github.common.storage.IFluidCellInventory;
import com.glodblock.github.common.storage.IFluidCellInventoryHandler;
import com.glodblock.github.common.storage.IStorageFluidCell;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.loader.IRegister;
import com.glodblock.github.util.NameConst;
import appeng.api.AEApi;
import appeng.api.config.FuzzyMode;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.core.features.AEFeature;
import appeng.items.AEBaseItem;
import appeng.items.contents.CellConfig;
import appeng.items.contents.CellUpgrades;
import appeng.util.Platform;
import cpw.mods.fml.common.registry.GameRegistry;
public class ItemCreativeFluidStorageCell extends AEBaseItem
public class ItemCreativeFluidStorageCell extends ItemBaseInfinityStorageCell
implements IStorageFluidCell, IRegister<ItemCreativeFluidStorageCell> {
public ItemCreativeFluidStorageCell() {
@@ -41,52 +28,6 @@ public class ItemCreativeFluidStorageCell extends AEBaseItem
this.setMaxStackSize(1);
}
@Override
public long getBytes(ItemStack cellItem) {
return 0;
}
@Override
public int getBytesPerType(ItemStack cellItem) {
return 0;
}
@Override
public boolean isBlackListed(ItemStack cellItem, IAEFluidStack requestedAddition) {
return requestedAddition == null || requestedAddition.getFluid() == null
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
}
@Override
public boolean storableInStorageCell() {
return false;
}
@Override
public boolean isStorageCell(ItemStack i) {
return true;
}
@Override
public double getIdleDrain(ItemStack is) {
return 0;
}
@Override
public int getTotalTypes(ItemStack cellItem) {
return 0;
}
@Override
public boolean isEditable(ItemStack is) {
return true;
}
@Override
public IInventory getUpgradesInventory(ItemStack is) {
return new CellUpgrades(is, 0);
}
@Override
public IInventory getConfigInventory(ItemStack is) {
return new CellConfig(is);
@@ -103,29 +44,8 @@ public class ItemCreativeFluidStorageCell extends AEBaseItem
}
@Override
public void addCheckedInformation(final ItemStack stack, final EntityPlayer player, final List<String> lines,
final boolean displayMoreInfo) {
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell()
.getCellInventory(stack, null, StorageChannel.FLUIDS);
if (inventory instanceof final IFluidCellInventoryHandler handler) {
final IFluidCellInventory cellInventory = handler.getCellInv();
if (GuiScreen.isCtrlKeyDown()) {
if (cellInventory.getContents().size() > 0) {
lines.add(StatCollector.translateToLocal(NameConst.TT_CELL_CONTENTS));
for (IAEFluidStack fluid : cellInventory.getContents()) {
if (fluid != null) {
lines.add(String.format(" %s", fluid.getFluidStack().getLocalizedName()));
}
}
} else {
lines.add(StatCollector.translateToLocal(NameConst.TT_CELL_EMPTY));
}
} else {
lines.add(StatCollector.translateToLocal(NameConst.TT_CTRL_FOR_MORE));
}
}
public boolean isEditable(ItemStack is) {
return true;
}
@Override
@@ -0,0 +1,44 @@
package com.glodblock.github.common.item;
import static net.minecraft.client.gui.GuiScreen.isShiftKeyDown;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.util.NameConst;
import com.glodblock.github.util.RenderUtil;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemEnergyCard extends FCBaseItem {
public ItemEnergyCard() {
super();
this.setMaxStackSize(64);
this.setUnlocalizedName(NameConst.ITEM_ENERGY_CARD);
this.setTextureName(FluidCraft.resource(NameConst.ITEM_ENERGY_CARD).toString());
}
@Override
public ItemEnergyCard register() {
GameRegistry.registerItem(this, NameConst.ITEM_ENERGY_CARD, FluidCraft.MODID);
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List<String> toolTip, boolean flag) {
if (isShiftKeyDown()) {
toolTip.addAll(RenderUtil.listFormattedStringToWidth(NameConst.i18n(NameConst.TT_ENERGY_CARD_DESC)));
} else {
toolTip.add(NameConst.i18n(NameConst.TT_SHIFT_FOR_MORE));
}
}
}
@@ -41,9 +41,8 @@ public class ItemFluidDrop extends FCBaseItem {
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list) {
public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> list) {
if (CreativeTabs.tabMisc.equals(tab)) {
list.add(newStack(new FluidStack(FluidRegistry.WATER, 1)));
list.add(newStack(new FluidStack(FluidRegistry.LAVA, 1)));
@@ -67,9 +66,8 @@ public class ItemFluidDrop extends FCBaseItem {
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean flag) {
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean flag) {
FluidStack fluid = getFluidStack(stack);
if (ItemFluidPacket.isDisplay(stack)) return;
if (fluid != null) {
@@ -70,8 +70,7 @@ public class ItemFluidPacket extends FCBaseItem {
}
@Override
@SuppressWarnings("unchecked")
public void addInformation(ItemStack stack, EntityPlayer player, List tooltip, boolean flags) {
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean flags) {
FluidStack fluid = getFluidStack(stack);
boolean display = isDisplay(stack);
if (display) return;
@@ -0,0 +1,136 @@
package com.glodblock.github.common.item;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.api.FluidCraftAPI;
import com.glodblock.github.common.storage.IFluidCellInventory;
import com.glodblock.github.common.storage.IFluidCellInventoryHandler;
import com.glodblock.github.common.storage.IStorageFluidCell;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.loader.IRegister;
import com.glodblock.github.util.NameConst;
import appeng.api.AEApi;
import appeng.api.config.FuzzyMode;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.core.features.AEFeature;
import appeng.core.localization.GuiText;
import appeng.items.AEBaseItem;
import appeng.items.contents.CellConfig;
import appeng.items.contents.CellUpgrades;
import appeng.util.Platform;
import cpw.mods.fml.common.registry.GameRegistry;
public class ItemFluidVoidStorageCell extends AEBaseItem
implements IStorageFluidCell, IRegister<ItemFluidVoidStorageCell> {
public ItemFluidVoidStorageCell() {
super();
setUnlocalizedName(NameConst.ITEM_FLUID_VOID_CELL);
setTextureName(FluidCraft.resource(NameConst.ITEM_FLUID_VOID_CELL).toString());
this.setFeature(EnumSet.of(AEFeature.StorageCells));
this.setMaxStackSize(1);
}
@Override
public ItemFluidVoidStorageCell register() {
GameRegistry.registerItem(this, NameConst.ITEM_FLUID_VOID_CELL, FluidCraft.MODID);
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
@Override
public void addCheckedInformation(final ItemStack stack, final EntityPlayer player, final List<String> lines,
final boolean displayMoreInfo) {
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell()
.getCellInventory(stack, null, StorageChannel.FLUIDS);
if (inventory instanceof final IFluidCellInventoryHandler handler) {
lines.add(NameConst.i18n(NameConst.TT_ITEM_FLUID_VOID_CELL));
lines.add(GuiText.VoidCellTooltip.getLocal());
lines.add(0 + " " + GuiText.Of.getLocal() + " \u00A7k9999\u00A77 " + GuiText.BytesUsed.getLocal());
final IFluidCellInventory inv = handler.getCellInv();
if (GuiScreen.isShiftKeyDown()) {
lines.add(GuiText.Filter.getLocal() + ": ");
for (int i = 0; i < inv.getConfigInventory().getSizeInventory(); ++i) {
ItemStack s = inv.getConfigInventory().getStackInSlot(i);
if (s != null) lines.add(s.getDisplayName());
}
}
}
}
@Override
public long getBytes(ItemStack cellItem) {
return 0;
}
@Override
public int getBytesPerType(ItemStack cellItem) {
return 0;
}
@Override
public boolean isBlackListed(ItemStack cellItem, IAEFluidStack requestedAddition) {
return requestedAddition == null || requestedAddition.getFluid() == null
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
}
@Override
public boolean storableInStorageCell() {
return true;
}
@Override
public boolean isStorageCell(ItemStack i) {
return true;
}
@Override
public double getIdleDrain(ItemStack is) {
return 0;
}
@Override
public int getTotalTypes(ItemStack cellItem) {
return 0;
}
@Override
public boolean isEditable(ItemStack is) {
return true;
}
@Override
public IInventory getUpgradesInventory(ItemStack is) {
return new CellUpgrades(is, 5);
}
@Override
public IInventory getConfigInventory(ItemStack is) {
return new CellConfig(is);
}
@Override
public FuzzyMode getFuzzyMode(ItemStack is) {
final String fz = Platform.openNbtData(is).getString("FuzzyMode");
try {
return FuzzyMode.valueOf(fz);
} catch (final Throwable t) {
return FuzzyMode.IGNORE_ALL;
}
}
@Override
public void setFuzzyMode(ItemStack is, FuzzyMode fzMode) {
Platform.openNbtData(is).setString("FuzzyMode", fzMode.name());
}
}
@@ -0,0 +1,68 @@
package com.glodblock.github.common.item;
import static com.glodblock.github.util.Util.FluidUtil.water_bucket;
import java.util.EnumSet;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.storage.IStorageFluidCell;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.loader.IRegister;
import com.glodblock.github.util.NameConst;
import appeng.api.config.FuzzyMode;
import appeng.core.features.AEFeature;
import appeng.tile.inventory.AppEngInternalInventory;
import cpw.mods.fml.common.registry.GameRegistry;
public class ItemInfinityWaterStorageCell extends ItemBaseInfinityStorageCell
implements IStorageFluidCell, IRegister<ItemInfinityWaterStorageCell> {
@Override
public IInventory getConfigInventory(ItemStack is) {
return new InfinityConfig(water_bucket);
}
public static class InfinityConfig extends AppEngInternalInventory {
public InfinityConfig(final ItemStack is) {
super(null, 1);
this.setInventorySlotContents(0, is);
}
@Override
public void markDirty() {}
}
public ItemInfinityWaterStorageCell() {
super();
setUnlocalizedName(NameConst.ITEM_INFINITY_WATER_FLUID_STORAGE);
setTextureName(FluidCraft.resource(NameConst.ITEM_INFINITY_FLUID_STORAGE).toString());
this.setFeature(EnumSet.of(AEFeature.StorageCells));
this.setMaxStackSize(1);
}
@Override
public ItemInfinityWaterStorageCell register() {
GameRegistry.registerItem(this, NameConst.ITEM_INFINITY_WATER_FLUID_STORAGE, FluidCraft.MODID);
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
@Override
public boolean isEditable(ItemStack is) {
return false;
}
@Override
public FuzzyMode getFuzzyMode(ItemStack is) {
return FuzzyMode.IGNORE_ALL;
}
@Override
public void setFuzzyMode(ItemStack is, FuzzyMode fzMode) {}
}
@@ -44,7 +44,7 @@ public class ItemMultiFluidStorageCell extends FCBaseItemCell
this.component = whichCell;
this.housingValue = housingValue;
this.maxType = 5;
setUnlocalizedName(NameConst.ITEM_MULTI_FLUID_STORAGE + kilobytes);
setUnlocalizedName(NameConst.ITEM_MULTI_FLUID_STORAGE + "." + kilobytes);
switch (this.component) {
case Cell1kPart -> {
@@ -43,9 +43,8 @@ public class ItemPartFluidTerminal extends FCBaseItem implements IPartItem {
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List toolTip, boolean flag) {
public void addInformation(ItemStack stack, EntityPlayer player, List<String> toolTip, boolean flag) {
if (isShiftKeyDown()) {
toolTip.add(NameConst.i18n(NameConst.TT_FLUID_TERMINAL));
} else {
@@ -43,9 +43,8 @@ public class ItemPartLevelTerminal extends FCBaseItem implements IPartItem {
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List toolTip, boolean flag) {
public void addInformation(ItemStack stack, EntityPlayer player, List<String> toolTip, boolean flag) {
if (isShiftKeyDown()) {
toolTip.add(NameConst.i18n(NameConst.TT_LEVEL_TERMINAL));
} else {
@@ -0,0 +1,45 @@
package com.glodblock.github.common.item;
import static net.minecraft.client.gui.GuiScreen.isShiftKeyDown;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.util.NameConst;
import com.glodblock.github.util.RenderUtil;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemQuantumBridgeCard extends FCBaseItem {
public ItemQuantumBridgeCard() {
super();
this.setMaxStackSize(64);
this.setUnlocalizedName(NameConst.ITEM_QUANTUM_BRIDGE_CARD);
this.setTextureName(FluidCraft.resource(NameConst.ITEM_QUANTUM_BRIDGE_CARD).toString());
}
@Override
public ItemQuantumBridgeCard register() {
GameRegistry.registerItem(this, NameConst.ITEM_QUANTUM_BRIDGE_CARD, FluidCraft.MODID);
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List<String> toolTip, boolean flag) {
if (isShiftKeyDown()) {
toolTip.addAll(
RenderUtil.listFormattedStringToWidth(NameConst.i18n(NameConst.TT_QUANTUM_BRIDGE_CARD_DESC)));
} else {
toolTip.add(NameConst.i18n(NameConst.TT_SHIFT_FOR_MORE));
}
}
}
@@ -226,8 +226,10 @@ public class PartFluidLevelEmitter extends PartUpgradeable implements IStackWatc
}
@Override
public void onStackChange(final IItemList o, final IAEStack fullStack, final IAEStack diffStack,
final BaseActionSource src, final StorageChannel chan) {
public void onStackChange(@SuppressWarnings("rawtypes") final IItemList o,
@SuppressWarnings("rawtypes") final IAEStack fullStack,
@SuppressWarnings("rawtypes") final IAEStack diffStack, final BaseActionSource src,
final StorageChannel chan) {
if (chan == StorageChannel.FLUIDS && fullStack.equals(this.getIAEFluidStack())) {
this.lastReportedValue = fullStack.getStackSize();
this.updateState();
@@ -529,7 +531,8 @@ public class PartFluidLevelEmitter extends PartUpgradeable implements IStackWatc
}
@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) {
this.configureWatchers();
}
@@ -485,7 +485,7 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
}
@Override
public void pasteMemoryCardData(PartP2PTunnel newTunnel, NBTTagCompound data) throws GridAccessException {
public void pasteMemoryCardData(PartP2PTunnel<?> newTunnel, NBTTagCompound data) throws GridAccessException {
this.duality.getConfigManager().readFromNBT(data);
super.pasteMemoryCardData(newTunnel, data);
}
@@ -1,8 +1,12 @@
package com.glodblock.github.common.parts;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.function.Predicate;
import javax.annotation.Nullable;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.entity.player.EntityPlayer;
@@ -11,16 +15,13 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Vec3;
import net.minecraftforge.fluids.IFluidHandler;
import com.glodblock.github.client.textures.FCPartsTexture;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.common.tile.TileFluidInterface;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.MEMonitorIFluidHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.util.BlockPos;
import com.glodblock.github.util.ModAndClassUtil;
import appeng.api.AEApi;
import appeng.api.config.AccessRestriction;
@@ -43,9 +44,9 @@ import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.ITickManager;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartRenderHelper;
import appeng.api.parts.PartItemStack;
import appeng.api.storage.ICellContainer;
import appeng.api.storage.IExternalStorageHandler;
import appeng.api.storage.IMEInventory;
@@ -63,16 +64,16 @@ import appeng.helpers.IPriorityHost;
import appeng.me.GridAccessException;
import appeng.me.cache.GridStorageCache;
import appeng.me.storage.MEInventoryHandler;
import appeng.me.storage.StorageBusInventoryHandler;
import appeng.parts.automation.PartUpgradeable;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.tile.inventory.InvOperation;
import appeng.tile.networking.TileCableBus;
import appeng.util.IterationCounter;
import appeng.util.Platform;
import appeng.util.item.AEFluidStack;
import appeng.util.prioitylist.PrecisePriorityList;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import extracells.tileentity.TileEntityFluidInterface;
public class PartFluidStorageBus extends PartUpgradeable
implements IGridTickable, ICellContainer, IMEMonitorHandlerReceiver<IAEFluidStack>, IPriorityHost {
@@ -86,8 +87,10 @@ public class PartFluidStorageBus extends PartUpgradeable
private int handlerHash = 0;
private boolean wasActive = false;
private byte resetCacheLogic = 0;
private boolean accessChanged;
private boolean readOncePass;
/**
* used to read changes once when the list of extractable items was changed
*/
private boolean readOncePass = false;
public PartFluidStorageBus(ItemStack is) {
super(is);
@@ -96,6 +99,27 @@ public class PartFluidStorageBus extends PartUpgradeable
this.getConfigManager().registerSetting(Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY);
this.getConfigManager().registerSetting(Settings.STICKY_MODE, YesNo.NO);
this.source = new MachineSource(this);
if (is.getTagCompound() != null) {
NBTTagCompound tag = is.getTagCompound();
if (tag.hasKey("priority")) {
priority = tag.getInteger("priority");
// if we don't do this, the tag will stick forever to the storage bus, as it's never cleaned up,
// even when the item is broken with a pickaxe
this.is.setTagCompound(null);
}
}
}
@Override
public ItemStack getItemStack(final PartItemStack type) {
if (type == PartItemStack.Wrench) {
final NBTTagCompound tag = new NBTTagCompound();
tag.setInteger("priority", priority);
final ItemStack copy = this.is.copy();
copy.setTagCompound(tag);
return copy;
}
return super.getItemStack(type);
}
@Override
@@ -129,10 +153,8 @@ public class PartFluidStorageBus extends PartUpgradeable
}
@Override
public void updateSetting(final IConfigManager manager, final Enum settingName, final Enum newValue) {
if (settingName.name().equals("ACCESS")) {
this.accessChanged = true;
}
public void updateSetting(final IConfigManager manager, @SuppressWarnings("rawtypes") final Enum settingName,
@SuppressWarnings("rawtypes") final Enum newValue) {
this.resetCache(true);
this.getHost().markForSave();
}
@@ -148,7 +170,6 @@ public class PartFluidStorageBus extends PartUpgradeable
super.readFromNBT(data);
this.config.readFromNBT(data, "config");
this.priority = data.getInteger("priority");
this.accessChanged = false;
}
@Override
@@ -201,18 +222,7 @@ public class PartFluidStorageBus extends PartUpgradeable
final MEInventoryHandler<IAEFluidStack> in = this.getInternalHandler();
IItemList<IAEFluidStack> before = AEApi.instance().storage().createFluidList();
if (in != null) {
if (accessChanged) {
AccessRestriction currentAccess = (AccessRestriction) this.getConfigManager()
.getSetting(Settings.ACCESS);
if (!currentAccess.hasPermission(AccessRestriction.READ)) {
readOncePass = true;
}
before = in.getAvailableItems(before);
in.setBaseAccess(currentAccess);
accessChanged = false;
} else {
before = in.getAvailableItems(before);
}
before = in.getAvailableItems(before, IterationCounter.fetchNewId());
}
this.cached = false;
@@ -221,11 +231,15 @@ public class PartFluidStorageBus extends PartUpgradeable
}
final MEInventoryHandler<IAEFluidStack> out = this.getInternalHandler();
if (this.monitor != null) {
this.monitor.onTick();
}
IItemList<IAEFluidStack> after = AEApi.instance().storage().createFluidList();
if (in != out) {
if (out != null) {
after = out.getAvailableItems(after);
after = out.getAvailableItems(after, IterationCounter.fetchNewId());
}
Platform.postListChanges(before, after, this, this.source);
}
@@ -239,23 +253,46 @@ public class PartFluidStorageBus extends PartUpgradeable
@Override
public void postChange(final IBaseMonitor<IAEFluidStack> monitor, final Iterable<IAEFluidStack> change,
final BaseActionSource source) {
if (this.getProxy().isActive()) {
AccessRestriction currentAccess = (AccessRestriction) this.getConfigManager().getSetting(Settings.ACCESS);
if (readOncePass) {
readOncePass = false;
try {
this.getProxy().getStorage()
.postAlterationOfStoredItems(StorageChannel.FLUIDS, change, this.source);
} catch (final GridAccessException ignore) {}
return;
try {
if (this.getProxy().isActive()) {
if (!this.readOncePass) {
AccessRestriction currentAccess = (AccessRestriction) this.getConfigManager()
.getSetting(Settings.ACCESS);
if (!currentAccess.hasPermission(AccessRestriction.READ)) {
return;
}
}
Iterable<IAEFluidStack> filteredChanges = this.filterChanges(change, this.readOncePass);
this.readOncePass = false;
if (filteredChanges == null) return;
this.getProxy().getStorage()
.postAlterationOfStoredItems(StorageChannel.FLUIDS, filteredChanges, this.source);
}
if (!currentAccess.hasPermission(AccessRestriction.READ)) {
return;
}
try {
this.getProxy().getStorage().postAlterationOfStoredItems(StorageChannel.FLUIDS, change, source);
} catch (final GridAccessException ignore) {}
} catch (final GridAccessException ignore) {}
}
/**
* Filters the changes to only include fluids that pass the handlers extract filter. Will return null if none of the
* changes match the filter.
*/
@Nullable
private Iterable<IAEFluidStack> filterChanges(final Iterable<IAEFluidStack> change, final boolean readOncePass) {
if (readOncePass) {
return change;
}
if (this.handler != null && this.handler.isExtractFilterActive()
&& !this.handler.getExtractPartitionList().isEmpty()) {
List<IAEFluidStack> filteredChanges = new ArrayList<>();
Predicate<IAEFluidStack> extractFilterCondition = this.handler.getExtractFilterCondition();
for (final IAEFluidStack changedFluid : change) {
if (extractFilterCondition.test(changedFluid)) {
filteredChanges.add(changedFluid);
}
}
return filteredChanges.isEmpty() ? null : Collections.unmodifiableList(filteredChanges);
}
return change;
}
@Override
@@ -272,38 +309,7 @@ public class PartFluidStorageBus extends PartUpgradeable
@Override
public void onNeighborChanged() {
TileEntity tile = this.getTile();
if (tile == null || this.getProxy() == null || !this.getProxy().isActive()) return;
BlockPos neighbor = new BlockPos(tile).getOffSet(this.getSide());
final TileEntity te = neighbor.getTileEntity();
// In case the TE was destroyed, we have to do a full reset immediately.
if (te instanceof TileCableBus) {
IPart iPart = ((TileCableBus) te).getPart(this.getSide().getOpposite());
if (iPart == null || iPart instanceof PartFluidInterface) {
this.resetCache(true);
this.resetCache();
}
if (ModAndClassUtil.EC2) {
if (iPart == null || iPart instanceof extracells.part.PartFluidInterface) {
this.resetCache(true);
this.resetCache();
}
}
} else if (te == null || te instanceof TileFluidInterface) {
this.resetCache(true);
this.resetCache();
} else if (ModAndClassUtil.EC2) {
if (te instanceof TileEntityFluidInterface) {
this.resetCache(true);
this.resetCache();
}
} else if (te instanceof IFluidHandler) {
this.resetCache(true);
this.resetCache();
} else {
this.resetCache(false);
}
this.resetCache(false);
}
@Override
@@ -356,6 +362,7 @@ public class PartFluidStorageBus extends PartUpgradeable
this.handlerHash = newHandlerHash;
this.handler = null;
this.monitor = null;
this.readOncePass = true;
if (target != null) {
final IExternalStorageHandler esh = AEApi.instance().registries().externalStorage()
.getHandler(target, this.getSide().getOpposite(), StorageChannel.FLUIDS, this.source);
@@ -365,16 +372,21 @@ public class PartFluidStorageBus extends PartUpgradeable
if (inv instanceof final MEMonitorIFluidHandler h) {
h.setMode((StorageFilter) this.getConfigManager().getSetting(Settings.STORAGE_FILTER));
h.setActionSource(new MachineSource(this));
this.monitor = (MEMonitorIFluidHandler) inv;
this.monitor = h;
}
if (inv != null) {
this.handler = new MEInventoryHandler(inv, StorageChannel.FLUIDS);
this.handler.setBaseAccess((AccessRestriction) this.getConfigManager().getSetting(Settings.ACCESS));
this.handler = new StorageBusInventoryHandler(inv, StorageChannel.FLUIDS);
AccessRestriction currentAccess = (AccessRestriction) this.getConfigManager().getSetting(Settings.ACCESS);
this.handler.setBaseAccess(currentAccess);
this.handler.setWhitelist(
this.getInstalledUpgrades(Upgrades.INVERTER) > 0 ? IncludeExclude.BLACKLIST
: IncludeExclude.WHITELIST);
this.handler.setSticky(this.getInstalledUpgrades(Upgrades.STICKY) > 0);
this.handler.setPriority(this.priority);
// only READ since READ_WRITE would break compat of existing storage buses
// could use a new setting that is applied via button or a card too
this.handler.setIsExtractFilterActive(currentAccess == AccessRestriction.READ);
if (inv instanceof IMEMonitor) {
((IBaseMonitor) inv).addListener(this, this.handler);
}
@@ -385,7 +397,9 @@ public class PartFluidStorageBus extends PartUpgradeable
final IAEItemStack is = this.config.getAEStackInSlot(x);
if (is != null) priorityList.add(AEFluidStack.create(ItemFluidPacket.getFluidStack(is)));
}
this.handler.setPartitionList(new PrecisePriorityList(priorityList));
PrecisePriorityList partitionList = new PrecisePriorityList(priorityList);
this.handler.setPartitionList(partitionList);
this.handler.setExtractPartitionList(partitionList);
}
}
}
@@ -435,12 +449,7 @@ public class PartFluidStorageBus extends PartUpgradeable
}
@Override
public void blinkCell(int slot) {
// NO-OP
}
@Override
public void saveChanges(final IMEInventory cellInventory) {
public void saveChanges(@SuppressWarnings("rawtypes") final IMEInventory cellInventory) {
// NO-OP
}
@@ -284,7 +284,8 @@ public abstract class FCPart extends AEBasePart
}
@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) {}
@Override
public IInventory getViewCellStorage() {
@@ -323,8 +323,10 @@ public abstract class FCPartMonitor extends AbstractPartDisplay implements IPart
}
@Override
public void onStackChange(final IItemList o, final IAEStack fullStack, final IAEStack diffStack,
final BaseActionSource src, final StorageChannel chan) {
public void onStackChange(@SuppressWarnings("rawtypes") final IItemList o,
@SuppressWarnings("rawtypes") final IAEStack fullStack,
@SuppressWarnings("rawtypes") final IAEStack diffStack, final BaseActionSource src,
final StorageChannel chan) {
if (this.configuredFluid != null) {
if (fullStack == null) {
this.configuredFluid.setStackSize(0);
@@ -56,14 +56,12 @@ public class CreativeFluidCellInventory extends FluidCellInventory {
IInventory inv = this.cellType.getConfigInventory(this.cellItem);
for (int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack is = inv.getStackInSlot(i);
if (Util.FluidUtil.isFluidContainer(is)) {
FluidStack fs = Util.getFluidFromItem(is);
if (fs == null) continue;
IAEFluidStack iaeFluidStack = Util.FluidUtil.createAEFluidStack(fs);
if (this.cellFluids.findPrecise(iaeFluidStack) == null) {
iaeFluidStack.setStackSize(Integer.MAX_VALUE);
this.cellFluids.add(iaeFluidStack);
}
FluidStack fs = Util.getFluidFromItem(is);
if (fs == null) continue;
IAEFluidStack iaeFluidStack = Util.FluidUtil.createAEFluidStack(fs);
if (this.cellFluids.findPrecise(iaeFluidStack) == null) {
iaeFluidStack.setStackSize((long) (Math.pow(2, 52) - 1));
this.cellFluids.add(iaeFluidStack);
}
}
}
@@ -51,7 +51,8 @@ public class FluidCellHandler implements ICellHandler {
@Override
public void openChestGui(final EntityPlayer player, final IChestOrDrive chest, final ICellHandler cellHandler,
final IMEInventoryHandler inv, final ItemStack is, final StorageChannel chan) {
@SuppressWarnings("rawtypes") final IMEInventoryHandler inv, final ItemStack is,
final StorageChannel chan) {
if (chan == StorageChannel.FLUIDS) {
if (chest instanceof TileEntity te) {
InventoryHandler
@@ -61,7 +62,7 @@ public class FluidCellHandler implements ICellHandler {
}
@Override
public int getStatusForCell(final ItemStack is, final IMEInventory handler) {
public int getStatusForCell(final ItemStack is, @SuppressWarnings("rawtypes") final IMEInventory handler) {
if (handler instanceof final FluidCellInventoryHandler ci) {
return ci.getStatusForCell();
}
@@ -69,7 +70,7 @@ public class FluidCellHandler implements ICellHandler {
}
@Override
public double cellIdleDrain(final ItemStack is, final IMEInventory handler) {
public double cellIdleDrain(final ItemStack is, @SuppressWarnings("rawtypes") final IMEInventory handler) {
final IFluidCellInventory inv = ((IFluidCellInventoryHandler) handler).getCellInv();
return inv.getIdleDrain(is);
}
@@ -1,6 +1,7 @@
package com.glodblock.github.common.storage;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Nonnull;
@@ -12,13 +13,16 @@ import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
import com.glodblock.github.common.item.ItemCreativeFluidStorageCell;
import com.glodblock.github.common.item.ItemBaseInfinityStorageCell;
import com.glodblock.github.common.item.ItemFluidVoidStorageCell;
import com.glodblock.github.crossmod.extracells.storage.ProxyFluidCellInventory;
import com.glodblock.github.crossmod.extracells.storage.ProxyFluidStorageCell;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.Upgrades;
import appeng.api.exceptions.AppEngException;
import appeng.api.implementations.items.IUpgradeModule;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.ISaveProvider;
@@ -45,6 +49,10 @@ public class FluidCellInventory implements IFluidCellInventory {
protected IItemList<IAEFluidStack> cellFluids;
protected final NBTTagCompound tagCompound;
public static final int singleByteAmount = 256 * 8;
private boolean cardVoidOverflow = false;
private boolean cardDistribution = false;
private byte restrictionTypes = 0;
private long restrictionLong = 0;
public FluidCellInventory(final ItemStack o, final ISaveProvider container) throws AppEngException {
if (o == null) {
@@ -73,19 +81,38 @@ public class FluidCellInventory implements IFluidCellInventory {
}
}
final IInventory upgrades = this.getUpgradesInventory();
for (int x = 0; x < upgrades.getSizeInventory(); x++) {
final ItemStack is = upgrades.getStackInSlot(x);
if (is != null && is.getItem() instanceof IUpgradeModule) {
final Upgrades u = ((IUpgradeModule) is.getItem()).getType(is);
if (u != null) {
switch (u) {
case VOID_OVERFLOW -> cardVoidOverflow = true;
case DISTRIBUTION -> cardDistribution = true;
default -> {}
}
}
}
}
this.container = container;
this.tagCompound = Platform.openNbtData(o);
this.storedFluids = this.tagCompound.getShort(FLUID_TYPE_TAG);
this.storedFluidCount = this.tagCompound.getLong(FLUID_COUNT_TAG);
this.restrictionTypes = this.tagCompound.getByte("cellRestrictionTypes");
this.restrictionLong = this.tagCompound.getLong("cellRestrictionAmount");
this.cellFluids = null;
}
public static IMEInventoryHandler<IAEFluidStack> getCell(final ItemStack o, final ISaveProvider container2) {
try {
if (o.getItem() instanceof ItemCreativeFluidStorageCell) {
if (o.getItem() instanceof ItemBaseInfinityStorageCell) {
return new FluidCellInventoryHandler(new CreativeFluidCellInventory(o, container2));
} else if (o.getItem() instanceof ProxyFluidStorageCell) {
return new FluidCellInventoryHandler(new ProxyFluidCellInventory(o, container2));
} else if (o.getItem() instanceof ItemFluidVoidStorageCell) {
return new FluidCellInventoryHandler(new FluidVoidStorageCellInventory(o, container2));
} else {
return new FluidCellInventoryHandler(new FluidCellInventory(o, container2));
}
@@ -151,6 +178,11 @@ public class FluidCellInventory implements IFluidCellInventory {
@Override
public long getTotalFluidTypes() {
if (restrictionTypes > 0) return restrictionTypes;
return this.cellType.getTotalTypes(this.cellItem);
}
public long getMaxFluidTypes() {
return this.cellType.getTotalTypes(this.cellItem);
}
@@ -173,10 +205,46 @@ public class FluidCellInventory implements IFluidCellInventory {
@Override
public long getRemainingFluidCount() {
if (restrictionLong > 0) {
return Math.min(
restrictionLong - this.getStoredFluidCount(),
this.getFreeBytes() * singleByteAmount + this.getUnusedFluidCount());
}
final long remaining = this.getFreeBytes() * singleByteAmount + this.getUnusedFluidCount();
return remaining > 0 ? remaining : 0;
}
@Override
public long getRemainingFluidCountDist(IAEFluidStack l) {
long remaining;
long types = 0;
for (int i = 0; i < this.getTotalFluidTypes(); i++) {
if (this.getConfigInventory().getStackInSlot(i) != null) {
types++;
}
}
if (types == 0) types = this.getTotalFluidTypes();
if (l != null) {
if (restrictionLong > 0) {
remaining = Math.min((restrictionLong / types) - l.getStackSize(), this.getUnusedFluidCount());
} else {
remaining = (((this.getTotalBytes() / types)
- (int) Math.ceil((double) l.getStackSize() / singleByteAmount)
- getBytesPerType()) * singleByteAmount)
+ (singleByteAmount - l.getStackSize() % singleByteAmount);
}
} else {
if (restrictionLong > 0) {
remaining = Math.min(
restrictionLong / types,
((this.getTotalBytes() / types) - this.getBytesPerType()) * singleByteAmount);
} else {
remaining = ((this.getTotalBytes() / types) - this.getBytesPerType()) * singleByteAmount;
}
}
return remaining > 0 ? remaining : 0;
}
@Override
public int getUnusedFluidCount() {
final int div = (int) (this.getStoredFluidCount() % singleByteAmount);
@@ -188,13 +256,16 @@ public class FluidCellInventory implements IFluidCellInventory {
@Override
public int getStatusForCell() {
if (this.canHoldNewFluid()) {
if (this.getUsedBytes() == 0) {
return 1;
}
if (this.getRemainingFluidCount() > 0) {
if (this.canHoldNewFluid()) {
return 2;
}
return 3;
if (this.getRemainingFluidCount() > 0) {
return 3;
}
return 4;
}
protected void loadCellFluids() {
@@ -287,9 +358,17 @@ public class FluidCellInventory implements IFluidCellInventory {
final IAEFluidStack l = this.getCellFluids().findPrecise(input);
if (l != null) {
final long remainingFluidSlots = this.getRemainingFluidCount();
long remainingFluidSlots;
if (cardDistribution) {
remainingFluidSlots = this.getRemainingFluidCountDist(l);
} else {
remainingFluidSlots = this.getRemainingFluidCount();
}
if (remainingFluidSlots < 0) {
if (remainingFluidSlots <= 0) {
if (cardVoidOverflow) {
return null;
}
return input;
}
@@ -314,8 +393,15 @@ public class FluidCellInventory implements IFluidCellInventory {
if (this.canHoldNewFluid()) // room for new type, and for at least one item!
{
final long remainingFluidCount = this.getRemainingFluidCount()
- ((long) this.getBytesPerType() * singleByteAmount);
long remainingFluidCount;
if (cardDistribution) {
remainingFluidCount = this.getRemainingFluidCountDist(null);
} else {
remainingFluidCount = Math.min(
getRemainingFluidCount(),
getFreeBytes() * singleByteAmount + getUnusedFluidCount()
- (long) getBytesPerType() * singleByteAmount);
}
if (remainingFluidCount > 0) {
if (input.getStackSize() > remainingFluidCount) {
@@ -380,7 +466,7 @@ public class FluidCellInventory implements IFluidCellInventory {
}
@Override
public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out) {
public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out, int iteration) {
for (final IAEFluidStack i : this.getCellFluids()) {
out.add(i);
}
@@ -388,7 +474,7 @@ public class FluidCellInventory implements IFluidCellInventory {
}
@Override
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request) {
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request, int iteration) {
return this.getCellFluids().findPrecise(request);
}
@@ -410,4 +496,8 @@ public class FluidCellInventory implements IFluidCellInventory {
public StorageChannel getChannel() {
return StorageChannel.FLUIDS;
}
public List<Object> getRestriction() {
return Arrays.asList(restrictionLong, restrictionTypes);
}
}
@@ -1,5 +1,7 @@
package com.glodblock.github.common.storage;
import java.util.List;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
@@ -37,7 +39,9 @@ public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack>
final ItemStack is = config.getStackInSlot(x);
final FluidStack fluid = Util.getFluidFromItem(is);
if (fluid != null) {
priorityList.add(AEFluidStack.create(fluid));
AEFluidStack stack = AEFluidStack.create(fluid);
stack.setStackSize(1);
priorityList.add(stack);
}
}
if (!priorityList.isEmpty()) {
@@ -92,8 +96,8 @@ public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack>
public int getStatusForCell() {
int val = this.getCellInv().getStatusForCell();
if (val == 1 && this.isPreformatted()) {
val = 2;
if ((val == 1 || val == 2) && this.isPreformatted()) {
val = 3;
}
return val;
@@ -148,4 +152,13 @@ public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack>
public TYPE getCellType() {
return TYPE.FLUID;
}
public List<Object> getRestricted() {
IFluidCellInventory cellInventory = this.getCellInv();
if (cellInventory instanceof FluidCellInventory ci) {
return ci.getRestriction();
}
return null;
}
}
@@ -0,0 +1,115 @@
package com.glodblock.github.common.storage;
import java.util.List;
import javax.annotation.Nonnull;
import net.minecraft.item.ItemStack;
import appeng.api.config.Actionable;
import appeng.api.exceptions.AppEngException;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.ISaveProvider;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IItemList;
public class FluidVoidStorageCellInventory extends FluidCellInventory {
public FluidVoidStorageCellInventory(ItemStack o, ISaveProvider container) throws AppEngException {
super(o, container);
}
@Override
public boolean canHoldNewFluid() {
return true;
}
@Override
public long getTotalBytes() {
return 0;
}
@Override
public long getFreeBytes() {
return 0;
}
@Override
public long getUsedBytes() {
return 0;
}
@Override
public long getTotalFluidTypes() {
return 63;
}
@Override
public long getStoredFluidCount() {
return 0;
}
@Override
public long getStoredFluidTypes() {
return 0;
}
@Override
public long getRemainingFluidTypes() {
return 63;
}
@Override
public long getRemainingFluidCount() {
return Long.MAX_VALUE;
}
@Override
public int getUnusedFluidCount() {
return Integer.MAX_VALUE;
}
@Override
public int getStatusForCell() {
return 1;
}
@Override
protected void loadCellFluids() {}
@Override
protected IItemList<IAEFluidStack> getCellFluids() {
return null;
}
@Override
public IAEFluidStack injectItems(IAEFluidStack input, Actionable mode, BaseActionSource src) {
if (input == null || input.getStackSize() == 0) {
return null;
}
if (this.cellType.isBlackListed(this.cellItem, input)) {
return input;
}
return null;
}
@Override
public IAEFluidStack extractItems(IAEFluidStack request, Actionable mode, BaseActionSource src) {
return null;
}
@Override
public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out, int iteration) {
return out;
}
@Override
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request, int iteration) {
return null;
}
@Override
public List<IAEFluidStack> getContents() {
return null;
}
}
@@ -60,6 +60,11 @@ public interface IFluidCellInventory extends IMEInventory<IAEFluidStack> {
*/
long getRemainingFluidCount();
/**
* @return how many more fluids can be stored with Distribution card.
*/
long getRemainingFluidCountDist(IAEFluidStack l);
/**
* @return how many fluid types remain.
*/
@@ -145,9 +145,10 @@ public class TileFluidAutoFiller extends AENetworkInvTile
public void provideCrafting(ICraftingProviderHelper craftingTracker) {
IStorageGrid storage = getStorageGrid();
if (storage == null) return;
IItemList<IAEFluidStack> fluidStorage = this.fluids.isEmpty() ? storage.getFluidInventory().getStorageList()
: this.fluids;
for (IAEFluidStack fluidStack : fluidStorage) {
if (this.fluids.isEmpty()) {
this.fluids = storage.getFluidInventory().getStorageList();
}
for (IAEFluidStack fluidStack : this.fluids) {
Fluid fluid = fluidStack.getFluid();
if (fluid == null) continue;
int maxCapacity = Util.FluidUtil.getCapacity(this.getContainerItem(), fluid);
@@ -212,12 +213,10 @@ public class TileFluidAutoFiller extends AENetworkInvTile
BaseActionSource source) {
if (this.getProxy().isActive() && this.getStorageGrid() != null) {
boolean hasChanged = false;
IItemList<IAEFluidStack> stored = this.getStorageGrid().getFluidInventory().getStorageList();
for (IAEFluidStack tmp : change) {
if (stored.findPrecise(tmp) == null || this.fluids.findPrecise(tmp) == null) {
if (this.fluids.findPrecise(tmp) == null) {
hasChanged = true;
this.fluids = stored;
break;
this.fluids.add(tmp);
}
}
if (hasChanged) postEvent();
@@ -12,7 +12,6 @@ import com.glodblock.github.common.item.ItemFluidDrop;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.networking.GridFlags;
import appeng.api.networking.crafting.ICraftingGrid;
import appeng.api.networking.energy.IEnergyGrid;
import appeng.api.networking.events.MENetworkCellArrayUpdate;
import appeng.api.networking.events.MENetworkChannelsChanged;
@@ -31,11 +30,9 @@ import appeng.api.storage.IMEMonitorHandlerReceiver;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IItemList;
import appeng.helpers.IPriorityHost;
import appeng.me.GridAccessException;
import appeng.me.cache.CraftingGridCache;
import appeng.me.storage.MEInventoryHandler;
import appeng.tile.grid.AENetworkTile;
@@ -43,7 +40,6 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
private final BaseActionSource ownActionSource = new MachineSource(this);
private final FluidDiscretizingInventory fluidDropInv = new FluidDiscretizingInventory();
private final FluidCraftingInventory fluidCraftInv = new FluidCraftingInventory();
private boolean prevActiveState = false;
public TileFluidDiscretizer() {
@@ -60,12 +56,8 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
@Override
@SuppressWarnings("rawtypes")
public List<IMEInventoryHandler> getCellArray(StorageChannel channel) {
if (getProxy().isActive()) {
if (channel == StorageChannel.ITEMS) {
return Collections.singletonList(fluidDropInv.invHandler);
} else if (channel == StorageChannel.FLUIDS) {
return Collections.singletonList(fluidCraftInv.invHandler);
}
if (channel == StorageChannel.ITEMS && getProxy().isActive()) {
return Collections.singletonList(fluidDropInv.invHandler);
}
return Collections.emptyList();
}
@@ -80,11 +72,6 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
// do nothing
}
@Override
public void blinkCell(int slot) {
// do nothing
}
@Override
public void gridChanged() {
IMEMonitor<IAEFluidStack> fluidGrid = getFluidGrid();
@@ -94,7 +81,7 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
}
@Override
public void saveChanges(IMEInventory cellInventory) {
public void saveChanges(@SuppressWarnings("rawtypes") IMEInventory cellInventory) {
markDirty();
}
@@ -194,7 +181,7 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
}
@Override
public IItemList<IAEItemStack> getAvailableItems(IItemList<IAEItemStack> out) {
public IItemList<IAEItemStack> getAvailableItems(IItemList<IAEItemStack> out, int iteration) {
if (itemCache == null) {
itemCache = AEApi.instance().storage().createItemList();
IMEMonitor<IAEFluidStack> fluidGrid = getFluidGrid();
@@ -215,7 +202,7 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
}
@Override
public IAEItemStack getAvailableItem(@Nonnull IAEItemStack request) {
public IAEItemStack getAvailableItem(@Nonnull IAEItemStack request, int iteration) {
IMEMonitor<IAEFluidStack> fluidGrid = getFluidGrid();
if (fluidGrid == null) {
return null;
@@ -224,7 +211,7 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
if (fluidRequest == null) {
return null;
}
IAEFluidStack availableFluid = fluidGrid.getAvailableItem(fluidRequest);
IAEFluidStack availableFluid = fluidGrid.getAvailableItem(fluidRequest, iteration);
if (availableFluid == null || availableFluid.getFluid() == null
|| FluidCraftAPI.instance().isBlacklistedInDisplay(availableFluid.getFluid().getClass())) {
return null;
@@ -268,52 +255,4 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
// NO-OP
}
}
private class FluidCraftingInventory implements IMEInventory<IAEFluidStack> {
private final MEInventoryHandler<IAEFluidStack> invHandler = new MEInventoryHandler<>(this, getChannel());
FluidCraftingInventory() {
invHandler.setPriority(Integer.MAX_VALUE);
}
@Override
@SuppressWarnings("rawtypes")
public IAEFluidStack injectItems(IAEFluidStack input, Actionable type, BaseActionSource src) {
ICraftingGrid craftingGrid;
try {
craftingGrid = getProxy().getGrid().getCache(ICraftingGrid.class);
} catch (GridAccessException e) {
return null;
}
if (craftingGrid instanceof CraftingGridCache) {
IAEStack remaining = ((CraftingGridCache) craftingGrid)
.injectItems(ItemFluidDrop.newAeStack(input), type, ownActionSource);
if (remaining instanceof IAEItemStack) {
return ItemFluidDrop.getAeFluidStack((IAEItemStack) remaining);
}
}
return null;
}
@Override
public IAEFluidStack extractItems(IAEFluidStack request, Actionable mode, BaseActionSource src) {
return null;
}
@Override
public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out) {
return out;
}
@Override
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request) {
return null;
}
@Override
public StorageChannel getChannel() {
return StorageChannel.FLUIDS;
}
}
}
@@ -1,11 +1,13 @@
package com.glodblock.github.common.tile;
import java.io.IOException;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
@@ -218,4 +220,11 @@ public class TileFluidInterface extends TileInterface implements IDualHost {
getInternalFluid().setFluidInSlot(id, fluid);
}
}
@Override
public void getDrops(World w, int x, int y, int z, List<ItemStack> drops) {
this.fluidDuality.addDrops(drops);
this.fluidDuality.convertDrops(drops, this.getInterfaceDuality().getWaitingToSend());
super.getDrops(w, x, y, z, drops);
}
}
@@ -14,9 +14,11 @@ import org.jetbrains.annotations.Nullable;
import com.glodblock.github.api.registries.ILevelViewable;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.crossmod.thaumcraft.ThaumicEnergisticsCrafting;
import com.glodblock.github.inventory.AeItemStackHandler;
import com.glodblock.github.inventory.AeStackInventory;
import com.glodblock.github.inventory.AeStackInventoryImpl;
import com.glodblock.github.util.ModAndClassUtil;
import com.google.common.collect.ImmutableSet;
import appeng.api.AEApi;
@@ -169,19 +171,45 @@ public class TileLevelMaintainer extends AENetworkTile
if (!isEnable || batchSize == 0) requests.updateState(i, State.None);
if (batchSize > 0) {
IAEItemStack craftItem = requests.getCraftItem(i);
if (ModAndClassUtil.ThE) {
if (craftItem != null && ThaumicEnergisticsCrafting.isAspectStack(craftItem.getItemStack())) {
craftItem = ThaumicEnergisticsCrafting.convertAspectStack(craftItem);
}
}
IAEItemStack aeItem = inv.findPrecise(craftItem);
long stackSize = aeItem == null ? 0 : aeItem.getStackSize();
if (ModAndClassUtil.ThE) {
if (aeItem != null && ThaumicEnergisticsCrafting.isAspectStack(aeItem.getItemStack())) {
stackSize = ThaumicEnergisticsCrafting.getEssentiaAmount(aeItem, grid);
}
}
boolean isDone = requests.isDone(i);
boolean isCraftable = aeItem != null && aeItem.isCraftable();
boolean shouldCraft = isCraftable && aeItem.getStackSize() < quantity;
boolean shouldCraft = isCraftable && stackSize < quantity;
if (isDone) requests.updateState(i, State.Idle);
if (!isCraftable) requests.updateState(i, State.Error);
if (allBusy || !isDone
|| !shouldCraft
|| craftingGrid.canEmitFor(craftItem)
|| craftingGrid.isRequesting(craftItem))
if (allBusy || !isDone || !shouldCraft) {
continue;
}
if (craftingGrid.canEmitFor(craftItem)) {
continue;
}
if (craftingGrid.isRequesting(craftItem)) {
continue;
}
// do crafting
Future<ICraftingJob> jobTask = requests.getJob(i);
if (jobTask == null) {
if (itemToBegin == null) {
itemToBegin = craftItem;
@@ -295,22 +323,6 @@ public class TileLevelMaintainer extends AENetworkTile
requests.updateStatus(idx, enable);
}
private void readLinkFromNBT(NBTTagCompound data) {
for (int i = 0; i < REQ_COUNT; i++) {
final NBTTagCompound stackData = requests.getItemStack(i).getTagCompound();
if (stackData != null && stackData.hasNoTags()
&& !stackData.hasKey(TLMTags.Link.tagName)
&& stackData.getCompoundTag(TLMTags.Link.tagName).hasNoTags()) {
requests.updateLink(i, null);
requests.updateState(i, State.Idle);
} else {
NBTTagCompound linkData = stackData.getCompoundTag(TLMTags.Link.tagName);
requests.updateLink(i, AEApi.instance().storage().loadCraftingLink(linkData, this));
if (!requests.isDone(i)) requests.updateState(i, State.Craft);
}
}
}
/**
* @deprecated
*/
@@ -1,11 +1,55 @@
package com.glodblock.github.common.tile;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
public class TileWalrus extends TileEntity {
private float scale = 1f;
@Override
public boolean canUpdate() {
return false;
public void readFromNBT(NBTTagCompound data) {
super.readFromNBT(data);
if (data.hasKey("scale")) {
scale = data.getFloat("scale");
}
}
@Override
public void writeToNBT(NBTTagCompound data) {
super.writeToNBT(data);
data.setFloat("scale", scale);
}
@Override
public Packet getDescriptionPacket() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeToNBT(nbttagcompound);
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, nbttagcompound);
}
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
readFromNBT(pkt.func_148857_g());
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
}
@Override
public double getMaxRenderDistanceSquared() {
return 102400;
}
public float getWalrusScale() {
return scale;
}
public void setWalrusScale(float f) {
if (f > 256f) f = 256f;
if (f < 0.03f) f = 0.03f;
scale = f;
markDirty();
}
}
@@ -2,46 +2,52 @@ package com.glodblock.github.coremod;
import net.minecraft.launchwrapper.IClassTransformer;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import com.glodblock.github.coremod.transform.CraftingCpuTransformer;
import com.glodblock.github.coremod.transform.CraftingGridCacheTransformer;
import com.glodblock.github.coremod.transform.CraftingTreeNodeTransformer;
import com.glodblock.github.coremod.transform.DualityInterfaceTransformer;
import com.glodblock.github.coremod.transform.ExternalStorageRegistryTransformer;
import com.glodblock.github.coremod.transform.GuiCraftingTransformer;
import com.glodblock.github.coremod.transform.NEITransformer;
import com.gtnewhorizon.gtnhlib.asm.ASMUtil;
public class FCClassTransformer implements IClassTransformer {
private static final Logger logger = LogManager.getLogger("ASM AE2FC");
@Override
public byte[] transform(String name, String transformedName, byte[] code) {
Transform tform;
public byte[] transform(String name, String transformedName, byte[] basicClass) {
ClassMapper tform;
switch (transformedName) {
case "appeng.crafting.CraftingTreeNode" -> tform = CraftingTreeNodeTransformer.INSTANCE;
case "appeng.me.cache.CraftingGridCache" -> tform = CraftingGridCacheTransformer.INSTANCE;
case "appeng.me.cluster.implementations.CraftingCPUCluster" -> tform = CraftingCpuTransformer.INSTANCE;
case "appeng.helpers.DualityInterface" -> tform = DualityInterfaceTransformer.INSTANCE;
case "appeng.client.gui.implementations.GuiCraftingCPU", "appeng.client.gui.implementations.GuiCraftConfirm", "net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm", "appeng.client.gui.widgets.GuiCraftingTree" -> tform = GuiCraftingTransformer.INSTANCE;
case "appeng.integration.modules.NEI" -> tform = NEITransformer.INSTANCE;
case "appeng.core.features.registries.ExternalStorageRegistry" -> tform = ExternalStorageRegistryTransformer.INSTANCE;
default -> {
return code;
return basicClass;
}
}
System.out.println("[AE2FC] Transforming class: " + transformedName);
return tform.transformClass(code);
logger.debug("Transforming class: " + transformedName);
final byte[] bytes = tform.transformClass(basicClass);
if (FluidCraftCore.DUMP_CLASSES()) {
ASMUtil.saveAsRawClassFile(basicClass, transformedName + "_PRE", this);
ASMUtil.saveAsRawClassFile(bytes, transformedName + "_POST", this);
}
return bytes;
}
public interface Transform {
public abstract static class ClassMapper {
byte[] transformClass(byte[] code);
}
public abstract static class ClassMapper implements Transform {
@Override
public byte[] transformClass(byte[] code) {
public final byte[] transformClass(byte[] code) {
ClassReader reader = new ClassReader(code);
ClassWriter writer = new ClassWriter(reader, getWriteFlags());
reader.accept(getClassMapper(writer), ClassReader.EXPAND_FRAMES);
@@ -11,9 +11,12 @@ import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
@IFMLLoadingPlugin.TransformerExclusions("com.glodblock.github.coremod")
public class FluidCraftCore implements IFMLLoadingPlugin {
private static final boolean DUMP_CLASSES = Boolean.parseBoolean(System.getProperty("ae2fc.dumpClass", "false"));
private static boolean OBF_ENV;
@Override
public String[] getASMTransformerClass() {
return new String[] { FluidCraftCore.class.getPackage().getName() + ".FCClassTransformer" };
return new String[] { FCClassTransformer.class.getName() };
}
@Nullable
@@ -30,7 +33,7 @@ public class FluidCraftCore implements IFMLLoadingPlugin {
@Override
public void injectData(Map<String, Object> data) {
// NO-OP
OBF_ENV = (boolean) data.get("runtimeDeobfuscationEnabled");
}
@Nullable
@@ -38,4 +41,8 @@ public class FluidCraftCore implements IFMLLoadingPlugin {
public String getAccessTransformerClass() {
return null;
}
public static boolean DUMP_CLASSES() {
return DUMP_CLASSES || !OBF_ENV;
}
}
@@ -1,7 +1,7 @@
package com.glodblock.github.coremod.hooker;
import java.util.HashSet;
import java.util.Set;
import java.util.Arrays;
import java.util.List;
import javax.annotation.Nullable;
@@ -15,30 +15,24 @@ import net.minecraftforge.fluids.FluidStack;
import com.glodblock.github.client.gui.GuiFluidCraftConfirm;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.common.parts.PartFluidInterface;
import com.glodblock.github.common.tile.TileFluidInterface;
import com.glodblock.github.inventory.CraftingGridCacheFluidInventoryProxyCell;
import com.glodblock.github.inventory.FluidConvertingInventoryAdaptor;
import com.glodblock.github.inventory.FluidConvertingInventoryCrafting;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.Ae2Reflect;
import com.glodblock.github.util.SetBackedMachineSet;
import com.google.common.collect.Sets;
import appeng.api.config.Actionable;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridHost;
import appeng.api.networking.IGridNode;
import appeng.api.networking.IMachineSet;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.IGuiTooltipHandler;
import appeng.crafting.MECraftingInventory;
import appeng.me.MachineSet;
import appeng.me.cache.CraftingGridCache;
import appeng.me.cluster.implementations.CraftingCPUCluster;
import appeng.parts.misc.PartInterface;
import appeng.tile.misc.TileInterface;
import appeng.util.InventoryAdaptor;
public class CoreModHooks {
@@ -87,40 +81,6 @@ public class CoreModHooks {
return originByte + totalBytes;
}
public static IAEItemStack[] flattenFluidPackets(IAEItemStack[] stacks) {
for (int i = 0; i < stacks.length; i++) {
if (stacks[i].getItem() instanceof ItemFluidPacket) {
stacks[i] = ItemFluidDrop.newAeStack(ItemFluidPacket.getFluidStack(stacks[i]));
}
}
return stacks;
}
public static IMachineSet getMachines(IGrid grid, Class<? extends IGridHost> c) {
if (c == TileInterface.class) {
return unionMachineSets(grid.getMachines(c), grid.getMachines(TileFluidInterface.class));
} else if (c == PartInterface.class) {
return unionMachineSets(grid.getMachines(c), grid.getMachines(PartFluidInterface.class));
} else {
return grid.getMachines(c);
}
}
private static IMachineSet unionMachineSets(IMachineSet a, IMachineSet b) {
if (a.isEmpty()) {
return b;
} else if (b.isEmpty()) {
return a;
} else if (a instanceof MachineSet && b instanceof MachineSet) {
return new SetBackedMachineSet(TileInterface.class, Sets.union((MachineSet) a, (MachineSet) b));
} else {
Set<IGridNode> union = new HashSet<>();
a.forEach(union::add);
b.forEach(union::add);
return new SetBackedMachineSet(TileInterface.class, union);
}
}
public static ItemStack displayFluid(IAEItemStack aeStack) {
if (aeStack.getItemStack() != null && aeStack.getItemStack().getItem() instanceof ItemFluidDrop) {
FluidStack fluid = ItemFluidDrop.getFluidStack(aeStack.getItemStack());
@@ -134,6 +94,13 @@ public class CoreModHooks {
} else return aeStack.getStackSize();
}
public static List<IMEInventoryHandler<?>> craftingGridCacheGetCellArray(final CraftingGridCache instance,
final StorageChannel channel) {
// Equivalent to original function, but using the proxy for fluid channel
return channel == StorageChannel.ITEMS ? Arrays.asList(instance)
: Arrays.asList(new CraftingGridCacheFluidInventoryProxyCell(instance));
}
public static void storeFluidItem(CraftingCPUCluster instance) {
final IGrid g = Ae2Reflect.getGrid(instance);
@@ -0,0 +1,67 @@
package com.glodblock.github.coremod.transform;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import com.glodblock.github.coremod.FCClassTransformer;
public class CraftingGridCacheTransformer extends FCClassTransformer.ClassMapper {
public static final CraftingGridCacheTransformer INSTANCE = new CraftingGridCacheTransformer();
private CraftingGridCacheTransformer() {
// NO-OP
}
@Override
protected ClassVisitor getClassMapper(ClassVisitor downstream) {
return new CraftingGridCacheTransformer.TransformCraftingGridCache(Opcodes.ASM5, downstream);
}
private static class TransformCraftingGridCache extends ClassVisitor {
TransformCraftingGridCache(int api, ClassVisitor cv) {
super(api, cv);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
if (name.equals("getCellArray")) {
return new CraftingGridCacheTransformer.ReplaceGetCellArray(
api,
super.visitMethod(access, name, desc, signature, exceptions));
}
return super.visitMethod(access, name, desc, signature, exceptions);
}
}
private static class ReplaceGetCellArray extends MethodVisitor {
private final MethodVisitor target;
ReplaceGetCellArray(int api, MethodVisitor mv) {
// Original method is replaced
super(api, null);
target = mv;
}
@Override
public void visitCode() {
target.visitCode();
// Equivalent to
// return CoreModHooks::craftingGridCacheGetCellArray(this, channel);
target.visitVarInsn(Opcodes.ALOAD, 0);
target.visitVarInsn(Opcodes.ALOAD, 1);
target.visitMethodInsn(
Opcodes.INVOKESTATIC,
"com/glodblock/github/coremod/hooker/CoreModHooks",
"craftingGridCacheGetCellArray",
"(Lappeng/me/cache/CraftingGridCache;Lappeng/api/storage/StorageChannel;)Ljava/util/List;",
false);
target.visitInsn(Opcodes.ARETURN);
target.visitMaxs(2, 3);
target.visitEnd();
}
}
}
@@ -294,7 +294,6 @@ public class ItemReplacements {
double idleDrain, int types) {
if (replacement.isEnabled()) {
ProxyItemStorageCell item = getOrBuildItemStorage();
int meta = replacement.maybeStack(1).get().getItemDamage();
ProxyItem.ProxyItemEntry storage = new ProxyItem.ProxyStorageEntry(
replacement.maybeItem().get(),
kilobytes,
@@ -55,7 +55,7 @@ public class ProxyItem extends FCBaseItem {
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List info, boolean p_77624_4_) {
public void addInformation(ItemStack stack, EntityPlayer player, List<String> info, boolean p_77624_4_) {
int meta = stack.getItemDamage();
ProxyItemEntry itemRepl = replacements.get(meta);
if (itemRepl != null) {
@@ -63,7 +63,7 @@ public class ProxyItem extends FCBaseItem {
info.add(EnumChatFormatting.AQUA + itemRepl.replacement.getUnlocalizedName());
info.add(EnumChatFormatting.GOLD + "Put in your inventory to get a replacement.");
info.add(EnumChatFormatting.GOLD + "It will disappear if no replacement was found.");
info.add(EnumChatFormatting.RED + "Report missing conversions on the Github.");
info.add(EnumChatFormatting.RED + "Report missing conversions on the GitHub.");
}
}
@@ -16,6 +16,10 @@ public class ProxyVoidStorageCell extends ItemVoidStorageCell {
private final String name = AEApi.instance().definitions().items().cellVoid().maybeStack(1).get()
.getUnlocalizedName();
public ProxyVoidStorageCell() {
this.setUnlocalizedName("ec2placeholder.storage.physical.void");
}
@Override
public void addCheckedInformation(ItemStack stack, EntityPlayer player, List<String> info,
boolean displayMoreInfo) {
@@ -23,7 +27,7 @@ public class ProxyVoidStorageCell extends ItemVoidStorageCell {
info.add(EnumChatFormatting.AQUA + name);
info.add(EnumChatFormatting.GOLD + "Put in your inventory to get a replacement.");
info.add(EnumChatFormatting.GOLD + "It will disappear if no replacement was found.");
info.add(EnumChatFormatting.RED + "Report missing conversions on the Github.");
info.add(EnumChatFormatting.RED + "Report missing conversions on the GitHub.");
}
@Override
@@ -188,16 +188,6 @@ public class DriverOCPatternEditor extends DriverSidedTileEntity {
return new Object[] { stack };
}
@Callback(
doc = "function([slot:number][, database:address, entry:number[, size:number]]):boolean -- Configure the interface.")
public Object[] setInterfaceConfiguration(Context context, Arguments args) {
IInventory config = tileEntity.getInternalInventory();
int slot = args.isString(0) ? 0 : optSlot(args, config, 0, 0);
config.setInventorySlotContents(slot, getStack(args));
context.pause(0.5);
return new Object[] { true };
}
@Callback(doc = "function([slot:number]):table -- Get the given pattern in the interface.")
public Object[] getInterfacePattern(Context context, Arguments args) {
IInventory inv = tileEntity.getInternalInventory();
@@ -0,0 +1,111 @@
package com.glodblock.github.crossmod.thaumcraft;
import java.util.Objects;
import javax.annotation.Nullable;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import com.glodblock.github.util.ModAndClassUtil;
import appeng.api.networking.IGrid;
import appeng.api.storage.data.IAEItemStack;
import appeng.util.item.AEItemStack;
import cpw.mods.fml.common.Optional.Method;
import cpw.mods.fml.common.registry.GameRegistry;
import thaumcraft.api.aspects.Aspect;
import thaumicenergistics.api.grid.IEssentiaGrid;
import thaumicenergistics.common.items.ItemCraftingAspect;
public class ThaumicEnergisticsCrafting {
public static Item neiAddonAspect, thaumicEnergisticsAspect;
public static void postInit() {
neiAddonAspect = GameRegistry.findItem("thaumcraftneiplugin", "Aspect");
thaumicEnergisticsAspect = GameRegistry.findItem("thaumicenergistics", "crafting.aspect");
}
/**
* Checks if a stack is an aspect preview (nei addon or thaumic energistics). Does not mean that the stack contains
* an aspect.
*/
public static boolean isAspectStack(ItemStack stack) {
if (!ModAndClassUtil.ThE || stack == null) return false;
return stack.getItem() == neiAddonAspect || stack.getItem() == thaumicEnergisticsAspect;
}
@Method(modid = "thaumicenergistics")
private static @Nullable Aspect getAspect(ItemStack stack) {
if (stack == null) return null;
if (stack.getItem() == neiAddonAspect) {
NBTTagCompound tag = stack.getTagCompound();
if (tag == null || !(tag.getTag("Aspects") instanceof NBTTagList aspects)) return null;
if (aspects.tagCount() != 1) return null;
String aspect = aspects.getCompoundTagAt(0).getString("key");
if (aspect.isEmpty()) return null;
return Aspect.getAspect(aspect);
}
if (stack.getItem() == thaumicEnergisticsAspect) {
return Aspect.getAspect(ItemCraftingAspect.getAspect(stack).getTag());
}
return null;
}
@Method(modid = "thaumicenergistics")
private static ItemStack getAspectStack(Aspect aspect, int stackSize) {
return ItemCraftingAspect.createStackForAspect(aspect, stackSize);
}
/**
* Converts an aspect stack into a thaumic energistics stack.
*/
public static IAEItemStack convertAspectStack(IAEItemStack stack) {
if (ModAndClassUtil.ThE) {
return convertAspectStackImpl(stack);
} else {
return stack;
}
}
@Method(modid = "thaumicenergistics")
private static IAEItemStack convertAspectStackImpl(IAEItemStack stack) {
if (stack == null) return null;
Aspect aspect = getAspect(stack.getItemStack());
if (aspect == null) return stack;
return Objects.requireNonNull(AEItemStack.create(getAspectStack(aspect, 1))).setStackSize(stack.getStackSize());
}
/**
* Gets the amount of essentia stored in a grid for a given aspect preview.
*/
public static long getEssentiaAmount(IAEItemStack stack, IGrid grid) {
if (ModAndClassUtil.ThE) {
return getEssentiaAmountImpl(stack, grid);
} else {
return 0;
}
}
@Method(modid = "thaumicenergistics")
private static long getEssentiaAmountImpl(IAEItemStack stack, IGrid grid) {
Aspect aspect = getAspect(stack.getItemStack());
if (aspect == null) return 0;
IEssentiaGrid essentiaGrid = grid.getCache(IEssentiaGrid.class);
return essentiaGrid.getEssentiaAmount(aspect);
}
}
@@ -48,11 +48,11 @@ public class Tooltip {
public static String partFluidTerminalFluidFormat(FluidStack fs) {
int fid = Util.getFluidID(fs.getFluid());
if (fid == -1) {
return fs.getFluid().getLocalizedName();
return fs.getLocalizedName();
} else if (Minecraft.getMinecraft().gameSettings.advancedItemTooltips) {
return String.format("%s (#%s) %s", fs.getFluid().getLocalizedName(), fid, fid);
return String.format("%s (#%s) %s", fs.getLocalizedName(), fid, fid);
} else {
return String.format("%s %s", fs.getFluid().getLocalizedName(), fid);
return String.format("%s %s", fs.getLocalizedName(), fid);
}
}
}
@@ -28,7 +28,7 @@ public class FluidInvWailaDataProvider extends BasePartWailaDataProvider {
for (int i = 0; i < fluidInventory.getSlots(); i++) {
FluidStack fs = fluidInventory.getFluidStackInSlot(i);
if (fs == null) continue;
currentToolTip.add(Tooltip.fluidFormat(fs.getFluid().getLocalizedName(), fs.amount));
currentToolTip.add(Tooltip.fluidFormat(fs.getLocalizedName(), fs.amount));
}
}
return currentToolTip;
@@ -27,7 +27,9 @@ public class FluidMonitorWailaDataProvider extends BasePartWailaDataProvider {
if (part instanceof FCPartMonitor && accessor.getNBTData().hasKey(key)) {
IAEFluidStack iaeFluidStack = Util.loadFluidStackFromNBT(accessor.getNBTData().getCompoundTag(key));
if (iaeFluidStack != null) currentToolTip.add(
Tooltip.fluidFormat(iaeFluidStack.getFluid().getLocalizedName(), iaeFluidStack.getStackSize()));
Tooltip.fluidFormat(
iaeFluidStack.getFluidStack().getLocalizedName(),
iaeFluidStack.getStackSize()));
}
return currentToolTip;
}
@@ -41,7 +41,7 @@ public class FluidInvWailaDataProvider extends BaseWailaDataProvider {
ItemStack is = inv.getStackInSlot(i);
if (is != null && is.getItem() instanceof ItemFluidPacket) {
FluidStack fs = ItemFluidPacket.getFluidStack(is);
currentToolTip.add(Tooltip.fluidFormat(fs.getFluid().getLocalizedName(), fs.amount));
currentToolTip.add(Tooltip.fluidFormat(fs.getLocalizedName(), fs.amount));
}
}
}
@@ -53,9 +53,9 @@ public class FluidInvWailaDataProvider extends BaseWailaDataProvider {
if (ft.getFluidInSlot(i) == null) continue;
FluidStack fs = ft.getFluidInSlot(i).getFluidStack();
if (prefix) {
currentToolTip.add(Tooltip.tileFluidInterfaceFormat(fs.getFluid().getLocalizedName(), fs.amount, i));
currentToolTip.add(Tooltip.tileFluidInterfaceFormat(fs.getLocalizedName(), fs.amount, i));
} else {
currentToolTip.add(Tooltip.fluidFormat(fs.getFluid().getLocalizedName(), fs.amount));
currentToolTip.add(Tooltip.fluidFormat(fs.getLocalizedName(), fs.amount));
}
}
}
@@ -0,0 +1,85 @@
package com.glodblock.github.inventory;
import org.jetbrains.annotations.NotNull;
import com.glodblock.github.common.item.ItemFluidDrop;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.me.cache.CraftingGridCache;
public class CraftingGridCacheFluidInventoryProxyCell implements IMEInventoryHandler<IAEFluidStack> {
private final CraftingGridCache inner;
public CraftingGridCacheFluidInventoryProxyCell(final CraftingGridCache craftingGridCache) {
inner = craftingGridCache;
}
@Override
public IAEFluidStack injectItems(IAEFluidStack input, Actionable type, BaseActionSource src) {
return ItemFluidDrop
.getAeFluidStack((IAEItemStack) inner.injectItems(ItemFluidDrop.newAeStack(input), type, src));
}
@Override
public IAEFluidStack extractItems(IAEFluidStack request, Actionable mode, BaseActionSource src) {
return null;
}
@Override
public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out, int iteration) {
return out;
}
@Override
public IAEFluidStack getAvailableItem(@NotNull IAEFluidStack request, int iteration) {
return null;
}
@Override
public StorageChannel getChannel() {
return StorageChannel.FLUIDS;
}
@Override
public AccessRestriction getAccess() {
return inner.getAccess();
}
@Override
public boolean isPrioritized(IAEFluidStack input) {
return inner.isPrioritized(input);
}
@Override
public boolean canAccept(IAEFluidStack input) {
return inner.canAccept(ItemFluidDrop.newAeStack(input));
}
@Override
public int getPriority() {
return inner.getPriority();
}
@Override
public int getSlot() {
return inner.getSlot();
}
@Override
public boolean validForPass(int i) {
return inner.validForPass(i);
}
@Override
public boolean isAutoCraftingInventory() {
return inner.isAutoCraftingInventory();
}
}
@@ -18,6 +18,7 @@ import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.common.parts.PartFluidExportBus;
import com.glodblock.github.common.parts.PartFluidInterface;
@@ -43,7 +44,9 @@ import appeng.util.InventoryAdaptor;
import appeng.util.inv.IInventoryDestination;
import appeng.util.inv.ItemSlot;
import cofh.api.transport.IItemDuct;
import crazypants.enderio.conduit.ConnectionMode;
import crazypants.enderio.conduit.item.IItemConduit;
import crazypants.enderio.conduit.liquid.ILiquidConduit;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaPipeEntity;
@@ -98,11 +101,19 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
|| Util.getPart(inter, face.getOpposite()) instanceof PartFluidExportBus
|| Util.getPart(inter, face.getOpposite()) instanceof PartFluidP2PInterface))
return InventoryAdaptor.getAdaptor(capProvider, face);
if (InventoryAdaptor.getAdaptor(capProvider, face) == null
&& !(ModAndClassUtil.EIO && capProvider instanceof IItemDuct)) {
if (capProvider instanceof IFluidHandler tank) {
if (tank.getTankInfo(face) == null || !(tank.getTankInfo(face).length > 0)) return null;
} else {
return null;
}
}
InventoryAdaptor item = InventoryAdaptor.getAdaptor(capProvider, face);
IFluidHandler fluid = capProvider instanceof IFluidHandler ? (IFluidHandler) capProvider : null;
boolean onmi = false;
if (inter instanceof TileInterface) {
onmi = ((TileInterface) inter).getTargets().size() > 1;
if (inter instanceof TileInterface in) {
onmi = in.getTargets().size() > 1;
}
return new FluidConvertingInventoryAdaptor(capProvider, item, fluid, face, new BlockPos(inter), onmi);
}
@@ -118,7 +129,7 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
if (fluid != null) {
int filled = fillSideFluid(fluid, this.invFluids, this.side, true);
fluid.amount -= filled;
return ItemFluidPacket.newStack(fluid);
return ItemFluidDrop.newStack(fluid);
} else {
ItemStack notFilled = fillSideItem(toBeAdded, this.invItems, insertionMode, true);
if (notFilled != null) {
@@ -265,14 +276,19 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
boolean anyValid = false;
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
// Avoid sending stuff into itself me network
if (checkValidSide(this.posInterface.getOffSet(dir).getTileEntity(), dir)
&& !isItemConduit(this.posInterface.getOffSet(dir).getTileEntity())) {
final int result = checkItemFluids(this.getSideFluid(dir), this.getSideItem(dir), dir.getOpposite());
if (result == 1) {
return true;
}
if (result != 2) {
anyValid = true;
TileEntity te = this.posInterface.getOffSet(dir).getTileEntity();
if (te != null && checkValidSide(te, dir)) {
if (!isConduit(te) || (!isItemConduit(te) && isFluidConduitConnected(te, dir))) {
final int result = checkItemFluids(
this.getSideFluid(dir),
this.getSideItem(dir),
dir.getOpposite());
if (result == 1) {
return true;
}
if (result != 2) {
anyValid = true;
}
}
}
}
@@ -347,8 +363,18 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
return false;
}
private boolean isFluidConduitConnected(TileEntity te, ForgeDirection dir) {
try {
ILiquidConduit liquidConduit = (ILiquidConduit) eioTypeCheck.invoke(te, ILiquidConduit.class);
return liquidConduit != null
&& liquidConduit.getConnectionMode(dir.getOpposite()) != ConnectionMode.DISABLED;
} catch (IllegalAccessException | InvocationTargetException e) {
return false;
}
}
private boolean isItemConduit(TileEntity te) {
if (ModAndClassUtil.EIO && conduitClazz.isInstance(te)) {
if (isConduit(te)) {
try {
return eioTypeCheck.invoke(te, IItemConduit.class) != null;
} catch (InvocationTargetException | IllegalAccessException e) {
@@ -359,7 +385,7 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
}
private boolean isConduit(TileEntity te) {
return ModAndClassUtil.EIO && te instanceof IItemDuct;
return ModAndClassUtil.EIO && conduitClazz.isInstance(te);
}
private ItemStack fillEIOConduit(ItemStack item, TileEntity te, ForgeDirection direction) {
@@ -32,7 +32,9 @@ public class ItemBiggerAppEngInventory extends BiggerAppEngInventory {
boolean isCraft = Platform.openNbtData(is).getBoolean("craftingMode");
boolean isCraftingTerm = Platform.openNbtData(is).getString("mode_main")
.equals(GuiType.WIRELESS_CRAFTING_TERMINAL.toString());
if (!isCraftingTerm && isCraft) {
boolean isExPattern = Platform.openNbtData(is).getString("mode_main")
.equals(GuiType.WIRELESS_FLUID_PATTERN_TERMINAL_EX.toString());
if (!isCraftingTerm && !isExPattern && isCraft) {
for (int x = 0; x < this.getSizeInventory(); x++) {
final ItemStack is = this.getStackInSlot(x);
if (is != null) {
@@ -1,14 +1,18 @@
package com.glodblock.github.inventory;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.annotation.Nonnull;
import net.minecraft.event.ClickEvent;
import net.minecraft.event.HoverEvent;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
@@ -25,10 +29,13 @@ import appeng.api.storage.IMEMonitorHandlerReceiver;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IItemList;
import appeng.core.AELog;
import appeng.util.item.AEFluidStack;
public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
private static boolean WrongFluidRemovedWarnIssued = false;
private final IFluidHandler handler;
private final ForgeDirection side;
private IItemList<IAEFluidStack> cache = AEApi.instance().storage().createFluidList();
@@ -57,6 +64,10 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
}
public IAEFluidStack injectItems(IAEFluidStack input, Actionable type, BaseActionSource src) {
if (!this.handler.canFill(this.side, input.getFluid())) {
return input;
}
int filled = this.handler.fill(this.side, input.getFluidStack(), type == Actionable.MODULATE);
if (type == Actionable.MODULATE) {
@@ -73,8 +84,41 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
}
public IAEFluidStack extractItems(IAEFluidStack request, Actionable type, BaseActionSource src) {
if (!this.handler.canDrain(this.side, request.getFluid())) {
return null;
}
FluidStack removed = this.handler.drain(this.side, request.getFluidStack(), type == Actionable.MODULATE);
if (removed != null && removed.amount != 0) {
// perform a one time log if the removed fluid isn't what's reported since this will create a dupe exploit
if (!WrongFluidRemovedWarnIssued && !removed.isFluidEqual(request.getFluidStack())) {
WrongFluidRemovedWarnIssued = true;
String issuesUrl = "https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/new";
String msg = String.format(
"[AE2FC] MEMonitorIFluidHandler.extractItems got the wrong fluids while extracting from %s. expected %s got %s. Please report this message if seen: ",
this.handler.getClass().getSimpleName(),
request.getFluidStack().getUnlocalizedName(),
removed.getUnlocalizedName());
// elevate log to error if chat msg is removed to make it easier to find.
AELog.warn(msg + issuesUrl);
ChatComponentText chatTxt = new ChatComponentText(msg);
chatTxt.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED).setBold(true));
ChatComponentText chatUrl = new ChatComponentText(issuesUrl);
chatUrl.setChatStyle(
new ChatStyle().setUnderlined(true)
.setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, issuesUrl))
.setChatHoverEvent(
new HoverEvent(
HoverEvent.Action.SHOW_TEXT,
new ChatComponentText("Click to open link"))));
ChatComponentText chat = new ChatComponentText("");
chat.appendSibling(chatTxt);
chat.appendSibling(chatUrl);
MinecraftServer.getServer().getConfigurationManager().sendChatMsg(chat);
}
IAEFluidStack o = request.copy();
o.setStackSize(removed.amount);
if (type == Actionable.MODULATE) {
@@ -98,8 +142,6 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
// *Decompiled Stuff*//
public TickRateModulation onTick() {
boolean changed = false;
List<IAEFluidStack> changes = new ArrayList<>();
FluidTankInfo[] tankProperties = this.handler.getTankInfo(this.side);
IItemList<IAEFluidStack> currentlyOnStorage = AEApi.instance().storage().createFluidList();
@@ -111,46 +153,42 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
}
}
Iterator<?> var9 = this.cache.iterator();
IAEFluidStack is;
while (var9.hasNext()) {
is = (IAEFluidStack) var9.next();
is.setStackSize(-is.getStackSize());
// make diff between cache and new contents
IItemList<IAEFluidStack> changes = AEApi.instance().storage().createFluidList();
// using non-enhanced for to prevent concurrency errors
for (Iterator<IAEFluidStack> iter = this.cache.iterator(); iter.hasNext();) {
IAEFluidStack copy = iter.next().copy();
copy.setStackSize(-copy.getStackSize());
changes.add(copy);
}
var9 = currentlyOnStorage.iterator();
while (var9.hasNext()) {
is = (IAEFluidStack) var9.next();
this.cache.add(is);
for (IAEFluidStack is : currentlyOnStorage) {
changes.add(is);
}
var9 = this.cache.iterator();
while (var9.hasNext()) {
is = (IAEFluidStack) var9.next();
if (is.getStackSize() != 0L) {
changes.add(is);
// update cache as soon as possible
this.cache = currentlyOnStorage;
// remove unchanged values
for (Iterator<IAEFluidStack> iter = changes.iterator(); iter.hasNext();) {
if (iter.next().getStackSize() == 0L) {
iter.remove();
}
}
this.cache = currentlyOnStorage;
if (!changes.isEmpty()) {
this.postDifference(changes);
changed = true;
return TickRateModulation.URGENT;
}
return changed ? TickRateModulation.URGENT : TickRateModulation.SLOWER;
return TickRateModulation.SLOWER;
}
private void postDifference(Iterable<IAEFluidStack> a) {
if (a != null) {
Iterator<?> i = this.listeners.entrySet().iterator();
Iterator<Map.Entry<IMEMonitorHandlerReceiver<IAEFluidStack>, Object>> i = this.listeners.entrySet()
.iterator();
while (i.hasNext()) {
Map.Entry<IMEMonitorHandlerReceiver<IAEFluidStack>, Object> l = (Map.Entry) i.next();
IMEMonitorHandlerReceiver key = l.getKey();
Map.Entry<IMEMonitorHandlerReceiver<IAEFluidStack>, Object> l = i.next();
IMEMonitorHandlerReceiver<IAEFluidStack> key = l.getKey();
if (key.isValid(l.getValue())) {
key.postChange(this, a, this.getActionSource());
} else {
@@ -184,7 +222,7 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
return true;
}
public IItemList<IAEFluidStack> getAvailableItems(IItemList out) {
public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out, int iteration) {
for (IAEFluidStack fs : this.cache) {
out.addStorage(fs);
@@ -194,7 +232,7 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
}
@Override
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request) {
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request, int iteration) {
return this.cache.findPrecise(request);
}
@@ -202,10 +240,6 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
return this.cache;
}
private StorageFilter getMode() {
return this.mode;
}
public void setMode(StorageFilter mode) {
this.mode = mode;
}
@@ -34,6 +34,8 @@ import com.glodblock.github.client.gui.GuiLevelMaintainer;
import com.glodblock.github.client.gui.GuiLevelTerminal;
import com.glodblock.github.client.gui.GuiLevelWireless;
import com.glodblock.github.client.gui.GuiOCPatternEditor;
import com.glodblock.github.client.gui.GuiPatternItemRenamer;
import com.glodblock.github.client.gui.GuiPatternMulti;
import com.glodblock.github.client.gui.GuiPatternValueAmount;
import com.glodblock.github.client.gui.GuiRenamer;
import com.glodblock.github.client.gui.container.ContainerCraftingWireless;
@@ -61,6 +63,7 @@ import com.glodblock.github.client.gui.container.ContainerLevelMaintainer;
import com.glodblock.github.client.gui.container.ContainerLevelTerminal;
import com.glodblock.github.client.gui.container.ContainerLevelWireless;
import com.glodblock.github.client.gui.container.ContainerOCPatternEditor;
import com.glodblock.github.client.gui.container.ContainerPatternMulti;
import com.glodblock.github.client.gui.container.ContainerPatternValueAmount;
import com.glodblock.github.client.gui.container.ContainerRenamer;
import com.glodblock.github.common.parts.PartFluidLevelEmitter;
@@ -82,6 +85,7 @@ import com.google.common.collect.ImmutableList;
import appeng.api.storage.ITerminalHost;
import appeng.container.implementations.ContainerCraftAmount;
import appeng.container.implementations.ContainerCraftingStatus;
import appeng.container.implementations.ContainerPatternItemRenamer;
import appeng.container.implementations.ContainerPriority;
import appeng.helpers.IInterfaceHost;
import appeng.helpers.IPriorityHost;
@@ -512,6 +516,32 @@ public enum GuiType {
protected Object createClientGui(EntityPlayer player, ITerminalHost inv) {
return new GuiPatternValueAmount(player.inventory, inv);
}
}),
GUI_PATTERN_MULTI(new PartOrItemGuiFactory<>(ITerminalHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
return new ContainerPatternMulti(player.inventory, inv);
}
@Override
protected Object createClientGui(EntityPlayer player, ITerminalHost inv) {
return new GuiPatternMulti(player.inventory, inv);
}
}),
GUI_PATTERN_ITEM_RENAMER(new PartOrItemGuiFactory<>(ITerminalHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
return new ContainerPatternItemRenamer(player.inventory, inv);
}
@Override
protected Object createClientGui(EntityPlayer player, ITerminalHost inv) {
return new GuiPatternItemRenamer(player.inventory, inv);
}
});
public static final List<GuiType> VALUES = ImmutableList.copyOf(values());
@@ -44,7 +44,7 @@ public class MouseRegionManager {
if (region.containsMouse(mX, mY)) {
List<String> tooltip = region.handler.getTooltip();
if (tooltip != null) {
((AEBaseGui) gui).drawTooltip(mX, mY, 0, String.join("\n", tooltip));
((AEBaseGui) gui).drawTooltip(mX, mY, String.join("\n", tooltip));
return;
}
}
@@ -13,6 +13,7 @@ import com.glodblock.github.network.CPacketFluidUpdate;
import com.glodblock.github.network.CPacketInventoryAction;
import com.glodblock.github.network.CPacketLevelMaintainer;
import com.glodblock.github.network.CPacketLevelTerminalCommands;
import com.glodblock.github.network.CPacketPatternMultiSet;
import com.glodblock.github.network.CPacketPatternValueSet;
import com.glodblock.github.network.CPacketRenamer;
import com.glodblock.github.network.CPacketSwitchGuis;
@@ -22,6 +23,7 @@ import com.glodblock.github.network.SPacketFluidUpdate;
import com.glodblock.github.network.SPacketLevelTerminalUpdate;
import com.glodblock.github.network.SPacketMEFluidInvUpdate;
import com.glodblock.github.network.SPacketMEItemInvUpdate;
import com.glodblock.github.network.SPacketPatternItemRenamer;
import com.glodblock.github.network.SPacketSetItemAmount;
import com.glodblock.github.network.SPacketStringUpdate;
import com.glodblock.github.network.SPacketSwitchBack;
@@ -78,6 +80,13 @@ public class ChannelLoader implements Runnable {
CPacketLevelTerminalCommands.class,
id++,
Side.SERVER);
netHandler
.registerMessage(new CPacketPatternMultiSet.Handler(), CPacketPatternMultiSet.class, id++, Side.SERVER);
netHandler.registerMessage(
new SPacketPatternItemRenamer.Handler(),
SPacketPatternItemRenamer.class,
id++,
Side.SERVER);
}
public static void sendPacketToAllPlayers(Packet packet, World world) {
@@ -18,6 +18,7 @@ import com.glodblock.github.common.block.BlockWalrus;
import com.glodblock.github.common.item.ItemBasicFluidStorageCell;
import com.glodblock.github.common.item.ItemBasicFluidStoragePart;
import com.glodblock.github.common.item.ItemCreativeFluidStorageCell;
import com.glodblock.github.common.item.ItemEnergyCard;
import com.glodblock.github.common.item.ItemFluidConversionMonitor;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.item.ItemFluidEncodedPattern;
@@ -28,6 +29,8 @@ import com.glodblock.github.common.item.ItemFluidLevelEmitter;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.common.item.ItemFluidStorageHousing;
import com.glodblock.github.common.item.ItemFluidStorageMonitor;
import com.glodblock.github.common.item.ItemFluidVoidStorageCell;
import com.glodblock.github.common.item.ItemInfinityWaterStorageCell;
import com.glodblock.github.common.item.ItemMultiFluidStorageCell;
import com.glodblock.github.common.item.ItemPartFluidInterface;
import com.glodblock.github.common.item.ItemPartFluidP2PInterface;
@@ -37,6 +40,7 @@ import com.glodblock.github.common.item.ItemPartFluidStorageBus;
import com.glodblock.github.common.item.ItemPartFluidTerminal;
import com.glodblock.github.common.item.ItemPartLevelTerminal;
import com.glodblock.github.common.item.ItemPortableFluidCell;
import com.glodblock.github.common.item.ItemQuantumBridgeCard;
import com.glodblock.github.common.item.ItemWirelessFluidTerminal;
import com.glodblock.github.common.item.ItemWirelessInterfaceTerminal;
import com.glodblock.github.common.item.ItemWirelessLevelTerminal;
@@ -131,10 +135,21 @@ public class ItemAndBlockHolder {
8,
1,
5).register();
public static ItemFluidExtremeStorageCell ARTIFICIAL_UNIVERSE_CELL = new ItemFluidExtremeStorageCell(
NameConst.ITEM_ARTIFICIAL_UNIVERSE_STORAGE,
Long.MAX_VALUE / 2048,
16384,
5,
600000D).register();
public static ItemFluidVoidStorageCell FLUID_VOID_CELL = new ItemFluidVoidStorageCell().register();
public static ItemCreativeFluidStorageCell CREATIVE_CELL = new ItemCreativeFluidStorageCell().register();
public static ItemInfinityWaterStorageCell INFINITY_WATER_CELL = new ItemInfinityWaterStorageCell().register();
public static ItemBasicFluidStoragePart CELL_PART = new ItemBasicFluidStoragePart().register();
public static ItemFluidStorageHousing CELL_HOUSING = new ItemFluidStorageHousing().register();
public static ItemEnergyCard ENERGY_CARD = new ItemEnergyCard().register();
public static ItemQuantumBridgeCard QUANTUM_BRIDGE_CARD = new ItemQuantumBridgeCard().register();
public static void loadSetting() {
if (!Config.fluidCells) return;
CellType.Cell1kPart.setItemInstance(CELL_PART);
@@ -30,21 +30,34 @@ public class KeybindLoader implements Runnable {
FMLCommonHandler.instance().bus().register(this);
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
if (openTerminal.isPressed()) {
handleOpenTerminalKey();
}
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onMouseInput(InputEvent.MouseInputEvent event) {
if (openTerminal.isPressed()) {
handleOpenTerminalKey();
}
}
private void handleOpenTerminalKey() {
if (Minecraft.getMinecraft().currentScreen != null) return;
EntityClientPlayerMP p = Minecraft.getMinecraft().thePlayer;
if (p.openContainer == null) {
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
if (player.openContainer == null) {
return;
}
if (openTerminal.isPressed()) {
ImmutablePair<Integer, ItemStack> term = Util.getUltraWirelessTerm(p);
if (term != null && term.getRight().getItem() instanceof ItemWirelessUltraTerminal) {
ItemWirelessUltraTerminal.switchTerminal(
p,
((ItemWirelessUltraTerminal) term.getRight().getItem()).guiGuiType(term.getRight()));
}
ImmutablePair<Integer, ItemStack> term = Util.getUltraWirelessTerm(player);
if (term != null && term.getRight().getItem() instanceof ItemWirelessUltraTerminal) {
ItemWirelessUltraTerminal.switchTerminal(
player,
((ItemWirelessUltraTerminal) term.getRight().getItem()).guiGuiType(term.getRight()));
}
}
}
@@ -1,6 +1,7 @@
package com.glodblock.github.loader;
import static com.glodblock.github.common.storage.CellType.Cell16384kPart;
import static com.glodblock.github.loader.ItemAndBlockHolder.ARTIFICIAL_UNIVERSE_CELL;
import static com.glodblock.github.loader.ItemAndBlockHolder.BUFFER;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL1024K;
import static com.glodblock.github.loader.ItemAndBlockHolder.CELL1024KM;
@@ -23,6 +24,7 @@ import static com.glodblock.github.loader.ItemAndBlockHolder.CERTUS_QUARTZ_TANK;
import static com.glodblock.github.loader.ItemAndBlockHolder.DECODER;
import static com.glodblock.github.loader.ItemAndBlockHolder.DISCRETIZER;
import static com.glodblock.github.loader.ItemAndBlockHolder.ENCODER;
import static com.glodblock.github.loader.ItemAndBlockHolder.ENERGY_CARD;
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_AUTO_FILLER;
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_BUFFER;
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_CONVERSION_MONITOR;
@@ -36,6 +38,8 @@ import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_STORAGE_MONIT
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_TERM;
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_TERMINAL;
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_TERMINAL_EX;
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_VOID_CELL;
import static com.glodblock.github.loader.ItemAndBlockHolder.INFINITY_WATER_CELL;
import static com.glodblock.github.loader.ItemAndBlockHolder.INTERFACE;
import static com.glodblock.github.loader.ItemAndBlockHolder.LARGE_BUFFER;
import static com.glodblock.github.loader.ItemAndBlockHolder.LEVEL_MAINTAINER;
@@ -43,6 +47,7 @@ import static com.glodblock.github.loader.ItemAndBlockHolder.LEVEL_TERMINAL;
import static com.glodblock.github.loader.ItemAndBlockHolder.OC_EDITOR;
import static com.glodblock.github.loader.ItemAndBlockHolder.PATTERN;
import static com.glodblock.github.loader.ItemAndBlockHolder.PORTABLE_FLUID_CELL;
import static com.glodblock.github.loader.ItemAndBlockHolder.QUANTUM_BRIDGE_CARD;
import static com.glodblock.github.loader.ItemAndBlockHolder.QUANTUM_CELL;
import static com.glodblock.github.loader.ItemAndBlockHolder.SINGULARITY_CELL;
import static com.glodblock.github.loader.ItemAndBlockHolder.WALRUS;
@@ -67,6 +72,9 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.item.FCBaseItemCell;
import com.glodblock.github.common.storage.CellType;
import com.glodblock.github.loader.recipe.DisassembleRecipe;
import com.glodblock.github.loader.recipe.WirelessTerminalEnergyRecipe;
import com.glodblock.github.loader.recipe.WirelessTerminalQuantumBridgeRecipe;
import com.glodblock.github.loader.recipe.WirelessTerminalRecipe;
import com.glodblock.github.util.ModAndClassUtil;
@@ -163,12 +171,37 @@ public class RecipeLoader implements Runnable {
.findItemStack("appliedenergistics2", "tile.BlockQuantumRing", 1);
public static final ItemStack AE2_DENSE_ENERGY_CELL = GameRegistry
.findItemStack("appliedenergistics2", "tile.BlockDenseEnergyCell", 1);
public static final ItemStack AE2_ANNIHILATION_CORE = new ItemStack(
GameRegistry.findItem("appliedenergistics2", "item.ItemMultiMaterial"),
1,
44);
public static final ItemStack AE2_FORMATION_CORE = new ItemStack(
GameRegistry.findItem("appliedenergistics2", "item.ItemMultiMaterial"),
1,
43);
public static final ItemStack THE_WIRELESS_TERM = GameRegistry
.findItemStack("thaumicenergistics", "wireless.essentia.terminal", 1);
private static final ItemStack WCT_WIRELESS_TERM = GameRegistry
.findItemStack("ae2wct", "wirelessCraftingTerminal", 1);
public static final ItemStack BUCKET = new ItemStack(Items.bucket, 1);
public static final ItemStack IRON_BAR = new ItemStack(Blocks.iron_bars, 1);
public static final ItemStack AE2_ADVANCED_CARD = new ItemStack(
GameRegistry.findItem("appliedenergistics2", "item.ItemMultiMaterial"),
1,
28);
public static final ItemStack AE2_WIRELESS_RECEIVER = new ItemStack(
GameRegistry.findItem("appliedenergistics2", "item.ItemMultiMaterial"),
1,
41);
public static final ItemStack AE2_BLOCK_CHARGER = GameRegistry
.findItemStack("appliedenergistics2", "tile.BlockCharger", 1);
public static final ItemStack AE2_SINGULARITY = new ItemStack(
GameRegistry.findItem("appliedenergistics2", "item.ItemMultiMaterial"),
1,
47);
public static final ItemStack NETHER_STAR = new ItemStack(Items.nether_star, 1);
public static final ItemStack WATER_BUCKET = new ItemStack(Items.water_bucket, 1);
@Override
public void run() {
@@ -475,6 +508,32 @@ public class RecipeLoader implements Runnable {
QUANTUM_CELL,
'M',
AE2_MATTER_CONDENSER));
GameRegistry.addRecipe(
new ShapedOreRecipe(
ARTIFICIAL_UNIVERSE_CELL,
"SCS",
"CNC",
"SCS",
'S',
AE2_SINGULARITY,
'C',
SINGULARITY_CELL,
'N',
NETHER_STAR));
GameRegistry.addRecipe(
new ShapedOreRecipe(
FLUID_VOID_CELL,
"ABA",
"BDB",
"CCC",
'A',
AE2_QUARTZ_GLASS,
'B',
"dustGlowstone",
'C',
"gemDiamond",
'D',
AE2_SINGULARITY));
for (FCBaseItemCell cell : cells) {
if (cell.getHousing().getItemDamage() == 0) {
GameRegistry.addRecipe(
@@ -639,13 +698,70 @@ public class RecipeLoader implements Runnable {
}
}
public static void addTerminalCards() {
GameRegistry.addRecipe(
new ShapedOreRecipe(
ENERGY_CARD.stack(),
"DSD",
"HAH",
"DSD",
'H',
AE2_BLOCK_CHARGER,
'D',
AE2_DENSE_ENERGY_CELL,
'A',
AE2_ADVANCED_CARD,
'S',
AE2_SINGULARITY));
GameRegistry.addRecipe(
new ShapedOreRecipe(
QUANTUM_BRIDGE_CARD.stack(),
"QSQ",
"WAW",
"QSQ",
'Q',
AE2_QUANTUM_RING,
'A',
AE2_ADVANCED_CARD,
'S',
NETHER_STAR,
'W',
AE2_WIRELESS_RECEIVER));
}
public static void addInfiniteWaterCell() {
GameRegistry.addRecipe(
new ShapedOreRecipe(
INFINITY_WATER_CELL,
"BKB",
"ACF",
"BMB",
'B',
WATER_BUCKET,
'K',
CellType.Cell64kPart.stack(1),
'A',
AE2_ANNIHILATION_CORE,
'C',
CELL_HOUSING.stack(1, 1),
'F',
AE2_FORMATION_CORE,
'M',
AE2_MATTER_CONDENSER));
}
public static void runTerminalRecipe() {
if (ModAndClassUtil.WCT) {
GameRegistry.addRecipe(new WirelessTerminalRecipe(WIRELESS_PATTERN_TERM.stack()));
GameRegistry.addRecipe(new WirelessTerminalRecipe(WIRELESS_FLUID_TERM.stack()));
GameRegistry.addRecipe(new WirelessTerminalRecipe(WIRELESS_ULTRA_TERM.stack()));
GameRegistry.addRecipe(new WirelessTerminalRecipe(WIRELESS_INTERFACE_TERM.stack()));
GameRegistry.addRecipe(new WirelessTerminalRecipe(WIRELESS_LEVEL_TERM.stack()));
ItemStack[] fc2Terms = { WIRELESS_ULTRA_TERM.stack(), WIRELESS_FLUID_TERM.stack(),
WIRELESS_PATTERN_TERM.stack(), WIRELESS_INTERFACE_TERM.stack(), WIRELESS_LEVEL_TERM.stack() };
for (ItemStack fc2term : fc2Terms) {
if (fc2term != null) {
if (ModAndClassUtil.WCT) { // deprecated, adding Infinity Booster Card from WCT mod
GameRegistry.addRecipe(new WirelessTerminalRecipe(fc2term));
}
GameRegistry.addRecipe(new WirelessTerminalQuantumBridgeRecipe(fc2term));
GameRegistry.addRecipe(new WirelessTerminalEnergyRecipe(fc2term));
}
}
ItemStack[] term = { AE2_WIRELESS_TERMINAL, WIRELESS_FLUID_TERM.stack(), WIRELESS_PATTERN_TERM.stack(),
@@ -655,4 +771,8 @@ public class RecipeLoader implements Runnable {
Arrays.stream(term).filter(Objects::nonNull).toArray());
}
public static void addDisassembleRecipe() {
GameRegistry.addRecipe(new DisassembleRecipe());
}
}
@@ -24,6 +24,7 @@ public class FluidFilter {
case FLUIDS -> {
return item instanceof ItemFluidDrop;
}
default -> {}
}
}
}
Loaded 100 of 138 files, more files were not shown because too many files have changed in this diff. Show more