mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-23 13:30:04 +00:00
Compare commits
176
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
607de4dd5e | ||
|
|
187f3cd80e | ||
|
|
396d249b56 | ||
|
|
9a8c4bff08 | ||
|
|
55717f953d | ||
|
|
e480dd8d4d | ||
|
|
5907154d8e | ||
|
|
5092dcc3d3 | ||
|
|
d8de0e8f27 | ||
|
|
03538d3338 | ||
|
|
b84ed01a02 | ||
|
|
6acffd220e | ||
|
|
8d9a9c7e8c | ||
|
|
0f9796b73c | ||
|
|
be3bfd32dd | ||
|
|
effe45544d | ||
|
|
954f5eec37 | ||
|
|
319dcc95df | ||
|
|
b663d87801 | ||
|
|
bd128f59db | ||
|
|
e187ef370e | ||
|
|
36644fa59a | ||
|
|
43b3b619e8 | ||
|
|
0df88f2305 | ||
|
|
29b000ff59 | ||
|
|
6cdc253867 | ||
|
|
3f3be51fc4 | ||
|
|
c74d7cabd3 | ||
|
|
504dfb51af | ||
|
|
4a39cf4ece | ||
|
|
94be0bc52c | ||
|
|
24b2e0a20b | ||
|
|
9d8447c002 | ||
|
|
486bd52417 | ||
|
|
e0aed44bcf | ||
|
|
ff70fc4264 | ||
|
|
2876db6772 | ||
|
|
51d6de3242 | ||
|
|
55f48a98f4 | ||
|
|
d85e09dda3 | ||
|
|
d7e034dcf7 | ||
|
|
30c3ab100d | ||
|
|
d0005adcf8 | ||
|
|
71d820eacb | ||
|
|
02ee43b04e | ||
|
|
170bf2099a | ||
|
|
8b1dff3f21 | ||
|
|
0e9652af56 | ||
|
|
be6dfac4d0 | ||
|
|
9fb8baef7b | ||
|
|
3314e31bdc | ||
|
|
0cd4f49d50 | ||
|
|
e9804a1538 | ||
|
|
adc2a1f2fd | ||
|
|
8a37e085c1 | ||
|
|
b6b03cfbd8 | ||
|
|
8b4ab1ba61 | ||
|
|
e48073976d | ||
|
|
d699539bd0 | ||
|
|
91542f3d68 | ||
|
|
12ebe0b55a | ||
|
|
311210fc4a | ||
|
|
b09615f982 | ||
|
|
25133d8c3f | ||
|
|
dbbdf72230 | ||
|
|
25da378a51 | ||
|
|
f8e7aba55a | ||
|
|
d68adac1cc | ||
|
|
d411d4f18a | ||
|
|
eda554a200 | ||
|
|
c7f2ea5797 | ||
|
|
e27a8de392 | ||
|
|
9448540466 | ||
|
|
41963430dd | ||
|
|
7deb868713 | ||
|
|
5e723f4813 | ||
|
|
b2e74d8ea0 | ||
|
|
a3eee96d75 | ||
|
|
6bba29a007 | ||
|
|
437bb60af3 | ||
|
|
9ca192722b | ||
|
|
1546f5f505 | ||
|
|
b4bc6fa0ff | ||
|
|
767c6e99da | ||
|
|
c6c5d162a1 | ||
|
|
e09525bc88 | ||
|
|
131747335f | ||
|
|
6f05a1dd42 | ||
|
|
e983a5e87c | ||
|
|
f63435403b | ||
|
|
a0db8e38e6 | ||
|
|
386884ccb0 | ||
|
|
8e62be4638 | ||
|
|
27e0610042 | ||
|
|
fb7508263f | ||
|
|
7a72ee28b3 | ||
|
|
4d5b8d9b47 | ||
|
|
57edd12466 | ||
|
|
a9f2edd488 | ||
|
|
5d2b8eec85 | ||
|
|
402fdedf07 | ||
|
|
08c75f9406 | ||
|
|
f86046081e | ||
|
|
d80127933a | ||
|
|
75c8f55bb9 | ||
|
|
04cd7ed0b2 | ||
|
|
c1c6a03146 | ||
|
|
72ce3a0e2f | ||
|
|
0135a11ea1 | ||
|
|
6fc5951dbc | ||
|
|
afe7338b83 | ||
|
|
f7b15d0283 | ||
|
|
84d5546758 | ||
|
|
90f586e55a | ||
|
|
4ef743bb29 | ||
|
|
7a0656d0c3 | ||
|
|
b9b4211809 | ||
|
|
8dbeee2f53 | ||
|
|
d609bf3651 | ||
|
|
0a03bd99ae | ||
|
|
f7d25c6daa | ||
|
|
f175d70f0c | ||
|
|
958393a4fe | ||
|
|
130626343b | ||
|
|
3d3b842923 | ||
|
|
300f01be8b | ||
|
|
a231e67167 | ||
|
|
960b8b43bf | ||
|
|
9668cffe59 | ||
|
|
b6b110b63d | ||
|
|
8ca32457d0 | ||
|
|
e095a6018a | ||
|
|
29cb32b6ee | ||
|
|
5cc8488928 | ||
|
|
3e6ea173fc | ||
|
|
198f7cb3e8 | ||
|
|
8a179dd206 | ||
|
|
6ebb3220dd | ||
|
|
0caf89e539 | ||
|
|
e3cc9352b1 | ||
|
|
b3e480a6cb | ||
|
|
891fef6585 | ||
|
|
a81841bdfd | ||
|
|
9fc2160965 | ||
|
|
0bf904f2a4 | ||
|
|
6187a7306d | ||
|
|
5b867c531f | ||
|
|
745ef0841f | ||
|
|
7dedef21fe | ||
|
|
20ebc18f6a | ||
|
|
6e96cba6fe | ||
|
|
db8aee2c25 | ||
|
|
90e4eb0366 | ||
|
|
b0a2e6e274 | ||
|
|
e621da2082 | ||
|
|
f7ea2e9243 | ||
|
|
a55e699210 | ||
|
|
1372804bc9 | ||
|
|
4e3c073fef | ||
|
|
9d76815744 | ||
|
|
d790afc047 | ||
|
|
3b1b1af852 | ||
|
|
3077326c16 | ||
|
|
2536488e53 | ||
|
|
6770a9fe6f | ||
|
|
f24694680e | ||
|
|
8db0ea3f34 | ||
|
|
8775fbb9c4 | ||
|
|
7732cebf68 | ||
|
|
79dc0eb5bc | ||
|
|
ef5efd2e8b | ||
|
|
f5912ef2e3 | ||
|
|
1515ebe33f | ||
|
|
567b1dbce5 | ||
|
|
1efa92adad | ||
|
|
bd0e7fabca |
No files matched your search
+35
-6
@@ -1,9 +1,38 @@
|
||||
*.bat
|
||||
.gradle/
|
||||
.idea/
|
||||
out/
|
||||
.gradle
|
||||
.settings
|
||||
/.idea/
|
||||
/.vscode/
|
||||
/run/
|
||||
/build/
|
||||
/eclipse/
|
||||
.classpath
|
||||
.project
|
||||
/bin/
|
||||
/config/
|
||||
/crash-reports/
|
||||
/logs/
|
||||
options.txt
|
||||
/saves/
|
||||
usernamecache.json
|
||||
banned-ips.json
|
||||
banned-players.json
|
||||
eula.txt
|
||||
ops.json
|
||||
server.properties
|
||||
servers.dat
|
||||
usercache.json
|
||||
whitelist.json
|
||||
/out/
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
run/
|
||||
build/
|
||||
src/main/resources/mixins.*([!.]).json
|
||||
*.bat
|
||||
*.DS_Store
|
||||
!gradlew.bat
|
||||
.factorypath
|
||||
addon.local.gradle
|
||||
addon.local.gradle.kts
|
||||
addon.late.local.gradle
|
||||
addon.late.local.gradle.kts
|
||||
layout.json
|
||||
+2
-1621
File diff suppressed because it is too large.
Load diff
+58
-18
@@ -1,25 +1,65 @@
|
||||
// Add your dependencies here
|
||||
|
||||
/*
|
||||
* Add your dependencies here. Supported configurations:
|
||||
* - api("group:name:version:classifier"): if you use the types from this dependency in the public API of this mod
|
||||
* Available at runtime and compiletime for mods depending on this mod
|
||||
* - implementation("g:n:v:c"): if you need this for internal implementation details of the mod, but none of it is visible via the public API
|
||||
* Available at runtime but not compiletime for mods depending on this mod
|
||||
* - compileOnly("g:n:v:c"): if the mod you're building doesn't need this dependency during runtime at all, e.g. for optional mods
|
||||
* Not available at all for mods depending on this mod, only visible at compiletime for this mod
|
||||
* - compileOnlyApi("g:n:v:c"): like compileOnly, but also visible at compiletime for mods depending on this mod
|
||||
* Available at compiletime but not runtime for mods depending on this mod
|
||||
* - runtimeOnlyNonPublishable("g:n:v:c"): if you want to include a mod in this mod's runClient/runServer runs, but not publish it as a dependency
|
||||
* Not available at all for mods depending on this mod, only visible at runtime for this mod
|
||||
* - devOnlyNonPublishable("g:n:v:c"): a combination of runtimeOnlyNonPublishable and compileOnly for dependencies present at both compiletime and runtime,
|
||||
* but not published as Maven dependencies - useful for RFG-deobfuscated dependencies or local testing
|
||||
* - runtimeOnly("g:n:v:c"): if you don't need this at compile time, but want it to be present at runtime
|
||||
* Available at runtime for mods depending on this mod
|
||||
* - annotationProcessor("g:n:v:c"): mostly for java compiler plugins, if you know you need this, use it, otherwise don't worry
|
||||
* - testCONFIG("g:n:v:c") - replace CONFIG by one of the above (except api), same as above but for the test sources instead of main
|
||||
*
|
||||
* - shadowImplementation("g:n:v:c"): effectively the same as API, but the dependency is included in your jar under a renamed package name
|
||||
* Requires you to enable usesShadowedDependencies in gradle.properties
|
||||
*
|
||||
* - compile("g:n:v:c"): deprecated, replace with "api" (works like the old "compile") or "implementation" (can be more efficient)
|
||||
*
|
||||
* You can exclude transitive dependencies (dependencies of the chosen dependency) by appending { transitive = false } if needed,
|
||||
* but use this sparingly as it can break using your mod as another mod's dependency if you're not careful.
|
||||
*
|
||||
* To depend on obfuscated jars you can use `devOnlyNonPublishable(rfg.deobf("dep:spec:1.2.3"))` to fetch an obfuscated jar from maven,
|
||||
* or `devOnlyNonPublishable(rfg.deobf(project.files("libs/my-mod-jar.jar")))` to use a file.
|
||||
*
|
||||
* Gradle names for some of the configuration can be misleading, compileOnlyApi and runtimeOnly both get published as dependencies in Maven, but compileOnly does not.
|
||||
* The buildscript adds runtimeOnlyNonPublishable to also have a runtime dependency that's not published.
|
||||
*
|
||||
* For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph
|
||||
*/
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:NotEnoughItems:2.4.3-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-266-GTNH-pre:dev')
|
||||
api('com.github.GTNewHorizons:NotEnoughItems:2.7.13-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-519-GTNH-pre:dev')
|
||||
api('curse.maven:cofh-core-69162:2388751')
|
||||
api('com.github.GTNewHorizons:waila:1.6.0:dev')
|
||||
api("com.github.GTNewHorizons:WirelessCraftingTerminal:1.10.0:dev")
|
||||
api('com.github.GTNewHorizons:waila:1.8.2:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.6.0:dev")
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:Baubles:1.0.1.16:dev')
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.34:dev') { transitive = false }
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.6.14:dev')
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.5.2:dev')
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.44.36:dev') {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework'
|
||||
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.11.7:dev") {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
|
||||
}
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:GTNHLib:0.6.0:dev") { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.0.3:dev')
|
||||
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.35:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.10.1:dev')
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.9.2:dev')
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.50: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.9.17-GTNH:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.4.13-GTNH:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:GTplusplus:1.10.17:dev') { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.3.9:dev") { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.11.2-GTNH:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.7.2-GTNH:dev') { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.6.13:dev") { transitive = false }
|
||||
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.3.4:dev")
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:0.6.0:dev")
|
||||
}
|
||||
+163
-31
@@ -1,71 +1,203 @@
|
||||
modName = Fluid Craft For AE2
|
||||
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
|
||||
# LOCAL to test local config updates.
|
||||
gtnh.settings.blowdryerTag = 0.2.0
|
||||
|
||||
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
|
||||
# Human-readable mod name, available for mcmod.info population.
|
||||
modName = AE2 Fluid Crafting
|
||||
|
||||
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
|
||||
# Conventionally lowercase.
|
||||
modId = ae2fc
|
||||
|
||||
# Root package of the mod, used to find various classes in other properties,
|
||||
# mcmod.info substitution, enabling assertions in run tasks, etc.
|
||||
modGroup = com.glodblock.github
|
||||
|
||||
# WHY is there no version field?
|
||||
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
|
||||
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
|
||||
# Whether to use modGroup as the maven publishing group.
|
||||
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
|
||||
useModGroupForPublishing = false
|
||||
|
||||
# Will update your build.gradle automatically whenever an update is available
|
||||
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
||||
autoUpdateBuildScript = false
|
||||
|
||||
# Version of Minecraft to target
|
||||
minecraftVersion = 1.7.10
|
||||
|
||||
# Version of Minecraft Forge to target
|
||||
forgeVersion = 10.13.4.1614
|
||||
|
||||
# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name each time you
|
||||
# restart Minecraft in development. Choose this dependent on your mod:
|
||||
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
|
||||
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
|
||||
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
|
||||
channel = stable
|
||||
|
||||
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
|
||||
mappingsVersion = 12
|
||||
|
||||
# Defines other MCP mappings for dependency deobfuscation.
|
||||
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
||||
|
||||
# Select a default username for testing your mod. You can always override this per-run by running
|
||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||
developmentEnvironmentUserName = Developer
|
||||
|
||||
# Enables using modern java syntax (up to version 17) via Jabel, while still targetting JVM 8.
|
||||
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
||||
# See https://github.com/bsideup/jabel for details on how this works.
|
||||
enableModernJavaSyntax = true
|
||||
|
||||
# Define a source file of your project with:
|
||||
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
||||
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||
enableGenericInjection = true
|
||||
|
||||
# Generate a class with a String field for the mod version named as defined below.
|
||||
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
|
||||
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
|
||||
generateGradleTokenClass = com.glodblock.github.FCTags
|
||||
|
||||
# Name of the token containing the project's current version to generate/replace.
|
||||
gradleTokenVersion = VERSION
|
||||
|
||||
# [DEPRECATED] Mod ID replacement token.
|
||||
gradleTokenModId =
|
||||
|
||||
# [DEPRECATED] Mod name replacement token.
|
||||
gradleTokenModName =
|
||||
|
||||
# [DEPRECATED] Mod Group replacement token.
|
||||
gradleTokenGroupName =
|
||||
|
||||
# [DEPRECATED]
|
||||
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
|
||||
# public static final String VERSION = "GRADLETOKEN_VERSION";
|
||||
# The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's
|
||||
# version in @Mod([...], version = VERSION, [...])
|
||||
# Leave these properties empty to skip individual token replacements
|
||||
replaceGradleTokenInFile = FluidCraft.java
|
||||
gradleTokenModId = GRADLETOKEN_MODID
|
||||
gradleTokenModName = GRADLETOKEN_MODNAME
|
||||
gradleTokenVersion = GRADLETOKEN_VERSION
|
||||
gradleTokenGroupName = GRADLETOKEN_GROUPNAME
|
||||
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
|
||||
# version in @Mod([...], version = VERSION, [...]).
|
||||
# Leave these properties empty to skip individual token replacements.
|
||||
replaceGradleTokenInFile =
|
||||
|
||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
||||
# leave this property empty.
|
||||
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
|
||||
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
|
||||
apiPackage = api
|
||||
|
||||
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
|
||||
# Example value: mymodid_at.cfg
|
||||
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
|
||||
# There can be multiple files in a space-separated list.
|
||||
# Example value: mymodid_at.cfg nei_at.cfg
|
||||
accessTransformersFile = ae2fc_at.cfg
|
||||
|
||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||
usesMixins = false
|
||||
|
||||
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
|
||||
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
|
||||
# Mixin classes will have access to "main" classes, but not the other way around.
|
||||
separateMixinSourceSet =
|
||||
|
||||
# Adds some debug arguments like verbose output and class export.
|
||||
usesMixinDebug = false
|
||||
|
||||
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
|
||||
mixinPlugin =
|
||||
|
||||
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
|
||||
mixinsPackage =
|
||||
|
||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||
# This parameter is for legacy compatibility only
|
||||
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
|
||||
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
|
||||
coreModClass = coremod.FluidCraftCore
|
||||
|
||||
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
||||
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||
containsMixinsAndOrCoreModOnly = false
|
||||
|
||||
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
|
||||
# responsibility check the licence and request permission for distribution, if required.
|
||||
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
|
||||
forceEnableMixins = false
|
||||
|
||||
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
|
||||
# responsibility to check the license and request permission for distribution if required.
|
||||
usesShadowedDependencies = false
|
||||
|
||||
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
|
||||
# projects. New projects should not use this parameter.
|
||||
#customArchiveBaseName =
|
||||
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
|
||||
# their own classes, making the minimization unreliable.
|
||||
minimizeShadowedDependencies = true
|
||||
|
||||
# If disabled, won't rename the shadowed classes.
|
||||
relocateShadowedDependencies = true
|
||||
|
||||
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
|
||||
includeWellKnownRepositories = true
|
||||
|
||||
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
|
||||
# list of strings, with the acceptable keys being(case does not matter):
|
||||
# cursemaven
|
||||
# modrinth
|
||||
excludeWellKnownRepositories =
|
||||
|
||||
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
|
||||
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
|
||||
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
|
||||
usesMavenPublishing = true
|
||||
|
||||
# Maven repository to publish the mod to.
|
||||
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
|
||||
|
||||
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
|
||||
#
|
||||
# The project's ID on Modrinth. Can be either the slug or the ID.
|
||||
# Leave this empty if you don't want to publish to Modrinth.
|
||||
modrinthProjectId =
|
||||
|
||||
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
|
||||
# Syntax: scope1-type1:name1;scope2-type2:name2;...
|
||||
# Where scope can be one of [required, optional, incompatible, embedded],
|
||||
# type can be one of [project, version],
|
||||
# and the name is the Modrinth project or version slug/id of the other mod.
|
||||
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
|
||||
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
|
||||
modrinthRelations =
|
||||
|
||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||
#
|
||||
# The project's numeric ID on CurseForge. You can find this in the About Project box.
|
||||
# Leave this empty if you don't want to publish on CurseForge.
|
||||
curseForgeProjectId =
|
||||
|
||||
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||
# Syntax: type1:name1;type2:name2;...
|
||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||
# and the name is the CurseForge project slug of the other mod.
|
||||
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
|
||||
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||
curseForgeRelations =
|
||||
|
||||
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
|
||||
# projects. New projects should not use this parameter.
|
||||
# customArchiveBaseName =
|
||||
|
||||
# Optional parameter to have the build automatically fail if an illegal version is used.
|
||||
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
|
||||
# The check is ONLY performed if the version is a git tag.
|
||||
# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+
|
||||
# versionPattern =
|
||||
|
||||
# Uncomment to prevent the source code from being published.
|
||||
# noPublishedSources = true
|
||||
|
||||
# Uncomment this to disable Spotless checks.
|
||||
# This should only be uncommented to keep it easier to sync with upstream/other forks.
|
||||
# That is, if there is no other active fork/upstream, NEVER change this.
|
||||
# disableSpotless = true
|
||||
|
||||
# Uncomment this to disable Checkstyle checks (currently wildcard import check).
|
||||
# disableCheckstyle = true
|
||||
|
||||
# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
|
||||
# (force use delegated build).
|
||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build.
|
||||
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
|
||||
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
|
||||
# ideaOverrideBuildType = idea
|
||||
|
||||
# Whether IDEA should run spotless checks when pressing the Build button.
|
||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||
# ideaCheckSpotlessOnBuild = true
|
||||
|
||||
# Optional parameter to prevent the source code from being published
|
||||
# noPublishedSources =
|
||||
Vendored
BIN
Binary file not shown.
+2
-1
@@ -1,6 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@@ -55,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@@ -83,7 +85,9 @@ done
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||
' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -130,10 +134,13 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
@@ -141,7 +148,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
@@ -149,7 +156,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC3045
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@@ -198,11 +205,11 @@ fi
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
|
||||
Vendored
+94
@@ -0,0 +1,94 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
+5
-10
@@ -4,10 +4,10 @@ pluginManagement {
|
||||
maven {
|
||||
// RetroFuturaGradle
|
||||
name "GTNH Maven"
|
||||
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||
allowInsecureProtocol = true
|
||||
url "https://nexus.gtnewhorizons.com/repository/public/"
|
||||
mavenContent {
|
||||
includeGroup("com.gtnewhorizons.retrofuturagradle")
|
||||
includeGroup("com.gtnewhorizons")
|
||||
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||
}
|
||||
}
|
||||
gradlePluginPortal()
|
||||
@@ -17,12 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.diffplug.blowdryerSetup' version '1.6.0'
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.30'
|
||||
}
|
||||
|
||||
blowdryerSetup {
|
||||
repoSubfolder 'gtnhShared'
|
||||
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
|
||||
//devLocal '.' // Use this when testing config updates locally
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -57,7 +57,6 @@ public class FluidCraft {
|
||||
|
||||
@Mod.EventHandler
|
||||
public static void init(FMLInitializationEvent event) {
|
||||
ModAndClassUtil.init();
|
||||
if (ModAndClassUtil.OC) {
|
||||
OCDriverInit.run();
|
||||
}
|
||||
@@ -77,6 +76,10 @@ public class FluidCraft {
|
||||
if (!Config.removeRecipe) {
|
||||
RecipeLoader.INSTANCE.run();
|
||||
}
|
||||
if (!ModAndClassUtil.NEW_HORIZONS_CORE_MOD) {
|
||||
RecipeLoader.addTerminalCards();
|
||||
RecipeLoader.addInfiniteWaterCell();
|
||||
}
|
||||
RecipeLoader.runTerminalRecipe();
|
||||
|
||||
if (ModAndClassUtil.isV2) {
|
||||
@@ -89,6 +92,11 @@ public class FluidCraft {
|
||||
proxy.postInit(event);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void onLoadComplete(FMLLoadCompleteEvent event) {
|
||||
proxy.onLoadComplete(event);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void onServerStart(FMLServerStartingEvent event) {
|
||||
SPacketMEUpdateBuffer.init();
|
||||
@@ -106,9 +114,6 @@ public class FluidCraft {
|
||||
}
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void onLoadComplete(FMLLoadCompleteEvent event) {}
|
||||
|
||||
public static ResourceLocation resource(String path) {
|
||||
return new ResourceLocation(MODID, path);
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import com.glodblock.github.client.gui.container.ContainerDualInterface;
|
||||
@@ -17,18 +18,23 @@ import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.config.AdvancedBlockingMode;
|
||||
import appeng.api.config.InsertionMode;
|
||||
import appeng.api.config.LockCraftingMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SidelessMode;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.client.gui.implementations.GuiUpgradeable;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiSimpleImgButton;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.client.gui.widgets.GuiToggleButton;
|
||||
import appeng.container.implementations.ContainerInterface;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketConfigButton;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.helpers.IInterfaceHost;
|
||||
|
||||
public class GuiDualInterface extends GuiUpgradeable {
|
||||
@@ -36,10 +42,14 @@ 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;
|
||||
private GuiSimpleImgButton doublePatterns;
|
||||
private GuiToggleButton patternOptimization;
|
||||
private GuiImgButton advancedBlockingMode;
|
||||
private GuiImgButton lockCraftingMode;
|
||||
private final IInterfaceHost host;
|
||||
|
||||
public GuiDualInterface(InventoryPlayer inventoryPlayer, IInterfaceHost te) {
|
||||
@@ -49,7 +59,6 @@ public class GuiDualInterface extends GuiUpgradeable {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void addButtons() {
|
||||
this.priority = new GuiTabButton(
|
||||
this.guiLeft + 154,
|
||||
@@ -68,41 +77,81 @@ public class GuiDualInterface extends GuiUpgradeable {
|
||||
itemRender);
|
||||
this.buttonList.add(this.switcher);
|
||||
|
||||
this.BlockMode = new GuiImgButton(this.guiLeft - 18, this.guiTop + 8, Settings.BLOCK, YesNo.NO);
|
||||
int offset = 8;
|
||||
|
||||
this.BlockMode = new GuiImgButton(this.guiLeft - 18, this.guiTop + offset, Settings.BLOCK, YesNo.NO);
|
||||
this.buttonList.add(this.BlockMode);
|
||||
|
||||
this.SmartBlockMode = new GuiImgButton(this.guiLeft - 36, this.guiTop + offset, Settings.SMART_BLOCK, YesNo.NO);
|
||||
this.buttonList.add(this.SmartBlockMode);
|
||||
|
||||
offset += 18;
|
||||
|
||||
this.interfaceMode = new GuiToggleButton(
|
||||
this.guiLeft - 18,
|
||||
this.guiTop + 26,
|
||||
this.guiTop + offset,
|
||||
84,
|
||||
85,
|
||||
GuiText.InterfaceTerminal.getLocal(),
|
||||
GuiText.InterfaceTerminalHint.getLocal());
|
||||
this.buttonList.add(this.interfaceMode);
|
||||
|
||||
offset += 18;
|
||||
|
||||
this.insertionMode = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.guiTop + 44,
|
||||
this.guiTop + offset,
|
||||
Settings.INSERTION_MODE,
|
||||
InsertionMode.DEFAULT);
|
||||
this.buttonList.add(this.insertionMode);
|
||||
|
||||
offset += 18;
|
||||
|
||||
this.doublePatterns = new GuiSimpleImgButton(this.guiLeft - 18, this.guiTop + offset, 71, "");
|
||||
this.doublePatterns.enabled = false;
|
||||
this.buttonList.add(this.doublePatterns);
|
||||
|
||||
offset += 18;
|
||||
|
||||
this.patternOptimization = new GuiToggleButton(
|
||||
this.guiLeft - 18,
|
||||
this.guiTop + offset,
|
||||
178,
|
||||
194,
|
||||
GuiText.PatternOptimization.getLocal(),
|
||||
GuiText.PatternOptimizationHint.getLocal());
|
||||
this.buttonList.add(this.patternOptimization);
|
||||
|
||||
offset += 18;
|
||||
|
||||
this.advancedBlockingMode = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.guiTop + 62,
|
||||
this.guiTop + offset,
|
||||
Settings.ADVANCED_BLOCKING_MODE,
|
||||
AdvancedBlockingMode.DEFAULT);
|
||||
this.buttonList.add(this.advancedBlockingMode);
|
||||
this.advancedBlockingMode.visible = this.bc.getInstalledUpgrades(Upgrades.ADVANCED_BLOCKING) > 0;
|
||||
|
||||
offset += 18;
|
||||
|
||||
if (isTile()) {
|
||||
this.sidelessMode = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.guiTop + 80,
|
||||
this.guiTop + offset,
|
||||
Settings.SIDELESS_MODE,
|
||||
SidelessMode.SIDELESS);
|
||||
this.buttonList.add(this.sidelessMode);
|
||||
|
||||
offset += 18;
|
||||
}
|
||||
|
||||
this.lockCraftingMode = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.guiTop + offset,
|
||||
Settings.LOCK_CRAFTING_MODE,
|
||||
LockCraftingMode.NONE);
|
||||
this.lockCraftingMode.visible = this.bc.getInstalledUpgrades(Upgrades.LOCK_CRAFTING) > 0;
|
||||
this.buttonList.add(lockCraftingMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -110,19 +159,34 @@ public class GuiDualInterface extends GuiUpgradeable {
|
||||
if (this.BlockMode != null) {
|
||||
this.BlockMode.set(((ContainerInterface) this.cvb).getBlockingMode());
|
||||
}
|
||||
|
||||
if (this.SmartBlockMode != null) {
|
||||
this.SmartBlockMode.set(((ContainerInterface) this.cvb).getSmartBlockingMode());
|
||||
}
|
||||
if (this.interfaceMode != null) {
|
||||
this.interfaceMode.setState(((ContainerInterface) this.cvb).getInterfaceTerminalMode() == YesNo.YES);
|
||||
}
|
||||
if (this.insertionMode != null) {
|
||||
this.insertionMode.set(((ContainerInterface) this.cvb).getInsertionMode());
|
||||
}
|
||||
if (this.doublePatterns != null) {
|
||||
this.doublePatterns.enabled = ((ContainerInterface) this.cvb).isAllowedToMultiplyPatterns;
|
||||
if (this.doublePatterns.enabled) this.doublePatterns.setTooltip(
|
||||
ButtonToolTips.DoublePatterns.getLocal() + "\n" + ButtonToolTips.DoublePatternsHint.getLocal());
|
||||
else this.doublePatterns.setTooltip(
|
||||
ButtonToolTips.DoublePatterns.getLocal() + "\n" + ButtonToolTips.OptimizePatternsNoReq.getLocal());
|
||||
}
|
||||
if (this.patternOptimization != null) {
|
||||
this.patternOptimization.setState(((ContainerInterface) this.cvb).getPatternOptimization() == YesNo.YES);
|
||||
}
|
||||
if (this.sidelessMode != null) {
|
||||
this.sidelessMode.set(((ContainerDualInterface) this.cvb).getSidelessMode());
|
||||
}
|
||||
if (this.advancedBlockingMode != null) {
|
||||
this.advancedBlockingMode.set(((ContainerDualInterface) this.cvb).getAdvancedBlockingMode());
|
||||
}
|
||||
if (this.lockCraftingMode != null) {
|
||||
this.lockCraftingMode.set(((ContainerInterface) this.cvb).getLockCraftingMode());
|
||||
}
|
||||
this.fontRendererObj.drawString(
|
||||
getGuiDisplayName(StatCollector.translateToLocal(NameConst.GUI_FLUID_INTERFACE)),
|
||||
8,
|
||||
@@ -154,20 +218,31 @@ 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) {
|
||||
try {
|
||||
int val = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 1 : 0;
|
||||
if (backwards) val |= 0b10;
|
||||
NetworkHandler.instance
|
||||
.sendToServer(new PacketValueConfig("Interface.DoublePatterns", String.valueOf(val)));
|
||||
} catch (final Throwable e) {
|
||||
AELog.debug(e);
|
||||
}
|
||||
} else if (btn == this.patternOptimization) {
|
||||
NetworkHandler.instance.sendToServer(new PacketConfigButton(Settings.PATTERN_OPTIMIZATION, backwards));
|
||||
} else if (btn == this.sidelessMode) {
|
||||
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.sidelessMode.getSetting(), backwards));
|
||||
} else if (btn == this.advancedBlockingMode) {
|
||||
NetworkHandler.instance
|
||||
.sendToServer(new PacketConfigButton(this.advancedBlockingMode.getSetting(), backwards));
|
||||
} else if (btn == this.lockCraftingMode) {
|
||||
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.lockCraftingMode.getSetting(), backwards));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isPart() {
|
||||
return this.host instanceof PartFluidInterface;
|
||||
}
|
||||
|
||||
private boolean isTile() {
|
||||
return this.host instanceof TileFluidInterface;
|
||||
}
|
||||
@@ -178,5 +253,8 @@ public class GuiDualInterface extends GuiUpgradeable {
|
||||
if (this.advancedBlockingMode != null) {
|
||||
this.advancedBlockingMode.setVisibility(this.bc.getInstalledUpgrades(Upgrades.ADVANCED_BLOCKING) > 0);
|
||||
}
|
||||
if (this.lockCraftingMode != null) {
|
||||
this.lockCraftingMode.setVisibility(this.bc.getInstalledUpgrades(Upgrades.LOCK_CRAFTING) > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
@@ -11,6 +9,8 @@ import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerEssentiaMonitor;
|
||||
import com.glodblock.github.client.me.EssentiaRepo;
|
||||
@@ -21,16 +21,13 @@ import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.network.CPacketFluidUpdate;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.me.SlotME;
|
||||
import appeng.client.render.AppEngRenderItem;
|
||||
|
||||
public class GuiEssentiaTerminal extends GuiFluidMonitor {
|
||||
|
||||
private final AppEngRenderItem stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
|
||||
protected EntityPlayer player;
|
||||
|
||||
public GuiEssentiaTerminal(InventoryPlayer inventoryPlayer, IWirelessTerminal te) {
|
||||
@@ -64,13 +61,15 @@ public class GuiEssentiaTerminal extends GuiFluidMonitor {
|
||||
AspectUtil.getAspectFromGas(fluidStack),
|
||||
fluidStack.amount);
|
||||
IAEItemStack gas = stack.copy().setStackSize(stack.getStackSize() / AspectUtil.R);
|
||||
stackSizeRenderer.setAeStack(gas);
|
||||
stackSizeRenderer.renderItemOverlayIntoGUI(
|
||||
aeRenderItem.setAeStack(gas);
|
||||
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
|
||||
aeRenderItem.renderItemOverlayIntoGUI(
|
||||
fontRendererObj,
|
||||
mc.getTextureManager(),
|
||||
gas.getItemStack(),
|
||||
slot.xDisplayPosition,
|
||||
slot.yDisplayPosition);
|
||||
GL11.glTranslatef(0.0f, 0.0f, -200.0f);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -79,13 +78,8 @@ public class GuiEssentiaTerminal extends GuiFluidMonitor {
|
||||
@Override
|
||||
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
|
||||
if (slot instanceof SlotME && AspectUtil.isEssentiaContainer(player.inventory.getItemStack())) {
|
||||
Map<Integer, IAEFluidStack> tmp = new HashMap<>();
|
||||
ItemStack itemStack = this.player.inventory.getItemStack().copy();
|
||||
tmp.put(0, ItemFluidDrop.getAeFluidStack(((SlotME) slot).getAEStack()));
|
||||
if (!isShiftKeyDown()) {
|
||||
itemStack.stackSize = 1;
|
||||
}
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(tmp, itemStack));
|
||||
IAEFluidStack fluid = ItemFluidDrop.getAeFluidStack(((SlotME) slot).getAEStack());
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(fluid, isShiftKeyDown()));
|
||||
}
|
||||
if (mouseButton == 3 && slot instanceof SlotME) {
|
||||
return;
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
|
||||
import appeng.container.implementations.ContainerPriority;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
@@ -34,6 +35,11 @@ public class GuiFCPriority extends FCGuiAmount {
|
||||
((ContainerPriority) this.inventorySlots).setTextField(this.amountBox);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getIncrementQuantity(int i) {
|
||||
return AEConfig.instance.priorityByStacksAmounts(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.fontRendererObj.drawString(GuiText.Priority.getLocal(), 8, 6, 0x404040);
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidLevelEmitter;
|
||||
import com.glodblock.github.common.parts.PartFluidLevelEmitter;
|
||||
import com.glodblock.github.network.CPacketValueConfig;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.config.RedstoneMode;
|
||||
@@ -16,7 +15,6 @@ import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.client.gui.implementations.GuiUpgradeable;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiNumberBox;
|
||||
import appeng.client.render.AppEngRenderItem;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiColors;
|
||||
@@ -25,7 +23,6 @@ import appeng.core.localization.GuiText;
|
||||
public class GuiFluidLevelEmitter extends GuiUpgradeable {
|
||||
|
||||
private GuiNumberBox level;
|
||||
private final AppEngRenderItem stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
|
||||
private GuiButton plus1;
|
||||
private GuiButton plus10;
|
||||
private GuiButton plus100;
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.glodblock.github.client.gui.base.FCGuiMonitor;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidMonitor;
|
||||
@@ -55,8 +56,9 @@ public class GuiFluidMonitor extends FCGuiMonitor<IAEFluidStack> {
|
||||
|
||||
@Override
|
||||
public void setTextFieldValue(String displayName, int mousex, int mousey, ItemStack stack) {
|
||||
if (Util.getFluidFromItem(stack) != null) {
|
||||
setSearchString(Util.getFluidFromItem(stack).getLocalizedName(), true);
|
||||
final FluidStack fluid = Util.getFluidFromItem(stack);
|
||||
if (fluid != null) {
|
||||
setSearchString(fluid.getLocalizedName(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
|
||||
import com.glodblock.github.common.parts.PartLevelTerminal;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
|
||||
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.implementations.GuiOptimizePatterns;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class GuiFluidOptimizePatterns extends GuiOptimizePatterns {
|
||||
|
||||
private GuiType originalGui;
|
||||
|
||||
public GuiFluidOptimizePatterns(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||
super(inventoryPlayer, te);
|
||||
if (te instanceof PartFluidPatternTerminal) {
|
||||
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
|
||||
} else if (te instanceof PartFluidPatternTerminalEx) {
|
||||
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
|
||||
} else if (te instanceof PartLevelTerminal) {
|
||||
originalGui = GuiType.LEVEL_TERMINAL;
|
||||
} else if (te instanceof IWirelessTerminal terminal && terminal.isUniversal(te)) {
|
||||
this.originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
|
||||
} else if (te instanceof WirelessPatternTerminalInventory) {
|
||||
this.originalGui = GuiType.FLUID_TERMINAL;
|
||||
} else if (te instanceof WirelessLevelTerminalInventory) {
|
||||
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn) {
|
||||
if (btn.displayString.equals(GuiText.Cancel.getLocal())) {
|
||||
InventoryHandler.switchGui(originalGui);
|
||||
return;
|
||||
}
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,8 @@ import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidPatternEncoder;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
@@ -21,12 +23,10 @@ import com.glodblock.github.inventory.gui.MouseRegionManager;
|
||||
import com.glodblock.github.inventory.slot.ISlotFluid;
|
||||
import com.glodblock.github.inventory.slot.SlotSingleItem;
|
||||
import com.glodblock.github.network.CPacketEncodePattern;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.render.AppEngRenderItem;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class GuiFluidPatternEncoder extends AEBaseGui {
|
||||
@@ -35,7 +35,6 @@ public class GuiFluidPatternEncoder extends AEBaseGui {
|
||||
|
||||
private final ContainerFluidPatternEncoder cont;
|
||||
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
|
||||
private final AppEngRenderItem stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
|
||||
|
||||
public GuiFluidPatternEncoder(InventoryPlayer ipl, TileFluidPatternEncoder tile) {
|
||||
super(new ContainerFluidPatternEncoder(ipl, tile));
|
||||
@@ -95,13 +94,15 @@ public class GuiFluidPatternEncoder extends AEBaseGui {
|
||||
if (ItemFluidPacket.getFluidStack(stack) != null && ItemFluidPacket.getFluidStack(stack).amount > 0)
|
||||
fake.setStackSize(ItemFluidPacket.getFluidStack(stack).amount);
|
||||
}
|
||||
stackSizeRenderer.setAeStack(fake);
|
||||
stackSizeRenderer.renderItemOverlayIntoGUI(
|
||||
aeRenderItem.setAeStack(fake);
|
||||
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
|
||||
aeRenderItem.renderItemOverlayIntoGUI(
|
||||
fontRendererObj,
|
||||
mc.getTextureManager(),
|
||||
stack.getItemStack(),
|
||||
slot.xDisplayPosition,
|
||||
slot.yDisplayPosition);
|
||||
GL11.glTranslatef(0.0f, 0.0f, -200.0f);
|
||||
} else {
|
||||
super.func_146977_a(slot);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
@@ -22,7 +19,6 @@ import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.network.CPacketFluidUpdate;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.Util;
|
||||
import com.mitchej123.hodgepodge.textures.IPatchedTextureAtlasSprite;
|
||||
@@ -31,12 +27,10 @@ import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.me.SlotME;
|
||||
import appeng.client.render.AppEngRenderItem;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
|
||||
public class GuiFluidTerminal extends GuiFluidMonitor {
|
||||
|
||||
private final AppEngRenderItem stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
|
||||
protected EntityPlayer player;
|
||||
public ContainerFluidMonitor container;
|
||||
|
||||
@@ -84,13 +78,15 @@ public class GuiFluidTerminal extends GuiFluidMonitor {
|
||||
if (stack == null) return true;
|
||||
FluidStack fluidStack = ItemFluidDrop.getFluidStack(slot.getStack());
|
||||
this.drawWidget(slot.xDisplayPosition, slot.yDisplayPosition, fluidStack.getFluid());
|
||||
stackSizeRenderer.setAeStack(stack);
|
||||
stackSizeRenderer.renderItemOverlayIntoGUI(
|
||||
aeRenderItem.setAeStack(stack);
|
||||
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
|
||||
aeRenderItem.renderItemOverlayIntoGUI(
|
||||
fontRendererObj,
|
||||
mc.getTextureManager(),
|
||||
stack.getItemStack(),
|
||||
slot.xDisplayPosition,
|
||||
slot.yDisplayPosition);
|
||||
GL11.glTranslatef(0.0f, 0.0f, -200.0f);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -122,13 +118,8 @@ public class GuiFluidTerminal extends GuiFluidMonitor {
|
||||
@Override
|
||||
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
|
||||
if (slot instanceof SlotME && Util.FluidUtil.isFluidContainer(player.inventory.getItemStack())) {
|
||||
Map<Integer, IAEFluidStack> tmp = new HashMap<>();
|
||||
ItemStack itemStack = this.player.inventory.getItemStack().copy();
|
||||
tmp.put(0, ItemFluidDrop.getAeFluidStack(((SlotME) slot).getAEStack()));
|
||||
if (!isShiftKeyDown()) {
|
||||
itemStack.stackSize = 1;
|
||||
}
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(tmp, itemStack));
|
||||
IAEFluidStack fluid = ItemFluidDrop.getAeFluidStack(((SlotME) slot).getAEStack());
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(fluid, isShiftKeyDown()));
|
||||
}
|
||||
if (mouseButton == 3 && slot instanceof SlotME) {
|
||||
return;
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.glodblock.github.client.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
@@ -19,7 +20,6 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
@@ -41,8 +41,8 @@ import appeng.api.AEApi;
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.TerminalStyle;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.client.gui.IInterfaceTerminalPostUpdate;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
@@ -58,7 +58,7 @@ import appeng.core.localization.GuiColors;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketIfaceTermUpdate;
|
||||
import appeng.core.sync.packets.PacketInterfaceTerminalUpdate;
|
||||
import appeng.core.sync.packets.PacketInventoryAction;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.helpers.PatternHelper;
|
||||
@@ -67,8 +67,10 @@ import appeng.integration.IntegrationType;
|
||||
import appeng.items.misc.ItemEncodedPattern;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
// TODO why is this copy pasting all the UI code from AE2 instead of reusing it ???
|
||||
public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillTextField, IInterfaceTerminalPostUpdate {
|
||||
|
||||
public static final int HEADER_HEIGHT = 52;
|
||||
@@ -79,7 +81,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
AppEng.MOD_ID,
|
||||
"textures/guis/newinterfaceterminal.png");
|
||||
|
||||
private final IfaceList masterList = new IfaceList();
|
||||
private final InterfaceWirelessList masterList = new InterfaceWirelessList();
|
||||
private final MEGuiTextField searchFieldOutputs;
|
||||
private final MEGuiTextField searchFieldInputs;
|
||||
private final MEGuiTextField searchFieldNames;
|
||||
@@ -87,6 +89,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
private final GuiImgButton guiButtonAssemblersOnly;
|
||||
private final GuiImgButton guiButtonBrokenRecipes;
|
||||
private final GuiImgButton terminalStyleBox;
|
||||
private final GuiImgButton searchStringSave;
|
||||
private boolean onlyMolecularAssemblers = false;
|
||||
private boolean onlyBrokenRecipes = false;
|
||||
private boolean online;
|
||||
@@ -95,15 +98,20 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
private final List<String> extraOptionsText;
|
||||
private ItemStack tooltipStack;
|
||||
private final boolean neiPresent;
|
||||
protected static String searchFieldInputsText = "";
|
||||
protected static String searchFieldOutputsText = "";
|
||||
protected static String searchFieldNamesText = "";
|
||||
/*
|
||||
* Z-level Map (FLOATS) 0.0 - BACKGROUND 1.0 - ItemStacks 2.0 - Slot color overlays 20.0 - ItemStack overlays 21.0 -
|
||||
* Slot mouse hover overlay 200.0 - Tooltips
|
||||
*/
|
||||
private static final float ITEMSTACK_Z = 1.0f;
|
||||
private static final float ITEM_STACK_Z = 100.0f;
|
||||
private static final float SLOT_Z = 0.5f;
|
||||
private static final float ITEMSTACK_OVERLAY_Z = 20.0f;
|
||||
private static final float SLOT_HOVER_Z = 31.0f;
|
||||
private static final float TOOLTIP_Z = 200.0f;
|
||||
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;
|
||||
private static final float STEP_Z = 10.0f;
|
||||
private static final float MAGIC_RENDER_ITEM_Z = 50.0f;
|
||||
|
||||
protected int offsetY;
|
||||
|
||||
@@ -140,6 +148,11 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
};
|
||||
searchFieldNames.setFocused(true);
|
||||
|
||||
searchStringSave = new GuiImgButton(
|
||||
0,
|
||||
0,
|
||||
Settings.SAVE_SEARCH,
|
||||
AEConfig.instance.preserveSearchBar ? YesNo.YES : YesNo.NO);
|
||||
guiButtonAssemblersOnly = new GuiImgButton(0, 0, Settings.ACTIONS, null);
|
||||
guiButtonHideFull = new GuiImgButton(0, 0, Settings.ACTIONS, null);
|
||||
guiButtonBrokenRecipes = new GuiImgButton(0, 0, Settings.ACTIONS, null);
|
||||
@@ -169,7 +182,6 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
@@ -193,8 +205,11 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
terminalStyleBox.xPosition = guiLeft - 18;
|
||||
terminalStyleBox.yPosition = guiTop + 8;
|
||||
|
||||
searchStringSave.xPosition = guiLeft - 18;
|
||||
searchStringSave.yPosition = terminalStyleBox.yPosition + 18;
|
||||
|
||||
guiButtonBrokenRecipes.xPosition = guiLeft - 18;
|
||||
guiButtonBrokenRecipes.yPosition = terminalStyleBox.yPosition + 18;
|
||||
guiButtonBrokenRecipes.yPosition = searchStringSave.yPosition + 18;
|
||||
|
||||
guiButtonHideFull.xPosition = guiLeft - 18;
|
||||
guiButtonHideFull.yPosition = guiButtonBrokenRecipes.yPosition + 18;
|
||||
@@ -202,7 +217,9 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
guiButtonAssemblersOnly.xPosition = guiLeft - 18;
|
||||
guiButtonAssemblersOnly.yPosition = guiButtonHideFull.yPosition + 18;
|
||||
|
||||
offsetY = 103;
|
||||
offsetY = guiButtonAssemblersOnly.yPosition + 18;
|
||||
|
||||
setSearchString();
|
||||
|
||||
this.setScrollBar();
|
||||
this.repositionSlots();
|
||||
@@ -210,6 +227,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
buttonList.add(guiButtonAssemblersOnly);
|
||||
buttonList.add(guiButtonHideFull);
|
||||
buttonList.add(guiButtonBrokenRecipes);
|
||||
buttonList.add(searchStringSave);
|
||||
buttonList.add(terminalStyleBox);
|
||||
initGuiDone();
|
||||
addSwitchGuiBtns();
|
||||
@@ -302,7 +320,9 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
|
||||
if (btn == this.terminalStyleBox) {
|
||||
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
|
||||
initGui();
|
||||
super.scheduleGuiResize();
|
||||
} else if (btn == searchStringSave) {
|
||||
AEConfig.instance.preserveSearchBar = next == YesNo.YES;
|
||||
}
|
||||
|
||||
iBtn.set(next);
|
||||
@@ -312,6 +332,27 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuiClosed() {
|
||||
super.onGuiClosed();
|
||||
searchFieldInputsText = searchFieldInputs.getText();
|
||||
searchFieldOutputsText = searchFieldOutputs.getText();
|
||||
searchFieldNamesText = searchFieldNames.getText();
|
||||
}
|
||||
|
||||
public void setSearchString() {
|
||||
boolean setString = AEConfig.instance.preserveSearchBar || isSubGui();
|
||||
if (searchFieldInputs.getText().isEmpty() && setString) {
|
||||
searchFieldInputs.setText(searchFieldInputsText);
|
||||
}
|
||||
if (searchFieldOutputs.getText().isEmpty() && setString) {
|
||||
searchFieldOutputs.setText(searchFieldOutputsText);
|
||||
}
|
||||
if (searchFieldNames.getText().isEmpty() && setString) {
|
||||
searchFieldNames.setText(searchFieldNamesText);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.bindTexture(BACKGROUND);
|
||||
@@ -326,7 +367,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
offsetY + HEADER_HEIGHT + viewHeight + 1,
|
||||
0.0f,
|
||||
0.0f,
|
||||
(HEADER_HEIGHT + IfaceSection.TITLE_HEIGHT + 1.0f) / 256.0f,
|
||||
(HEADER_HEIGHT + InterfaceWirelessSection.TITLE_HEIGHT + 1.0f) / 256.0f,
|
||||
this.xSize / 256.0f,
|
||||
(HEADER_HEIGHT + 106.0f) / 256.0f);
|
||||
Tessellator.instance.draw();
|
||||
@@ -340,7 +381,6 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
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();
|
||||
@@ -358,7 +398,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
final int scroll = this.getScrollBar().getCurrentScroll();
|
||||
int viewY = -scroll; // current y in viewport coordinates
|
||||
int entryIdx = 0;
|
||||
List<IfaceSection> visibleSections = this.masterList.getVisibleSections();
|
||||
List<InterfaceWirelessSection> visibleSections = this.masterList.getVisibleSections();
|
||||
|
||||
final float guiScaleX = (float) mc.displayWidth / width;
|
||||
final float guiScaleY = (float) mc.displayHeight / height;
|
||||
@@ -373,7 +413,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
* Render each section
|
||||
*/
|
||||
while (viewY < this.viewHeight && entryIdx < visibleSections.size()) {
|
||||
IfaceSection section = visibleSections.get(entryIdx);
|
||||
InterfaceWirelessSection section = visibleSections.get(entryIdx);
|
||||
int sectionHeight = section.getHeight();
|
||||
|
||||
/* Is it viewable/in the viewport at all? */
|
||||
@@ -400,7 +440,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
* @param relMouseY transformed mouse coords relative to viewport
|
||||
* @return the height of the section rendered in viewport coordinates, max of viewHeight.
|
||||
*/
|
||||
private int drawSection(IfaceSection section, int viewY, int relMouseX, int relMouseY) {
|
||||
private int drawSection(InterfaceWirelessSection section, int viewY, int relMouseX, int relMouseY) {
|
||||
int title;
|
||||
int renderY = 0;
|
||||
final int sectionBottom = viewY + section.getHeight() - 1;
|
||||
@@ -408,49 +448,71 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
/*
|
||||
* Render title
|
||||
*/
|
||||
GL11.glTranslatef(0.0f, 0.0f, 50f);
|
||||
bindTexture(BACKGROUND);
|
||||
if (sectionBottom > 0 && sectionBottom < IfaceSection.TITLE_HEIGHT) {
|
||||
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z + ITEM_STACK_Z + STEP_Z);
|
||||
if (sectionBottom > 0 && sectionBottom < InterfaceWirelessSection.TITLE_HEIGHT) {
|
||||
/* Transition draw */
|
||||
title = sectionBottom;
|
||||
} else if (viewY < 0) {
|
||||
/* Hidden title draw */
|
||||
title = 0;
|
||||
} else {
|
||||
/* Normal title draw */
|
||||
title = 0;
|
||||
}
|
||||
GL11.glTranslatef(0.0f, 0.0f, -(ITEM_STACK_OVERLAY_Z + ITEM_STACK_Z + STEP_Z));
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
Iterator<InterfaceWirelessEntry> visible = section.getVisible();
|
||||
while (visible.hasNext()) {
|
||||
InterfaceWirelessEntry entry = visible.next();
|
||||
if (viewY + renderY + entry.rows * 18 + 1 > 0 && viewY + renderY < viewHeight) {
|
||||
renderY += drawEntry(
|
||||
entry,
|
||||
viewY + InterfaceWirelessSection.TITLE_HEIGHT + renderY,
|
||||
title,
|
||||
relMouseX,
|
||||
relMouseY);
|
||||
} else {
|
||||
entry.dispY = -9999;
|
||||
entry.optionsButton.yPosition = -1;
|
||||
renderY += entry.rows * 18 + 1;
|
||||
}
|
||||
}
|
||||
bindTexture(BACKGROUND);
|
||||
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z + ITEM_STACK_Z + STEP_Z);
|
||||
if (sectionBottom > 0 && sectionBottom < InterfaceWirelessSection.TITLE_HEIGHT) {
|
||||
/* Transition draw */
|
||||
drawTexturedModalRect(
|
||||
0,
|
||||
0,
|
||||
VIEW_LEFT,
|
||||
HEADER_HEIGHT + IfaceSection.TITLE_HEIGHT - sectionBottom,
|
||||
HEADER_HEIGHT + InterfaceWirelessSection.TITLE_HEIGHT - sectionBottom,
|
||||
VIEW_WIDTH,
|
||||
sectionBottom);
|
||||
fontRendererObj.drawString(section.name, 2, sectionBottom - IfaceSection.TITLE_HEIGHT + 2, fontColor);
|
||||
title = sectionBottom;
|
||||
fontRendererObj
|
||||
.drawString(section.name, 2, sectionBottom - InterfaceWirelessSection.TITLE_HEIGHT + 2, fontColor);
|
||||
} else if (viewY < 0) {
|
||||
/* Hidden title draw */
|
||||
drawTexturedModalRect(0, 0, VIEW_LEFT, HEADER_HEIGHT, VIEW_WIDTH, IfaceSection.TITLE_HEIGHT);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glTranslatef(0.0f, 0.0f, 100f);
|
||||
drawTexturedModalRect(0, 0, VIEW_LEFT, HEADER_HEIGHT, VIEW_WIDTH, InterfaceWirelessSection.TITLE_HEIGHT);
|
||||
fontRendererObj.drawString(section.name, 2, 2, fontColor);
|
||||
title = 0;
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
} else {
|
||||
/* Normal title draw */
|
||||
drawTexturedModalRect(0, viewY, VIEW_LEFT, HEADER_HEIGHT, VIEW_WIDTH, IfaceSection.TITLE_HEIGHT);
|
||||
drawTexturedModalRect(
|
||||
0,
|
||||
viewY,
|
||||
VIEW_LEFT,
|
||||
HEADER_HEIGHT,
|
||||
VIEW_WIDTH,
|
||||
InterfaceWirelessSection.TITLE_HEIGHT);
|
||||
fontRendererObj.drawString(section.name, 2, viewY + 2, fontColor);
|
||||
title = 0;
|
||||
}
|
||||
GL11.glTranslatef(0.0f, 0.0f, -50f);
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
GL11.glTranslatef(0.0f, 0.0f, -(ITEM_STACK_OVERLAY_Z + ITEM_STACK_Z + STEP_Z));
|
||||
|
||||
Iterator<IfaceEntry> visible = section.getVisible();
|
||||
while (visible.hasNext()) {
|
||||
if (viewY < viewHeight) {
|
||||
renderY += drawEntry(
|
||||
visible.next(),
|
||||
viewY + IfaceSection.TITLE_HEIGHT + renderY,
|
||||
title,
|
||||
relMouseX,
|
||||
relMouseY);
|
||||
} else {
|
||||
IfaceEntry entry = visible.next();
|
||||
entry.dispY = -9999;
|
||||
entry.optionsButton.yPosition = -1;
|
||||
}
|
||||
}
|
||||
return IfaceSection.TITLE_HEIGHT + renderY;
|
||||
return InterfaceWirelessSection.TITLE_HEIGHT + renderY;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -458,7 +520,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
*
|
||||
* @param viewY the gui coordinate z
|
||||
*/
|
||||
private int drawEntry(IfaceEntry entry, int viewY, int titleBottom, int relMouseX, int relMouseY) {
|
||||
private int drawEntry(InterfaceWirelessEntry entry, int viewY, int titleBottom, int relMouseX, int relMouseY) {
|
||||
bindTexture(BACKGROUND);
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
int relY = 0;
|
||||
@@ -493,17 +555,19 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
if (viewY + entry.optionsButton.height > 0 && viewY < viewHeight) {
|
||||
entry.optionsButton.yPosition = viewY + 5;
|
||||
entry.renameButton.yPosition = viewY + 5;
|
||||
GuiFCImgButton toRender;
|
||||
if (isShiftKeyDown()) {
|
||||
entry.renameButton.drawButton(mc, relMouseX, relMouseY);
|
||||
toRender = entry.renameButton;
|
||||
} else {
|
||||
entry.optionsButton.drawButton(mc, relMouseX, relMouseY);
|
||||
toRender = entry.optionsButton;
|
||||
}
|
||||
if (entry.optionsButton.getMouseIn()
|
||||
&& relMouseY >= Math.max(IfaceSection.TITLE_HEIGHT, entry.optionsButton.yPosition)) {
|
||||
toRender.drawButton(mc, relMouseX, relMouseY);
|
||||
if (toRender.getMouseIn()
|
||||
&& relMouseY >= Math.max(InterfaceWirelessSection.TITLE_HEIGHT, entry.optionsButton.yPosition)) {
|
||||
// draw a tooltip
|
||||
GL11.glTranslatef(0f, 0f, TOOLTIP_Z);
|
||||
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
||||
drawHoveringText(extraOptionsText, relMouseX, relMouseY);
|
||||
drawHoveringText(Arrays.asList(toRender.getMessage()), relMouseX, relMouseY);
|
||||
GL11.glTranslatef(0f, 0f, -TOOLTIP_Z);
|
||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
}
|
||||
@@ -528,29 +592,30 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
ItemStack stack = inv.getStackInSlot(slotIdx);
|
||||
|
||||
boolean tooltip = relMouseX > colLeft - 1 && relMouseX < colRight - 1
|
||||
&& relMouseY >= Math.max(viewY + rowYTop, IfaceSection.TITLE_HEIGHT)
|
||||
&& relMouseY >= Math.max(viewY + rowYTop, InterfaceWirelessSection.TITLE_HEIGHT)
|
||||
&& relMouseY < Math.min(viewY + rowYBot, viewHeight);
|
||||
if (stack != null) {
|
||||
final ItemEncodedPattern iep = (ItemEncodedPattern) stack.getItem();
|
||||
final ItemStack toRender = iep.getOutput(stack);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(colLeft, viewY + rowYTop + 1, ITEMSTACK_Z);
|
||||
GL11.glTranslatef(colLeft, viewY + rowYTop + 1, ITEM_STACK_Z);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
translatedRenderItem.zLevel = 3.0f - 50.0f;
|
||||
translatedRenderItem.zLevel = ITEM_STACK_Z - MAGIC_RENDER_ITEM_Z;
|
||||
translatedRenderItem
|
||||
.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), toRender, 0, 0);
|
||||
GL11.glTranslatef(0.0f, 0.0f, ITEMSTACK_OVERLAY_Z - ITEMSTACK_Z);
|
||||
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z);
|
||||
aeRenderItem.setAeStack(AEItemStack.create(toRender));
|
||||
aeRenderItem.renderItemOverlayIntoGUI(fontRendererObj, mc.getTextureManager(), toRender, 0, 0);
|
||||
aeRenderItem.zLevel = 0.0f;
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
if (!tooltip) {
|
||||
if (entry.brokenRecipes[slotIdx]) {
|
||||
GL11.glTranslatef(0.0f, 0.0f, SLOT_Z - ITEMSTACK_OVERLAY_Z);
|
||||
if (entry.slotIsBroken(slotIdx)) {
|
||||
GL11.glTranslatef(0.0f, 0.0f, SLOT_Z - ITEM_STACK_OVERLAY_Z);
|
||||
drawRect(0, 0, 16, 16, GuiColors.ItemSlotOverlayInvalid.getColor());
|
||||
} else if (entry.filteredRecipes[slotIdx]) {
|
||||
GL11.glTranslatef(0.0f, 0.0f, ITEMSTACK_OVERLAY_Z);
|
||||
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z);
|
||||
drawRect(0, 0, 16, 16, GuiColors.ItemSlotOverlayUnpowered.getColor());
|
||||
}
|
||||
} else {
|
||||
@@ -559,7 +624,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
GL11.glPopMatrix();
|
||||
} else if (entry.filteredRecipes[slotIdx]) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(colLeft, viewY + rowYTop + 1, ITEMSTACK_OVERLAY_Z);
|
||||
GL11.glTranslatef(colLeft, viewY + rowYTop + 1, ITEM_STACK_OVERLAY_Z);
|
||||
drawRect(0, 0, 16, 16, GuiColors.ItemSlotOverlayUnpowered.getColor());
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
@@ -569,8 +634,6 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
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);
|
||||
}
|
||||
@@ -592,9 +655,8 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
/**
|
||||
* A copy of super method, but modified to allow for depth testing.
|
||||
*/
|
||||
@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();
|
||||
@@ -753,32 +815,39 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
return false;
|
||||
}
|
||||
|
||||
public void postUpdate(List<PacketIfaceTermUpdate.PacketEntry> updates, int statusFlags) {
|
||||
if ((statusFlags & PacketIfaceTermUpdate.CLEAR_ALL_BIT) == PacketIfaceTermUpdate.CLEAR_ALL_BIT) {
|
||||
public void postUpdate(List<PacketInterfaceTerminalUpdate.PacketEntry> updates, int statusFlags) {
|
||||
if ((statusFlags & PacketInterfaceTerminalUpdate.CLEAR_ALL_BIT)
|
||||
== PacketInterfaceTerminalUpdate.CLEAR_ALL_BIT) {
|
||||
/* Should clear all client entries. */
|
||||
this.masterList.list.clear();
|
||||
}
|
||||
/* Should indicate disconnected, so the terminal turns dark. */
|
||||
this.online = (statusFlags & PacketIfaceTermUpdate.DISCONNECT_BIT) != PacketIfaceTermUpdate.DISCONNECT_BIT;
|
||||
this.online = (statusFlags & PacketInterfaceTerminalUpdate.DISCONNECT_BIT)
|
||||
!= PacketInterfaceTerminalUpdate.DISCONNECT_BIT;
|
||||
|
||||
for (PacketIfaceTermUpdate.PacketEntry cmd : updates) {
|
||||
for (PacketInterfaceTerminalUpdate.PacketEntry cmd : updates) {
|
||||
parsePacketCmd(cmd);
|
||||
}
|
||||
this.masterList.markDirty();
|
||||
|
||||
}
|
||||
|
||||
private void parsePacketCmd(PacketIfaceTermUpdate.PacketEntry cmd) {
|
||||
private void parsePacketCmd(PacketInterfaceTerminalUpdate.PacketEntry cmd) {
|
||||
long id = cmd.entryId;
|
||||
if (cmd instanceof PacketIfaceTermUpdate.PacketAdd addCmd) {
|
||||
IfaceEntry entry = new IfaceEntry(id, addCmd.name, addCmd.rows, addCmd.rowSize, addCmd.online)
|
||||
.setLocation(addCmd.x, addCmd.y, addCmd.z, addCmd.dim, addCmd.side)
|
||||
.setIcons(addCmd.selfRep, addCmd.dispRep).setItems(addCmd.items);
|
||||
if (cmd instanceof PacketInterfaceTerminalUpdate.PacketAdd addCmd) {
|
||||
InterfaceWirelessEntry entry = new InterfaceWirelessEntry(
|
||||
id,
|
||||
addCmd.name,
|
||||
addCmd.rows,
|
||||
addCmd.rowSize,
|
||||
addCmd.online,
|
||||
addCmd.p2pOutput).setLocation(addCmd.x, addCmd.y, addCmd.z, addCmd.dim, addCmd.side)
|
||||
.setIcons(addCmd.selfRep, addCmd.dispRep).setItems(addCmd.items);
|
||||
masterList.addEntry(entry);
|
||||
} else if (cmd instanceof PacketIfaceTermUpdate.PacketRemove) {
|
||||
} else if (cmd instanceof PacketInterfaceTerminalUpdate.PacketRemove) {
|
||||
masterList.removeEntry(id);
|
||||
} else if (cmd instanceof PacketIfaceTermUpdate.PacketOverwrite owCmd) {
|
||||
IfaceEntry entry = masterList.list.get(id);
|
||||
} else if (cmd instanceof PacketInterfaceTerminalUpdate.PacketOverwrite owCmd) {
|
||||
InterfaceWirelessEntry entry = masterList.list.get(id);
|
||||
|
||||
if (entry == null) {
|
||||
return;
|
||||
@@ -796,8 +865,8 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
}
|
||||
}
|
||||
masterList.isDirty = true;
|
||||
} else if (cmd instanceof PacketIfaceTermUpdate.PacketRename renameCmd) {
|
||||
IfaceEntry entry = masterList.list.get(id);
|
||||
} else if (cmd instanceof PacketInterfaceTerminalUpdate.PacketRename renameCmd) {
|
||||
InterfaceWirelessEntry entry = masterList.list.get(id);
|
||||
|
||||
if (entry != null) {
|
||||
if (StatCollector.canTranslate(renameCmd.newName)) {
|
||||
@@ -890,16 +959,15 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
/**
|
||||
* Tracks the list of entries.
|
||||
*/
|
||||
private class IfaceList {
|
||||
private class InterfaceWirelessList {
|
||||
|
||||
private final Map<Long, IfaceEntry> list = new HashMap<>();
|
||||
private final Map<String, IfaceSection> sections = new TreeMap<>();
|
||||
private final List<IfaceSection> visibleSections = new ArrayList<>();
|
||||
private final Map<Long, InterfaceWirelessEntry> list = new HashMap<>();
|
||||
private final Map<String, InterfaceWirelessSection> sections = new TreeMap<>();
|
||||
private final List<InterfaceWirelessSection> visibleSections = new ArrayList<>();
|
||||
private boolean isDirty;
|
||||
private int height;
|
||||
private IfaceEntry hoveredEntry;
|
||||
|
||||
IfaceList() {
|
||||
InterfaceWirelessList() {
|
||||
this.isDirty = true;
|
||||
}
|
||||
|
||||
@@ -910,7 +978,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
height = 0;
|
||||
visibleSections.clear();
|
||||
|
||||
for (IfaceSection section : sections.values()) {
|
||||
for (InterfaceWirelessSection section : sections.values()) {
|
||||
String query = GuiInterfaceWireless.this.searchFieldNames.getText();
|
||||
if (!query.isEmpty() && !section.name.toLowerCase().contains(query.toLowerCase())) {
|
||||
continue;
|
||||
@@ -962,7 +1030,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
} else {
|
||||
int y = 0;
|
||||
|
||||
for (IfaceSection section : sections) {
|
||||
for (InterfaceWirelessSection section : sections) {
|
||||
if (y > viewY) {
|
||||
result = true;
|
||||
scrollbar.setCurrentScroll(y);
|
||||
@@ -974,11 +1042,11 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
return result;
|
||||
}
|
||||
|
||||
public void addEntry(IfaceEntry entry) {
|
||||
IfaceSection section = sections.get(entry.dispName);
|
||||
public void addEntry(InterfaceWirelessEntry entry) {
|
||||
InterfaceWirelessSection section = sections.get(entry.dispName);
|
||||
|
||||
if (section == null) {
|
||||
section = new IfaceSection(entry.dispName);
|
||||
section = new InterfaceWirelessSection(entry.dispName);
|
||||
sections.put(entry.dispName, section);
|
||||
}
|
||||
section.addEntry(entry);
|
||||
@@ -987,14 +1055,14 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
}
|
||||
|
||||
public void removeEntry(long id) {
|
||||
IfaceEntry entry = list.remove(id);
|
||||
InterfaceWirelessEntry entry = list.remove(id);
|
||||
|
||||
if (entry != null) {
|
||||
entry.section.removeEntry(entry);
|
||||
}
|
||||
}
|
||||
|
||||
public List<IfaceSection> getVisibleSections() {
|
||||
public List<InterfaceWirelessSection> getVisibleSections() {
|
||||
if (isDirty) {
|
||||
update();
|
||||
}
|
||||
@@ -1012,7 +1080,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
if (relMouseX < 0 || relMouseX >= VIEW_WIDTH || relMouseY < 0 || relMouseY >= viewHeight) {
|
||||
return false;
|
||||
}
|
||||
for (IfaceSection section : getVisibleSections()) {
|
||||
for (InterfaceWirelessSection section : getVisibleSections()) {
|
||||
if (section.mouseClicked(relMouseX, relMouseY, btn)) {
|
||||
return true;
|
||||
}
|
||||
@@ -1024,13 +1092,13 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
/**
|
||||
* A section holds all the interface entries with the same name.
|
||||
*/
|
||||
private class IfaceSection {
|
||||
private class InterfaceWirelessSection {
|
||||
|
||||
public static final int TITLE_HEIGHT = 12;
|
||||
|
||||
String name;
|
||||
List<IfaceEntry> entries = new ArrayList<>();
|
||||
Set<IfaceEntry> visibleEntries = new TreeSet<>(Comparator.comparing(e -> {
|
||||
List<InterfaceWirelessEntry> entries = new ArrayList<>();
|
||||
Set<InterfaceWirelessEntry> visibleEntries = new TreeSet<>(Comparator.comparing(e -> {
|
||||
if (e.dispRep != null) {
|
||||
return e.dispRep.getDisplayName() + e.id;
|
||||
} else {
|
||||
@@ -1041,7 +1109,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
private boolean isDirty = true;
|
||||
boolean visible = false;
|
||||
|
||||
IfaceSection(String name) {
|
||||
InterfaceWirelessSection(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@@ -1061,7 +1129,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
height = 0;
|
||||
} else {
|
||||
height = TITLE_HEIGHT;
|
||||
for (IfaceEntry entry : visibleEntries) {
|
||||
for (InterfaceWirelessEntry entry : visibleEntries) {
|
||||
height += entry.guiHeight;
|
||||
}
|
||||
}
|
||||
@@ -1073,7 +1141,9 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
String input = GuiInterfaceWireless.this.searchFieldInputs.getText().toLowerCase();
|
||||
String output = GuiInterfaceWireless.this.searchFieldOutputs.getText().toLowerCase();
|
||||
|
||||
for (IfaceEntry entry : entries) {
|
||||
for (InterfaceWirelessEntry entry : entries) {
|
||||
if (!entry.online || entry.p2pOutput) continue;
|
||||
|
||||
var moleAss = AEApi.instance().definitions().blocks().molecularAssembler().maybeStack(1);
|
||||
entry.dispY = -9999;
|
||||
if (onlyMolecularAssemblers
|
||||
@@ -1084,7 +1154,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
&& entry.numItems == entry.rows * entry.rowSize) {
|
||||
continue;
|
||||
}
|
||||
if (onlyBrokenRecipes && entry.numBrokenRecipes == 0) {
|
||||
if (onlyBrokenRecipes && !entry.hasBrokenSlot()) {
|
||||
continue;
|
||||
}
|
||||
// Find search terms
|
||||
@@ -1112,19 +1182,19 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
}
|
||||
}
|
||||
|
||||
public void addEntry(IfaceEntry entry) {
|
||||
public void addEntry(InterfaceWirelessEntry entry) {
|
||||
this.entries.add(entry);
|
||||
entry.section = this;
|
||||
this.isDirty = true;
|
||||
}
|
||||
|
||||
public void removeEntry(IfaceEntry entry) {
|
||||
public void removeEntry(InterfaceWirelessEntry entry) {
|
||||
this.entries.remove(entry);
|
||||
entry.section = null;
|
||||
this.isDirty = true;
|
||||
}
|
||||
|
||||
public Iterator<IfaceEntry> getVisible() {
|
||||
public Iterator<InterfaceWirelessEntry> getVisible() {
|
||||
if (isDirty) {
|
||||
update();
|
||||
}
|
||||
@@ -1132,7 +1202,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
}
|
||||
|
||||
public boolean mouseClicked(int relMouseX, int relMouseY, int btn) {
|
||||
Iterator<IfaceEntry> it = getVisible();
|
||||
Iterator<InterfaceWirelessEntry> it = getVisible();
|
||||
boolean ret = false;
|
||||
|
||||
while (it.hasNext() && !ret) {
|
||||
@@ -1146,32 +1216,29 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
/**
|
||||
* This class keeps track of an entry and its widgets.
|
||||
*/
|
||||
private class IfaceEntry {
|
||||
private class InterfaceWirelessEntry {
|
||||
|
||||
String dispName;
|
||||
AppEngInternalInventory inv;
|
||||
GuiImgButton optionsButton;
|
||||
GuiFCImgButton optionsButton;
|
||||
GuiFCImgButton renameButton;
|
||||
|
||||
/** Nullable - icon that represents the interface */
|
||||
ItemStack selfRep;
|
||||
/** Nullable - icon that represents the interface's "target" */
|
||||
ItemStack dispRep;
|
||||
IfaceSection section;
|
||||
InterfaceWirelessSection section;
|
||||
long id;
|
||||
int x, y, z, dim, side;
|
||||
int rows, rowSize;
|
||||
int guiHeight;
|
||||
int dispY = -9999;
|
||||
boolean online;
|
||||
int numBrokenRecipes;
|
||||
boolean[] brokenRecipes;
|
||||
boolean p2pOutput;
|
||||
private Boolean[] brokenRecipes;
|
||||
int numItems = 0;
|
||||
/** Should recipe be filtered out/grayed out? */
|
||||
boolean[] filteredRecipes;
|
||||
private int hoveredSlotIdx = -1;
|
||||
|
||||
IfaceEntry(long id, String name, int rows, int rowSize, boolean online) {
|
||||
InterfaceWirelessEntry(long id, String name, int rows, int rowSize, boolean online, boolean p2pOutput) {
|
||||
this.id = id;
|
||||
if (StatCollector.canTranslate(name)) {
|
||||
this.dispName = StatCollector.translateToLocal(name);
|
||||
@@ -1187,16 +1254,17 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
this.rows = rows;
|
||||
this.rowSize = rowSize;
|
||||
this.online = online;
|
||||
this.optionsButton = new GuiImgButton(2, 0, Settings.ACTIONS, ActionItems.HIGHLIGHT_INTERFACE);
|
||||
this.p2pOutput = p2pOutput;
|
||||
this.optionsButton = new GuiFCImgButton(2, 0, "HIGHLIGHT", "YES");
|
||||
this.optionsButton.setHalfSize(true);
|
||||
this.renameButton = new GuiFCImgButton(2, 0, "EDIT", "YES");
|
||||
this.renameButton.setHalfSize(true);
|
||||
this.guiHeight = 18 * rows + 1;
|
||||
this.brokenRecipes = new boolean[rows * rowSize];
|
||||
this.brokenRecipes = new Boolean[rows * rowSize];
|
||||
this.filteredRecipes = new boolean[rows * rowSize];
|
||||
}
|
||||
|
||||
IfaceEntry setLocation(int x, int y, int z, int dim, int side) {
|
||||
InterfaceWirelessEntry setLocation(int x, int y, int z, int dim, int side) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
@@ -1206,9 +1274,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
return this;
|
||||
}
|
||||
|
||||
IfaceEntry setIcons(ItemStack selfRep, ItemStack dispRep) {
|
||||
// Kotlin would make this pretty easy :(
|
||||
this.selfRep = selfRep;
|
||||
InterfaceWirelessEntry setIcons(ItemStack selfRep, ItemStack dispRep) {
|
||||
this.dispRep = dispRep;
|
||||
|
||||
return this;
|
||||
@@ -1217,7 +1283,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
public void fullItemUpdate(NBTTagList items, int newSize) {
|
||||
inv = new AppEngInternalInventory(null, newSize);
|
||||
rows = newSize / rowSize;
|
||||
brokenRecipes = new boolean[newSize];
|
||||
brokenRecipes = new Boolean[newSize];
|
||||
numItems = 0;
|
||||
|
||||
for (int i = 0; i < inv.getSizeInventory(); ++i) {
|
||||
@@ -1226,7 +1292,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
this.guiHeight = 18 * rows + 4;
|
||||
}
|
||||
|
||||
IfaceEntry setItems(NBTTagList items) {
|
||||
InterfaceWirelessEntry setItems(NBTTagList items) {
|
||||
assert items.tagCount() == inv.getSizeInventory();
|
||||
|
||||
for (int i = 0; i < items.tagCount(); ++i) {
|
||||
@@ -1242,21 +1308,46 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
}
|
||||
|
||||
private void setItemInSlot(ItemStack stack, int idx) {
|
||||
final int oldBroke = brokenRecipes[idx] ? 1 : 0;
|
||||
final int newBroke = recipeIsBroken(stack) ? 1 : 0;
|
||||
final int oldHasItem = inv.getStackInSlot(idx) != null ? 1 : 0;
|
||||
final int newHasItem = stack != null ? 1 : 0;
|
||||
|
||||
// Update broken recipe count
|
||||
numBrokenRecipes += newBroke - oldBroke;
|
||||
brokenRecipes[idx] = newBroke == 1;
|
||||
inv.setInventorySlotContents(idx, stack);
|
||||
assert numBrokenRecipes >= 0;
|
||||
// Update item count
|
||||
numItems += newHasItem - oldHasItem;
|
||||
assert numItems >= 0;
|
||||
}
|
||||
|
||||
public boolean hasBrokenSlot() {
|
||||
boolean existsUnknown = false;
|
||||
|
||||
for (int idx = 0; idx < brokenRecipes.length; idx++) {
|
||||
if (brokenRecipes[idx] == null) {
|
||||
existsUnknown = true;
|
||||
} else if (brokenRecipes[idx] == true) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (existsUnknown) {
|
||||
for (int idx = 0; idx < brokenRecipes.length; idx++) {
|
||||
if (slotIsBroken(idx)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean slotIsBroken(int idx) {
|
||||
|
||||
if (brokenRecipes[idx] == null) {
|
||||
brokenRecipes[idx] = recipeIsBroken(inv.getStackInSlot(idx));
|
||||
}
|
||||
|
||||
return brokenRecipes[idx];
|
||||
}
|
||||
|
||||
public AppEngInternalInventory getInventory() {
|
||||
return inv;
|
||||
}
|
||||
@@ -1266,7 +1357,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
return false;
|
||||
}
|
||||
if (mouseX >= optionsButton.xPosition && mouseX < 2 + optionsButton.width
|
||||
&& mouseY > Math.max(optionsButton.yPosition, IfaceSection.TITLE_HEIGHT)
|
||||
&& mouseY > Math.max(optionsButton.yPosition, InterfaceWirelessSection.TITLE_HEIGHT)
|
||||
&& mouseY <= Math.min(optionsButton.yPosition + optionsButton.height, viewHeight)) {
|
||||
optionsButton.func_146113_a(mc.getSoundHandler());
|
||||
DimensionalCoord blockPos = new DimensionalCoord(x, y, z, dim);
|
||||
@@ -1280,25 +1371,11 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
blockPos.getDimension(),
|
||||
ForgeDirection.getOrientation(side)));
|
||||
} else {
|
||||
/* View in world */
|
||||
WorldCoord blockPos2 = new WorldCoord(
|
||||
(int) mc.thePlayer.posX,
|
||||
(int) mc.thePlayer.posY,
|
||||
(int) mc.thePlayer.posZ);
|
||||
if (mc.theWorld.provider.dimensionId != dim) {
|
||||
mc.thePlayer.addChatMessage(
|
||||
new ChatComponentTranslation(PlayerMessages.InterfaceInOtherDim.getName(), dim));
|
||||
} else {
|
||||
BlockPosHighlighter.highlightBlock(
|
||||
blockPos,
|
||||
System.currentTimeMillis() + 500 * WorldCoord.getTaxicabDistance(blockPos, blockPos2));
|
||||
mc.thePlayer.addChatMessage(
|
||||
new ChatComponentTranslation(
|
||||
PlayerMessages.InterfaceHighlighted.getName(),
|
||||
blockPos.x,
|
||||
blockPos.y,
|
||||
blockPos.z));
|
||||
}
|
||||
BlockPosHighlighter.highlightBlocks(
|
||||
mc.thePlayer,
|
||||
Collections.singletonList(blockPos),
|
||||
PlayerMessages.InterfaceHighlighted.getName(),
|
||||
PlayerMessages.InterfaceInOtherDim.getName());
|
||||
mc.thePlayer.closeScreen();
|
||||
}
|
||||
return true;
|
||||
@@ -1307,7 +1384,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
|
||||
int offsetY = mouseY - dispY;
|
||||
int offsetX = mouseX - (VIEW_WIDTH - rowSize * 18) - 1;
|
||||
if (offsetX >= 0 && offsetX < (rowSize * 18)
|
||||
&& mouseY > Math.max(dispY, IfaceSection.TITLE_HEIGHT)
|
||||
&& mouseY > Math.max(dispY, InterfaceWirelessSection.TITLE_HEIGHT)
|
||||
&& offsetY < Math.min(viewHeight - dispY, guiHeight)) {
|
||||
final int col = offsetX / 18;
|
||||
final int row = offsetY / 18;
|
||||
|
||||
@@ -2,10 +2,10 @@ package com.glodblock.github.client.gui;
|
||||
|
||||
import static com.glodblock.github.client.gui.container.ContainerLevelMaintainer.createLevelValues;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
@@ -40,6 +40,7 @@ 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;
|
||||
@@ -47,12 +48,16 @@ import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotFake;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketNEIDragClick;
|
||||
import codechicken.nei.VisiblityData;
|
||||
import codechicken.nei.api.INEIGuiHandler;
|
||||
import codechicken.nei.api.TaggedInventoryArea;
|
||||
import cofh.core.render.CoFHFontRenderer;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
@Optional.Interface(modid = "NotEnoughItems", iface = "codechicken.nei.api.INEIGuiHandler")
|
||||
@@ -72,6 +77,10 @@ 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;
|
||||
@@ -130,6 +139,12 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
}
|
||||
for (IAEItemStack is : list) {
|
||||
NBTTagCompound data = is.getItemStack().getTagCompound();
|
||||
if (data == null) {
|
||||
if (AEConfig.instance.isFeatureEnabled(AEFeature.PacketLogging)) {
|
||||
AELog.info("Received empty configuration: ", is);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
long batch = data.getLong(TLMTags.Batch.tagName);
|
||||
long quantity = data.getLong(TLMTags.Quantity.tagName);
|
||||
int idx = data.getInteger(TLMTags.Index.tagName);
|
||||
@@ -142,7 +157,6 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.lastWorkingTick = this.refreshTick;
|
||||
@@ -224,9 +238,8 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
} else {
|
||||
fake.setStackSize(0);
|
||||
}
|
||||
float lastZLevel = this.zLevel;
|
||||
this.zLevel = 0f;
|
||||
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
|
||||
aeRenderItem.setAeStack(fake);
|
||||
aeRenderItem.renderItemOverlayIntoGUI(
|
||||
fontRendererObj,
|
||||
mc.getTextureManager(),
|
||||
@@ -234,7 +247,6 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
slot.xDisplayPosition,
|
||||
slot.yDisplayPosition);
|
||||
GL11.glTranslatef(0.0f, 0.0f, -200.0f);
|
||||
this.zLevel = lastZLevel;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -271,7 +283,7 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
this.input.textboxKeyTyped(character, key);
|
||||
}
|
||||
super.keyTyped(character, key);
|
||||
if (!this.input.getText().matches("^[0-9]+")) {
|
||||
if (!numberPattern.matcher(this.input.getText()).matches()) {
|
||||
this.input.setTextColor(0xFF0000);
|
||||
} else {
|
||||
this.input.setTextColor(0xFFFFFF);
|
||||
@@ -311,19 +323,18 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public GuiType getOriginalGui() {
|
||||
return originalGui;
|
||||
}
|
||||
|
||||
public void switchGui() {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketLevelTerminalCommands(
|
||||
CPacketLevelTerminalCommands.Action.BACK,
|
||||
originalBlockPos.x,
|
||||
originalBlockPos.y,
|
||||
originalBlockPos.z,
|
||||
originalBlockPos.getDimension(),
|
||||
originalBlockPos.getSide()));
|
||||
CPacketLevelTerminalCommands message = new CPacketLevelTerminalCommands(
|
||||
CPacketLevelTerminalCommands.Action.BACK,
|
||||
originalBlockPos.x,
|
||||
originalBlockPos.y,
|
||||
originalBlockPos.z,
|
||||
originalBlockPos.getDimension(),
|
||||
originalBlockPos.getSide());
|
||||
if (originalGui != null) {
|
||||
message.setOriginalGui(originalGui.ordinal());
|
||||
}
|
||||
FluidCraft.proxy.netHandler.sendToServer(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -341,24 +352,29 @@ 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) {
|
||||
for (SlotFluidConvertingFake slot : this.cont.getRequestSlots()) {
|
||||
if (getSlotArea(slot).contains(mouseX, mouseY)) {
|
||||
if (draggedStack == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
draggedStack.stackSize = 0;
|
||||
Slot slotAtPosition = this.getSlotAtPosition(mouseX, mouseY);
|
||||
if (slotAtPosition == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.cont.getRequestSlots().length; i++) {
|
||||
SlotFluidConvertingFake slot = this.cont.getRequestSlots()[i];
|
||||
if (slotAtPosition.equals(slot)) {
|
||||
ItemStack itemStack = createLevelValues(draggedStack.copy());
|
||||
itemStack.getTagCompound().setInteger(TLMTags.Index.tagName, i);
|
||||
slot.putStack(itemStack);
|
||||
NetworkHandler.instance.sendToServer(new PacketNEIDragClick(itemStack, slot.getSlotIndex()));
|
||||
this.updateAmount(slot.getSlotIndex(), itemStack.stackSize);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (draggedStack != null) {
|
||||
draggedStack.stackSize = 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -378,9 +394,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;
|
||||
@@ -403,7 +418,12 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
|
||||
private boolean send(Widget widget) {
|
||||
if (((SlotFluidConvertingFake) cont.inventorySlots.get(widget.idx)).getHasStack()) {
|
||||
if (!widget.textField.getText().isEmpty() && widget.textField.getText().matches("^[0-9]+")) {
|
||||
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(
|
||||
@@ -529,7 +549,7 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
this.textField = textField;
|
||||
this.textField.setEnableBackgroundDrawing(false);
|
||||
this.textField.setText("0");
|
||||
this.textField.setMaxStringLength(10); // this length is enough to useful
|
||||
this.textField.setMaxStringLength(16); // this length is enough to be useful
|
||||
this.idx = idx;
|
||||
this.action = action;
|
||||
this.tooltip = tooltip;
|
||||
|
||||
@@ -9,12 +9,15 @@ import static com.glodblock.github.network.SPacketLevelTerminalUpdate.PacketOver
|
||||
import static com.glodblock.github.network.SPacketLevelTerminalUpdate.PacketRemove;
|
||||
import static com.glodblock.github.network.SPacketLevelTerminalUpdate.PacketRename;
|
||||
|
||||
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;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
@@ -25,13 +28,13 @@ 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.resources.I18n;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
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;
|
||||
@@ -57,11 +60,12 @@ import com.glodblock.github.util.NameConst;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.TerminalFontSize;
|
||||
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;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
@@ -80,10 +84,11 @@ import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.ReadableNumberConverter;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextField {
|
||||
public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextField, IGuiTooltipHandler {
|
||||
|
||||
public static final int HEADER_HEIGHT = 52;
|
||||
public static final int INV_HEIGHT = 98;
|
||||
@@ -113,11 +118,12 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
// private GuiFCImgButton modeSwitchEdit;
|
||||
private final LevelTerminalList masterList = new LevelTerminalList();
|
||||
private final List<String> extraOptionsText = new ArrayList<>(2);
|
||||
private static final float ITEM_STACK_Z = 1.0f;
|
||||
private static final float SLOT_Z = 0.5f;
|
||||
private static final float ITEM_STACK_OVERLAY_Z = 20.0f;
|
||||
private static final float SLOT_HOVER_Z = 31.0f;
|
||||
private static final float TOOLTIP_Z = 200.0f;
|
||||
private static final float ITEM_STACK_Z = 100.0f;
|
||||
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;
|
||||
private static final float STEP_Z = 10.0f;
|
||||
private static final float MAGIC_RENDER_ITEM_Z = 50.0f;
|
||||
|
||||
public GuiLevelTerminal(InventoryPlayer inventoryPlayer, Container container) {
|
||||
super(inventoryPlayer, container);
|
||||
@@ -168,7 +174,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
@@ -275,7 +280,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));
|
||||
@@ -341,8 +345,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
|
||||
if (btn == terminalStyleBox) {
|
||||
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
|
||||
|
||||
reinitialize();
|
||||
super.scheduleGuiResize();
|
||||
}
|
||||
|
||||
iBtn.set(next);
|
||||
@@ -351,11 +354,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);
|
||||
@@ -384,7 +382,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();
|
||||
@@ -439,32 +436,14 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
/*
|
||||
* Render title
|
||||
*/
|
||||
GL11.glTranslatef(0.0f, 0.0f, 50f);
|
||||
mc.getTextureManager().bindTexture(TEX_BG);
|
||||
if (sectionBottom > 0 && sectionBottom < LevelTerminalSection.TITLE_HEIGHT) {
|
||||
/* Transition draw */
|
||||
drawTexturedModalRect(
|
||||
0,
|
||||
0,
|
||||
VIEW_LEFT,
|
||||
HEADER_HEIGHT + LevelTerminalSection.TITLE_HEIGHT - sectionBottom,
|
||||
VIEW_WIDTH,
|
||||
sectionBottom);
|
||||
fontRendererObj
|
||||
.drawString(section.name, 2, sectionBottom - LevelTerminalSection.TITLE_HEIGHT + 2, fontColor);
|
||||
title = sectionBottom;
|
||||
} else if (viewY < 0) {
|
||||
/* Hidden title draw */
|
||||
drawTexturedModalRect(0, 0, VIEW_LEFT, HEADER_HEIGHT, VIEW_WIDTH, LevelTerminalSection.TITLE_HEIGHT);
|
||||
fontRendererObj.drawString(section.name, 2, 2, fontColor);
|
||||
title = 0;
|
||||
} else {
|
||||
/* Normal title draw */
|
||||
drawTexturedModalRect(0, viewY, VIEW_LEFT, HEADER_HEIGHT, VIEW_WIDTH, LevelTerminalSection.TITLE_HEIGHT);
|
||||
fontRendererObj.drawString(section.name, 2, viewY + 2, fontColor);
|
||||
title = 0;
|
||||
}
|
||||
GL11.glTranslatef(0.0f, 0.0f, -50f);
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
Iterator<LevelTerminalEntry> visible = section.getVisible();
|
||||
@@ -484,6 +463,36 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
entry.configButton.yPosition = -1;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Render title
|
||||
*/
|
||||
mc.getTextureManager().bindTexture(TEX_BG);
|
||||
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z + ITEM_STACK_Z + STEP_Z);
|
||||
if (sectionBottom > 0 && sectionBottom < LevelTerminalSection.TITLE_HEIGHT) {
|
||||
/* Transition draw */
|
||||
drawTexturedModalRect(
|
||||
0,
|
||||
0,
|
||||
VIEW_LEFT,
|
||||
HEADER_HEIGHT + LevelTerminalSection.TITLE_HEIGHT - sectionBottom,
|
||||
VIEW_WIDTH,
|
||||
sectionBottom);
|
||||
fontRendererObj
|
||||
.drawString(section.name, 2, sectionBottom - LevelTerminalSection.TITLE_HEIGHT + 2, fontColor);
|
||||
} else if (viewY < 0) {
|
||||
/* Hidden title draw */
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glTranslatef(0.0f, 0.0f, 100f);
|
||||
drawTexturedModalRect(0, 0, VIEW_LEFT, HEADER_HEIGHT, VIEW_WIDTH, LevelTerminalSection.TITLE_HEIGHT);
|
||||
fontRendererObj.drawString(section.name, 2, 2, fontColor);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
} else {
|
||||
/* Normal title draw */
|
||||
drawTexturedModalRect(0, viewY, VIEW_LEFT, HEADER_HEIGHT, VIEW_WIDTH, LevelTerminalSection.TITLE_HEIGHT);
|
||||
fontRendererObj.drawString(section.name, 2, viewY + 2, fontColor);
|
||||
}
|
||||
GL11.glTranslatef(0.0f, 0.0f, -(ITEM_STACK_OVERLAY_Z + ITEM_STACK_Z + STEP_Z));
|
||||
|
||||
return LevelTerminalSection.TITLE_HEIGHT + renderY;
|
||||
}
|
||||
|
||||
@@ -575,23 +584,17 @@ 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();
|
||||
aeRenderItem.zLevel = 3.0f - 50.0f;
|
||||
itemStack.stackSize = 0;
|
||||
aeRenderItem.setAeStack(null);
|
||||
aeRenderItem.zLevel = ITEM_STACK_Z - MAGIC_RENDER_ITEM_Z;
|
||||
aeRenderItem.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), itemStack, 0, 0);
|
||||
aeRenderItem.zLevel = 0.0f;
|
||||
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z - ITEM_STACK_Z);
|
||||
itemStack.stackSize = (int) quantity;
|
||||
aeRenderItem.renderItemOverlayIntoGUI(fontRendererObj, mc.getTextureManager(), itemStack, 0, 0);
|
||||
if (batch > 0) {
|
||||
itemStack.stackSize = (int) batch;
|
||||
aeRenderItem
|
||||
.renderItemOverlayIntoGUI(fontRendererObj, mc.getTextureManager(), itemStack, 0, -11);
|
||||
}
|
||||
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z - ITEM_STACK_Z);
|
||||
int color = switch (state) {
|
||||
case Idle -> FCGuiColors.StateIdle.getColor();
|
||||
case Craft -> FCGuiColors.StateCraft.getColor();
|
||||
@@ -602,6 +605,11 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
int offset = 0;
|
||||
int size = 4;
|
||||
drawRect(offset, offset, offset + size, offset + size, color);
|
||||
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z - ITEM_STACK_Z);
|
||||
this.drawReadableAmount(fontRendererObj, quantity, true, 16777215);
|
||||
if (batch > 0) {
|
||||
this.drawReadableAmount(fontRendererObj, batch, false, 16777215);
|
||||
}
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
/*
|
||||
@@ -628,8 +636,6 @@ 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);
|
||||
}
|
||||
@@ -639,9 +645,55 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
return relY + 1;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void drawReadableAmount(final FontRenderer fontRenderer, long amount, boolean alignBottom, int color) {
|
||||
final TerminalFontSize fontSize = AEConfig.instance.getTerminalFontSize();
|
||||
final String stackSize = this.getToBeRenderedStackSize(amount, fontSize);
|
||||
final boolean unicodeFlag = fontRenderer.getUnicodeFlag();
|
||||
float scaleFactor = 0.85f;
|
||||
float shiftX = 0f;
|
||||
float shiftY = 0f;
|
||||
|
||||
if (fontSize == TerminalFontSize.SMALL) {
|
||||
scaleFactor = 0.5f;
|
||||
shiftX = -2.0f;
|
||||
shiftY = -1.0f;
|
||||
}
|
||||
|
||||
final float inverseScaleFactor = 1.0f / scaleFactor;
|
||||
|
||||
fontRenderer.setUnicodeFlag(false);
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScaled(scaleFactor, scaleFactor, scaleFactor);
|
||||
|
||||
final int X = (int) ((shiftX + 16.0f + 1.0f - fontRenderer.getStringWidth(stackSize) * scaleFactor)
|
||||
* inverseScaleFactor);
|
||||
final int Y = (int) (alignBottom ? (shiftY + 16.0f - 7.0f * scaleFactor) * inverseScaleFactor : 1);
|
||||
|
||||
fontRenderer.drawString(stackSize, X + 1, Y, 0);
|
||||
fontRenderer.drawString(stackSize, X - 1, Y, 0);
|
||||
fontRenderer.drawString(stackSize, X, Y + 1, 0);
|
||||
fontRenderer.drawString(stackSize, X, Y - 1, 0);
|
||||
|
||||
fontRenderer.drawString(stackSize, X, Y, color);
|
||||
|
||||
GL11.glPopMatrix();
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
fontRenderer.setUnicodeFlag(unicodeFlag);
|
||||
}
|
||||
|
||||
private String getToBeRenderedStackSize(final long originalSize, TerminalFontSize fontSize) {
|
||||
if (fontSize == TerminalFontSize.SMALL) {
|
||||
return ReadableNumberConverter.INSTANCE.toWideReadableForm(originalSize);
|
||||
} else {
|
||||
return ReadableNumberConverter.INSTANCE.toSlimReadableForm(originalSize);
|
||||
}
|
||||
}
|
||||
|
||||
@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();
|
||||
@@ -827,10 +879,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);
|
||||
@@ -883,6 +931,26 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
|
||||
@Override
|
||||
public List<String> handleItemTooltip(ItemStack stack, int mouseX, int mouseY, List<String> currentToolTip) {
|
||||
|
||||
if (stack != null && isShiftKeyDown() && stack.hasTagCompound()) {
|
||||
NBTTagCompound data = stack.getTagCompound();
|
||||
|
||||
if (data.hasKey(TLMTags.Quantity.tagName)) {
|
||||
long quantity = data.getLong(TLMTags.Quantity.tagName);
|
||||
long batch = data.getLong(TLMTags.Batch.tagName);
|
||||
|
||||
currentToolTip.add(
|
||||
I18n.format(NameConst.TT_LEVEL_MAINTAINER_REQUEST_SIZE, "\n", false) + ": "
|
||||
+ NumberFormat.getNumberInstance(Locale.US).format(quantity));
|
||||
|
||||
if (batch > 0) {
|
||||
currentToolTip.add(
|
||||
I18n.format(NameConst.TT_LEVEL_MAINTAINER_BATCH_SIZE, "\n", false) + ": "
|
||||
+ NumberFormat.getNumberInstance(Locale.US).format(batch));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@@ -901,7 +969,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;
|
||||
@@ -1143,8 +1210,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;
|
||||
@@ -1153,16 +1218,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 {
|
||||
@@ -1192,7 +1254,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
}
|
||||
|
||||
LevelTerminalEntry setIcons(ItemStack selfItemStack, ItemStack displayItemStack) {
|
||||
this.selfItemStack = selfItemStack;
|
||||
this.displayItemStack = displayItemStack;
|
||||
|
||||
return this;
|
||||
@@ -1240,8 +1301,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;
|
||||
}
|
||||
@@ -1256,7 +1315,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,
|
||||
@@ -1274,23 +1333,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;
|
||||
}
|
||||
@@ -1306,30 +1354,23 @@ 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) {
|
||||
ItemStack itemStack = getInventory().getStackInSlot(slotIdx);
|
||||
if (itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey(TLMTags.Stack.tagName)) {
|
||||
if (itemStack != null && itemStack.hasTagCompound()
|
||||
&& itemStack.getTagCompound().hasKey(TLMTags.Stack.tagName)) {
|
||||
long batch = itemStack.getTagCompound().getLong(TLMTags.Batch.tagName);
|
||||
NBTTagCompound stackData = itemStack.getTagCompound().getCompoundTag(TLMTags.Stack.tagName);
|
||||
ItemStack is = ItemStack.loadItemStackFromNBT(stackData);
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
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.xPosition = this.guiLeft + 50;
|
||||
this.amountTextField.setText(String.valueOf(DEFAULT_VALUE));
|
||||
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 int 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,8 @@ public class GuiRenamer extends AEBaseGui implements IDropToFillTextField {
|
||||
|
||||
protected ItemStack icon = null;
|
||||
|
||||
protected GuiType originalGui;
|
||||
|
||||
public GuiRenamer(InventoryPlayer ip, ITerminalHost monitorable) {
|
||||
super(new ContainerRenamer(ip, monitorable));
|
||||
this.host = monitorable;
|
||||
@@ -44,19 +46,22 @@ public class GuiRenamer extends AEBaseGui implements IDropToFillTextField {
|
||||
this.textField.setMaxStringLength(32);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketRenamer(CPacketRenamer.Action.GET_TEXT));
|
||||
if (host instanceof PartLevelTerminal) {
|
||||
icon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
|
||||
originalGui = GuiType.LEVEL_TERMINAL;
|
||||
} else if (host instanceof IWirelessTerminal terminal && terminal.isUniversal(host)) {
|
||||
icon = ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack();
|
||||
originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
|
||||
} else if (host instanceof WirelessLevelTerminalInventory) {
|
||||
icon = ItemAndBlockHolder.WIRELESS_LEVEL_TERM.stack();
|
||||
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
|
||||
} else if (host instanceof WirelessInterfaceTerminalInventory) {
|
||||
icon = ItemAndBlockHolder.WIRELESS_INTERFACE_TERM.stack();
|
||||
originalGui = GuiType.WIRELESS_INTERFACE_TERMINAL;
|
||||
}
|
||||
if (this.icon != null) {
|
||||
this.buttonList.add(
|
||||
@@ -114,13 +119,9 @@ public class GuiRenamer extends AEBaseGui implements IDropToFillTextField {
|
||||
}
|
||||
|
||||
public void switchGui() {
|
||||
if (host instanceof PartLevelTerminal) InventoryHandler.switchGui(GuiType.LEVEL_TERMINAL);
|
||||
else if (host instanceof IWirelessTerminal terminal && terminal.isUniversal(host))
|
||||
InventoryHandler.switchGui(ItemWirelessUltraTerminal.readMode(terminal.getItemStack()));
|
||||
else if (host instanceof WirelessInterfaceTerminalInventory)
|
||||
InventoryHandler.switchGui(GuiType.WIRELESS_INTERFACE_TERMINAL);
|
||||
else if (host instanceof WirelessLevelTerminalInventory)
|
||||
InventoryHandler.switchGui(GuiType.WIRELESS_LEVEL_TERMINAL);
|
||||
if (originalGui != null) {
|
||||
InventoryHandler.switchGui(originalGui);
|
||||
}
|
||||
}
|
||||
|
||||
public void setTextFieldValue(final String displayName, final int mousex, final int mousey, final ItemStack stack) {
|
||||
|
||||
@@ -61,7 +61,6 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
|
||||
|
||||
public abstract void setOffsetY(int y);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void drawSwitchGuiBtns() {
|
||||
if (!drawSwitchGuiBtn) return;
|
||||
if (!termBtns.isEmpty()) {
|
||||
@@ -131,12 +130,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,13 +39,13 @@ public abstract class FCGuiAmount extends AEBaseGui {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
final int a = AEConfig.instance.craftItemsByStackAmounts(0);
|
||||
final int b = AEConfig.instance.craftItemsByStackAmounts(1);
|
||||
final int c = AEConfig.instance.craftItemsByStackAmounts(2);
|
||||
final int d = AEConfig.instance.craftItemsByStackAmounts(3);
|
||||
|
||||
final int a = getIncrementQuantity(0);
|
||||
final int b = getIncrementQuantity(1);
|
||||
final int c = getIncrementQuantity(2);
|
||||
final int d = getIncrementQuantity(3);
|
||||
|
||||
this.buttonList.add(this.plus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 26, 22, 20, "+" + a));
|
||||
this.buttonList.add(this.plus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 26, 28, 20, "+" + b));
|
||||
@@ -85,6 +85,10 @@ public abstract class FCGuiAmount extends AEBaseGui {
|
||||
this.amountBox.setFocused(true);
|
||||
}
|
||||
|
||||
protected int getIncrementQuantity(int i) {
|
||||
return AEConfig.instance.craftItemsByStackAmounts(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.bindTexture(getBackground());
|
||||
|
||||
@@ -5,6 +5,8 @@ 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;
|
||||
import com.glodblock.github.client.gui.GuiFCImgButton;
|
||||
@@ -15,7 +17,6 @@ import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.slot.SlotSingleItem;
|
||||
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
@@ -23,7 +24,6 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.client.render.AppEngRenderItem;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.container.slot.SlotFake;
|
||||
import appeng.util.item.AEItemStack;
|
||||
@@ -54,7 +54,6 @@ public abstract class FCGuiEncodeTerminal extends GuiItemMonitor {
|
||||
protected GuiFCImgButton autoFillPatternEnableBtn;
|
||||
protected GuiFCImgButton autoFillPatternDisableBtn;
|
||||
protected final GuiScrollbar processingScrollBar = new GuiScrollbar();
|
||||
protected final AppEngRenderItem stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
|
||||
|
||||
public FCGuiEncodeTerminal(final InventoryPlayer inventoryPlayer, final ITerminalHost te,
|
||||
final FCContainerEncodeTerminal c) {
|
||||
@@ -118,10 +117,10 @@ public abstract class FCGuiEncodeTerminal extends GuiItemMonitor {
|
||||
"PatternTerminal.Combine",
|
||||
this.combineDisableBtn == btn ? "1" : "0"));
|
||||
} else if (ModAndClassUtil.isDoubleButton && doubleBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns(
|
||||
"PatternTerminal.Double",
|
||||
Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? "1" : "0"));
|
||||
int val = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? 1 : 0;
|
||||
if (Mouse.isButtonDown(1)) val |= 0b10;
|
||||
FluidCraft.proxy.netHandler
|
||||
.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.Double", String.valueOf(val)));
|
||||
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsDisabledBtn == btn) {
|
||||
FluidCraft.proxy.netHandler
|
||||
.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "1"));
|
||||
@@ -184,13 +183,15 @@ public abstract class FCGuiEncodeTerminal extends GuiItemMonitor {
|
||||
if (ItemFluidPacket.getFluidStack(stack) != null && ItemFluidPacket.getFluidStack(stack).amount > 0)
|
||||
fake.setStackSize(ItemFluidPacket.getFluidStack(stack).amount);
|
||||
} else return true;
|
||||
stackSizeRenderer.setAeStack(fake);
|
||||
stackSizeRenderer.renderItemOverlayIntoGUI(
|
||||
aeRenderItem.setAeStack(fake);
|
||||
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
|
||||
aeRenderItem.renderItemOverlayIntoGUI(
|
||||
fontRendererObj,
|
||||
mc.getTextureManager(),
|
||||
stack.getItemStack(),
|
||||
slot.xDisplayPosition,
|
||||
slot.yDisplayPosition);
|
||||
GL11.glTranslatef(0.0f, 0.0f, -200.0f);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -101,6 +102,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
|
||||
protected GuiImgButton terminalStyleBox;
|
||||
protected GuiImgButton searchStringSave;
|
||||
protected GuiImgButton typeFilter;
|
||||
protected boolean hasShiftKeyDown = false;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public FCGuiMonitor(final InventoryPlayer inventoryPlayer, final ITerminalHost te, final FCContainerMonitor<T> c) {
|
||||
@@ -159,20 +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() {
|
||||
this.buttonList.clear();
|
||||
this.initGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void initGui() {
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
|
||||
@@ -182,7 +179,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
|
||||
|
||||
final boolean hasNEI = IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.NEI);
|
||||
|
||||
final int NEI = 0;
|
||||
final int NEI = hasNEI ? 1 : 0;
|
||||
int top = hasNEI ? 22 : 0;
|
||||
|
||||
final int magicNumber = 114 + 1;
|
||||
@@ -216,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
|
||||
@@ -686,12 +684,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));
|
||||
}
|
||||
|
||||
+11
-1
@@ -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);
|
||||
|
||||
+100
-94
@@ -1,7 +1,6 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -23,7 +22,6 @@ import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.container.slot.SlotPlayerHotBar;
|
||||
import appeng.container.slot.SlotPlayerInv;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
|
||||
public class ContainerEssentiaMonitor extends ContainerFluidPortableCell {
|
||||
|
||||
@@ -37,110 +35,118 @@ public class ContainerEssentiaMonitor extends ContainerFluidPortableCell {
|
||||
Slot clickSlot = (Slot) this.inventorySlots.get(idx);
|
||||
if ((clickSlot instanceof SlotPlayerInv || clickSlot instanceof SlotPlayerHotBar) && clickSlot.getHasStack()
|
||||
&& AspectUtil.isEssentiaContainer(clickSlot.getStack())) {
|
||||
ItemStack tis = clickSlot.getStack();
|
||||
Map<Integer, IAEFluidStack> tmp = new HashMap<>();
|
||||
tmp.put(0, null);
|
||||
int index = Util.findItemInPlayerInvSlot(p, clickSlot.getStack());
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(tmp, tis, index));
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(index));
|
||||
}
|
||||
}
|
||||
return super.transferStackInSlot(p, idx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postChange(Iterable<IAEFluidStack> change, ItemStack fluidContainer, EntityPlayer player,
|
||||
int slotIndex) {
|
||||
for (IAEFluidStack fluid : change) {
|
||||
IAEFluidStack nfluid = this.monitor.getStorageList().findPrecise(fluid);
|
||||
ItemStack out = fluidContainer.copy();
|
||||
out.stackSize = 1;
|
||||
if (AspectUtil.isEmptyEssentiaContainer(fluidContainer) && AspectUtil.isEssentiaGas(fluid)) {
|
||||
// add essentia to jars
|
||||
if (nfluid.getStackSize() / AspectUtil.R <= 0) continue;
|
||||
final IAEFluidStack toExtract = nfluid.copy();
|
||||
MutablePair<Integer, ItemStack> fillStack = AspectUtil
|
||||
.fillEssentiaFromGas(out, toExtract.getFluidStack());
|
||||
if (fillStack == null || fillStack.right == null || fillStack.left <= 0) continue;
|
||||
toExtract.setStackSize((long) fillStack.left * fluidContainer.stackSize);
|
||||
IAEFluidStack tmp = this.host.getFluidInventory()
|
||||
.extractItems(toExtract, Actionable.SIMULATE, this.getActionSource());
|
||||
if (tmp == null) continue;
|
||||
fillStack.right.stackSize = (int) (tmp.getStackSize() / fillStack.left);
|
||||
this.dropItem(fillStack.right);
|
||||
out.stackSize = fillStack.right.stackSize;
|
||||
if (AspectUtil.isEssentiaContainer(fillStack.right)) {
|
||||
this.host.getFluidInventory().extractItems(toExtract, Actionable.MODULATE, this.getActionSource());
|
||||
if ((int) (tmp.getStackSize() % fillStack.left) / AspectUtil.R > 0) {
|
||||
this.dropItem(
|
||||
AspectUtil.setAspectAmount(
|
||||
fillStack.right,
|
||||
(int) (tmp.getStackSize() % fillStack.left) / AspectUtil.R,
|
||||
AspectUtil.getAspectFromGas(toExtract)),
|
||||
1);
|
||||
out.stackSize++;
|
||||
}
|
||||
}
|
||||
} else if (!AspectUtil.isEmptyEssentiaContainer(fluidContainer)) {
|
||||
// add essentia to ae network
|
||||
AEFluidStack fluidStack = AspectUtil.getAEGasFromContainer(fluidContainer);
|
||||
if (fluidStack == null) {
|
||||
continue;
|
||||
}
|
||||
final IAEFluidStack aeFluidStack = fluidStack.copy();
|
||||
// simulate result is incorrect. so I'm using other solution and ec2 both mod have same issues
|
||||
final IAEFluidStack notInserted = this.host.getFluidInventory()
|
||||
.injectItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
|
||||
MutablePair<Integer, ItemStack> drainStack = AspectUtil
|
||||
.drainEssentiaFromGas(out.copy(), aeFluidStack.getFluidStack());
|
||||
if (notInserted != null && notInserted.getStackSize() > 0 && drainStack != null) {
|
||||
if (fluidStack.getStackSize() == notInserted.getStackSize()) continue;
|
||||
aeFluidStack.decStackSize(notInserted.getStackSize());
|
||||
public void postChange(IAEFluidStack clientSelectedFluid, EntityPlayer player, int slotIndex, boolean shift) {
|
||||
ItemStack targetStack;
|
||||
if (slotIndex == -1) {
|
||||
targetStack = player.inventory.getItemStack();
|
||||
} else {
|
||||
targetStack = player.inventory.getStackInSlot(slotIndex);
|
||||
}
|
||||
final int containersRequested = shift ? targetStack.stackSize : 1;
|
||||
|
||||
if (drainStack.left > aeFluidStack.getStackSize()
|
||||
&& AspectUtil.isEssentiaContainer(drainStack.right)) {
|
||||
aeFluidStack.setStackSize(drainStack.left - aeFluidStack.getStackSize());
|
||||
this.host.getFluidInventory()
|
||||
.extractItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
|
||||
continue;
|
||||
}
|
||||
|
||||
// drop empty item
|
||||
this.dropItem(drainStack.right, (int) (aeFluidStack.getStackSize() / drainStack.left));
|
||||
out.stackSize = (int) (notInserted.getStackSize() / drainStack.left);
|
||||
if (AspectUtil.isEssentiaContainer(drainStack.right)) {
|
||||
if (notInserted.getStackSize() % drainStack.left > 0) {
|
||||
fluidStack.setStackSize((notInserted.getStackSize() % drainStack.left));
|
||||
AspectUtil.fillEssentiaFromGas(drainStack.right, fluidStack.getFluidStack());
|
||||
this.dropItem(drainStack.right, 1);
|
||||
}
|
||||
}
|
||||
if (slotIndex == -1) out.stackSize = fluidContainer.stackSize - out.stackSize;
|
||||
} else if (drainStack != null) {
|
||||
if (slotIndex == -1) {
|
||||
out.stackSize = fluidContainer.stackSize;
|
||||
} else {
|
||||
out.stackSize = (int) (fluidContainer.stackSize
|
||||
- (aeFluidStack.getStackSize() / drainStack.left));
|
||||
}
|
||||
this.dropItem(drainStack.right, fluidContainer.stackSize); // drop empty item
|
||||
}
|
||||
} else {
|
||||
continue;
|
||||
IAEFluidStack storedFluid = this.monitor.getStorageList().findPrecise(clientSelectedFluid);
|
||||
ItemStack out = targetStack.copy();
|
||||
out.stackSize = 1;
|
||||
if (AspectUtil.isEmptyEssentiaContainer(targetStack) && AspectUtil.isEssentiaGas(storedFluid)) {
|
||||
// add essentia to jars
|
||||
if (storedFluid.getStackSize() / AspectUtil.R <= 0) {
|
||||
return;
|
||||
}
|
||||
if (slotIndex == -1) {
|
||||
player.inventory.getItemStack().stackSize = player.inventory.getItemStack().stackSize - out.stackSize;
|
||||
if (player.inventory.getItemStack().stackSize > 0) {
|
||||
FluidCraft.proxy.netHandler.sendTo(
|
||||
new SPacketFluidUpdate(new HashMap<>(), player.inventory.getItemStack()),
|
||||
(EntityPlayerMP) player);
|
||||
final IAEFluidStack toExtract = storedFluid.copy();
|
||||
MutablePair<Integer, ItemStack> fillStack = AspectUtil.fillEssentiaFromGas(out, toExtract.getFluidStack());
|
||||
if (fillStack == null || fillStack.right == null || fillStack.left <= 0) {
|
||||
return;
|
||||
}
|
||||
toExtract.setStackSize((long) fillStack.left * containersRequested);
|
||||
IAEFluidStack tmp = this.host.getFluidInventory()
|
||||
.extractItems(toExtract, Actionable.SIMULATE, this.getActionSource());
|
||||
if (tmp == null) {
|
||||
return;
|
||||
}
|
||||
fillStack.right.stackSize = (int) (tmp.getStackSize() / fillStack.left);
|
||||
this.dropItem(fillStack.right);
|
||||
out.stackSize = fillStack.right.stackSize;
|
||||
if (AspectUtil.isEssentiaContainer(fillStack.right)) {
|
||||
this.host.getFluidInventory().extractItems(toExtract, Actionable.MODULATE, this.getActionSource());
|
||||
if ((int) (tmp.getStackSize() % fillStack.left) / AspectUtil.R > 0) {
|
||||
this.dropItem(
|
||||
AspectUtil.setAspectAmount(
|
||||
fillStack.right,
|
||||
(int) (tmp.getStackSize() % fillStack.left) / AspectUtil.R,
|
||||
AspectUtil.getAspectFromGas(toExtract)),
|
||||
1);
|
||||
out.stackSize++;
|
||||
}
|
||||
}
|
||||
} else if (!AspectUtil.isEmptyEssentiaContainer(targetStack)) {
|
||||
// add essentia to ae network
|
||||
ItemStack containerStack = targetStack.copy();
|
||||
containerStack.stackSize = containersRequested;
|
||||
IAEFluidStack fluidStack = AspectUtil.getAEGasFromContainer(containerStack);
|
||||
if (fluidStack == null) {
|
||||
return;
|
||||
}
|
||||
final IAEFluidStack aeFluidStack = fluidStack.copy();
|
||||
// simulate result is incorrect. so I'm using other solution and ec2 both mod have same issues
|
||||
final IAEFluidStack notInserted = this.host.getFluidInventory()
|
||||
.injectItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
|
||||
MutablePair<Integer, ItemStack> drainStack = AspectUtil
|
||||
.drainEssentiaFromGas(out.copy(), aeFluidStack.getFluidStack());
|
||||
if (notInserted != null && notInserted.getStackSize() > 0 && drainStack != null) {
|
||||
if (fluidStack.getStackSize() == notInserted.getStackSize()) {
|
||||
return;
|
||||
}
|
||||
aeFluidStack.decStackSize(notInserted.getStackSize());
|
||||
|
||||
if (drainStack.left > aeFluidStack.getStackSize() && AspectUtil.isEssentiaContainer(drainStack.right)) {
|
||||
aeFluidStack.setStackSize(drainStack.left - aeFluidStack.getStackSize());
|
||||
this.host.getFluidInventory()
|
||||
.extractItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
|
||||
return;
|
||||
}
|
||||
|
||||
// drop empty item
|
||||
this.dropItem(drainStack.right, (int) (aeFluidStack.getStackSize() / drainStack.left));
|
||||
out.stackSize = (int) (notInserted.getStackSize() / drainStack.left);
|
||||
if (AspectUtil.isEssentiaContainer(drainStack.right)) {
|
||||
if (notInserted.getStackSize() % drainStack.left > 0) {
|
||||
fluidStack.setStackSize((notInserted.getStackSize() % drainStack.left));
|
||||
AspectUtil.fillEssentiaFromGas(drainStack.right, fluidStack.getFluidStack());
|
||||
this.dropItem(drainStack.right, 1);
|
||||
}
|
||||
}
|
||||
if (slotIndex == -1) out.stackSize = targetStack.stackSize - out.stackSize;
|
||||
} else if (drainStack != null) {
|
||||
if (slotIndex == -1) {
|
||||
out.stackSize = targetStack.stackSize;
|
||||
} else {
|
||||
player.inventory.setItemStack(null);
|
||||
FluidCraft.proxy.netHandler
|
||||
.sendTo(new SPacketFluidUpdate(new HashMap<>()), (EntityPlayerMP) player);
|
||||
out.stackSize = (int) (targetStack.stackSize - (aeFluidStack.getStackSize() / drainStack.left));
|
||||
}
|
||||
} else {
|
||||
player.inventory.setInventorySlotContents(slotIndex, out.stackSize > 0 ? out : null);
|
||||
this.dropItem(drainStack.right, targetStack.stackSize); // drop empty item
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if (slotIndex == -1) {
|
||||
player.inventory.getItemStack().stackSize = player.inventory.getItemStack().stackSize - out.stackSize;
|
||||
if (player.inventory.getItemStack().stackSize > 0) {
|
||||
FluidCraft.proxy.netHandler.sendTo(
|
||||
new SPacketFluidUpdate(new HashMap<>(), player.inventory.getItemStack()),
|
||||
(EntityPlayerMP) player);
|
||||
} else {
|
||||
player.inventory.setItemStack(null);
|
||||
FluidCraft.proxy.netHandler.sendTo(new SPacketFluidUpdate(new HashMap<>()), (EntityPlayerMP) player);
|
||||
}
|
||||
} else {
|
||||
player.inventory.setInventorySlotContents(slotIndex, out.stackSize > 0 ? out : null);
|
||||
}
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
+40
@@ -9,14 +9,21 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import com.glodblock.github.common.item.ItemBaseWirelessTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
|
||||
import com.glodblock.github.common.parts.PartLevelTerminal;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.util.Ae2Reflect;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.crafting.ICraftingJob;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.container.implementations.ContainerCraftConfirm;
|
||||
import appeng.container.implementations.ContainerOptimizePatterns;
|
||||
import appeng.crafting.v2.CraftingJobV2;
|
||||
import appeng.tile.misc.TilePatternOptimizationMatrix;
|
||||
|
||||
public class ContainerFluidCraftConfirm extends ContainerCraftConfirm {
|
||||
|
||||
@@ -35,6 +42,9 @@ public class ContainerFluidCraftConfirm extends ContainerCraftConfirm {
|
||||
if (ah instanceof PartFluidPatternTerminalEx) {
|
||||
originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
|
||||
}
|
||||
if (ah instanceof PartLevelTerminal) {
|
||||
originalGui = GuiType.LEVEL_TERMINAL;
|
||||
}
|
||||
if (ah instanceof IWirelessTerminal) {
|
||||
ItemStack terminal = ((IWirelessTerminal) ah).getItemStack();
|
||||
if (terminal.getItem() instanceof ItemBaseWirelessTerminal) {
|
||||
@@ -57,4 +67,34 @@ public class ContainerFluidCraftConfirm extends ContainerCraftConfirm {
|
||||
originalGui);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optimizePatterns() {
|
||||
// only V2 supported
|
||||
IGrid grid = Ae2Reflect.getGrid(this);
|
||||
ICraftingJob result = Ae2Reflect.getResult(this);
|
||||
if (result instanceof CraftingJobV2 && !this.isSimulation()
|
||||
&& grid != null
|
||||
&& !grid.getMachines(TilePatternOptimizationMatrix.class).isEmpty()) {
|
||||
final IActionHost ah = this.getActionHost();
|
||||
if (ah instanceof IWirelessTerminal) {
|
||||
InventoryHandler.openGui(
|
||||
this.getInventoryPlayer().player,
|
||||
getWorld(),
|
||||
new BlockPos(((IWirelessTerminal) ah).getInventorySlot(), 0, 0),
|
||||
ForgeDirection.UNKNOWN,
|
||||
GuiType.FLUID_OPTIMIZE_PATTERNS_ITEM);
|
||||
} else if (this.getOpenContext() != null) {
|
||||
InventoryHandler.openGui(
|
||||
this.getInventoryPlayer().player,
|
||||
getWorld(),
|
||||
new BlockPos(this.getOpenContext().getTile()),
|
||||
Objects.requireNonNull(this.getOpenContext().getSide()),
|
||||
GuiType.FLUID_OPTIMIZE_PATTERNS);
|
||||
}
|
||||
if (this.getPlayerInv().player.openContainer instanceof ContainerOptimizePatterns cop) {
|
||||
cop.setResult(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+242
-230
@@ -3,7 +3,6 @@ package com.glodblock.github.client.gui.container;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -18,7 +17,7 @@ import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.base.FCContainerMonitor;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.network.CPacketFluidUpdate;
|
||||
import com.glodblock.github.network.SPacketFluidUpdate;
|
||||
import com.glodblock.github.network.SPacketMEUpdateBuffer;
|
||||
@@ -44,7 +43,6 @@ import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.me.helpers.ChannelPowerSrc;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
|
||||
|
||||
@@ -124,11 +122,8 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
|
||||
Slot clickSlot = (Slot) this.inventorySlots.get(idx);
|
||||
if ((clickSlot instanceof SlotPlayerInv || clickSlot instanceof SlotPlayerHotBar) && clickSlot.getHasStack()
|
||||
&& Util.FluidUtil.isFluidContainer(clickSlot.getStack())) {
|
||||
ItemStack tis = clickSlot.getStack();
|
||||
Map<Integer, IAEFluidStack> tmp = new HashMap<>();
|
||||
tmp.put(0, ItemFluidDrop.getAeFluidStack(AEItemStack.create(tis)));
|
||||
int index = Util.findItemInPlayerInvSlot(p, clickSlot.getStack());
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(tmp, tis, index));
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(index));
|
||||
}
|
||||
}
|
||||
return super.transferStackInSlot(p, idx);
|
||||
@@ -211,72 +206,26 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
|
||||
* @param slotIndex The slot. If index == -1, the cursor held itemstack. Else, slotIndex indicates which slot was
|
||||
* shift clicked on.
|
||||
*/
|
||||
public void postChange(Iterable<IAEFluidStack> change, ItemStack fluidContainer, EntityPlayer player,
|
||||
int slotIndex) {
|
||||
int cursorItems;
|
||||
public void postChange(IAEFluidStack fluid, EntityPlayer player, int slotIndex, boolean shift) {
|
||||
ItemStack targetStack;
|
||||
if (slotIndex == -1) {
|
||||
cursorItems = player.inventory.getItemStack().stackSize;
|
||||
targetStack = player.inventory.getItemStack();
|
||||
} else {
|
||||
cursorItems = player.inventory.getStackInSlot(slotIndex).stackSize;
|
||||
targetStack = player.inventory.getStackInSlot(slotIndex);
|
||||
}
|
||||
for (IAEFluidStack fluid : change) {
|
||||
// The primary output itemstack
|
||||
if (Util.FluidUtil.isEmpty(fluidContainer) && fluid != null) {
|
||||
// Situation 1.a: Empty fluid container, and nonnull slot
|
||||
extractFluid(fluid, fluidContainer, player, cursorItems);
|
||||
} else if (!Util.FluidUtil.isEmpty(fluidContainer)) {
|
||||
// Situation 2.a: We are holding a non-empty container.
|
||||
insertFluid(fluidContainer, player, slotIndex, cursorItems);
|
||||
// End of situation 2.a
|
||||
}
|
||||
// No op (Any other situation)
|
||||
// The primary output itemstack
|
||||
if (Util.FluidUtil.isEmpty(targetStack) && fluid != null) {
|
||||
// Situation 1.a: Empty fluid container, and nonnull slot
|
||||
extractFluid(fluid, player, slotIndex, shift);
|
||||
} else if (!Util.FluidUtil.isEmpty(targetStack)) {
|
||||
// Situation 2.a: We are holding a non-empty container.
|
||||
insertFluid(player, slotIndex, shift);
|
||||
// End of situation 2.a
|
||||
}
|
||||
// No op (Any other situation)
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert fluid into the ME system
|
||||
*
|
||||
* @param canSend the fluidstack to insert
|
||||
* @param results a tuple of at least size 3 to indicate outputs (1), (2), (3). This will be mutated!
|
||||
* @param numTanks number of tanks involved in the operation
|
||||
* @param fluidInTank how much fluid is in the tank initially
|
||||
* @return the amount of fluid remaining in output (3)
|
||||
* @see #insertFluid(ItemStack, EntityPlayer, int, int)
|
||||
*/
|
||||
private int insertME(IAEFluidStack canSend, int[] results, int numTanks, int fluidInTank) {
|
||||
final IAEFluidStack notInserted = this.host.getFluidInventory()
|
||||
.injectItems(canSend, Actionable.MODULATE, this.getActionSource());
|
||||
|
||||
// Check if we need to handle partial insertion.
|
||||
if (notInserted != null && notInserted.getStackSize() > 0) {
|
||||
if (canSend.getStackSize() == notInserted.getStackSize()) {
|
||||
// No-op for when system is full
|
||||
results[REM_IDX] = numTanks;
|
||||
return fluidInTank;
|
||||
}
|
||||
// Populate result list with outputs (1), (2), (3).
|
||||
results[REM_IDX] = (int) (notInserted.getStackSize() / fluidInTank);
|
||||
results[ACT_IDX] = numTanks - results[REM_IDX];
|
||||
|
||||
// If there is remaining fluid, set partial.
|
||||
final int remainder = (int) (notInserted.getStackSize() % fluidInTank);
|
||||
if (remainder > 0) {
|
||||
results[PARTIAL_IDX] = 1;
|
||||
results[ACT_IDX]--;
|
||||
return remainder;
|
||||
} else {
|
||||
results[PARTIAL_IDX] = 0;
|
||||
}
|
||||
} else {
|
||||
// Full operation successful
|
||||
results[REM_IDX] = 0;
|
||||
results[ACT_IDX] = numTanks;
|
||||
results[PARTIAL_IDX] = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* The insert operation. For input, we have a filled container stack. For outputs, we have the following:
|
||||
* <ol>
|
||||
@@ -286,119 +235,160 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
|
||||
* </ol>
|
||||
* In order above, the itemstack at `slotIndex` is transformed into the output.
|
||||
*/
|
||||
private void insertFluid(ItemStack fluidContainer, EntityPlayer player, int slotIndex, int heldContainers) {
|
||||
IAEFluidStack canSend;
|
||||
int fluidPerContainer;
|
||||
ItemStack partialStack = null;
|
||||
ItemStack emptyStack = null;
|
||||
int[] insertionResults = new int[3];
|
||||
private void insertFluid(EntityPlayer player, int slotIndex, boolean shift) {
|
||||
final ItemStack targetStack;
|
||||
if (slotIndex == -1) {
|
||||
targetStack = player.inventory.getItemStack();
|
||||
} else {
|
||||
targetStack = player.inventory.getStackInSlot(slotIndex);
|
||||
}
|
||||
final int containersRequestedToInsert = shift ? targetStack.stackSize : 1;
|
||||
|
||||
// 2 types of containers: IFluidContainerItem and FluidContainerRegistry
|
||||
// IFluidContainerItem - items are filled w/ volume (portable tanks)
|
||||
// FluidContainerRegistry - items are filled, or not (buckets)
|
||||
// The former is easy, the latter takes a bit more work.
|
||||
if (fluidContainer.getItem() instanceof IFluidContainerItem fcItem) {
|
||||
// Step 1: Find out how much fluid we can insert.
|
||||
canSend = AEFluidStack.create(fcItem.getFluid(fluidContainer));
|
||||
fluidPerContainer = (int) canSend.getStackSize();
|
||||
canSend.setStackSize((long) fluidPerContainer * fluidContainer.stackSize);
|
||||
|
||||
// Step 2: Find out how much fluid we can extract from the container. If this is null or 0, return.
|
||||
ItemStack test = fluidContainer.copy();
|
||||
// Step 1: Determine container characteristics and verify fluid to be extractable
|
||||
final int fluidPerContainer;
|
||||
final FluidStack fluidStackPerContainer;
|
||||
final boolean partialInsertSupported;
|
||||
if (targetStack.getItem() instanceof IFluidContainerItem fcItem) {
|
||||
ItemStack test = targetStack.copy();
|
||||
test.stackSize = 1;
|
||||
FluidStack fluidStack = fcItem.drain(test, fluidPerContainer, false);
|
||||
if (fluidStack == null || fluidStack.amount == 0) {
|
||||
fluidStackPerContainer = fcItem.drain(test, Integer.MAX_VALUE, false);
|
||||
if (fluidStackPerContainer == null || fluidStackPerContainer.amount == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Step 3: Find out how much fluid we can insert into the ME system
|
||||
int partialAmount = insertME(canSend, insertionResults, fluidContainer.stackSize, fluidPerContainer);
|
||||
|
||||
// Step 4: Separate the outputs into no drain (1), fully drained (2), and partially drained (3)
|
||||
// 4.1: Handle the partial stack
|
||||
if (insertionResults[PARTIAL_IDX] > 0) {
|
||||
partialStack = fluidContainer.copy();
|
||||
partialStack.stackSize = 1;
|
||||
fcItem.drain(partialStack, fluidPerContainer - partialAmount, true);
|
||||
}
|
||||
|
||||
// 4.2: Handle empty output
|
||||
if (insertionResults[ACT_IDX] > 0) {
|
||||
emptyStack = fluidContainer.copy();
|
||||
emptyStack.stackSize = 1;
|
||||
fcItem.drain(emptyStack, fluidPerContainer, true);
|
||||
emptyStack.stackSize = insertionResults[ACT_IDX];
|
||||
}
|
||||
} else if (FluidContainerRegistry.isContainer(fluidContainer)) {
|
||||
// Step 1: Find out how much fluid we can insert.
|
||||
canSend = AEFluidStack.create(FluidContainerRegistry.getFluidForFilledItem(fluidContainer));
|
||||
fluidPerContainer = (int) canSend.getStackSize();
|
||||
canSend.setStackSize((long) fluidPerContainer * fluidContainer.stackSize);
|
||||
// Step 2: Find out how much fluid we can extract from the container. If this is null or 0, return.
|
||||
ItemStack emptyTank = FluidContainerRegistry.drainFluidContainer(fluidContainer);
|
||||
fluidPerContainer = fluidStackPerContainer.amount;
|
||||
partialInsertSupported = true;
|
||||
} else if (FluidContainerRegistry.isContainer(targetStack)) {
|
||||
ItemStack emptyTank = FluidContainerRegistry.drainFluidContainer(targetStack);
|
||||
if (emptyTank == null) {
|
||||
return;
|
||||
}
|
||||
// Step 3: Find out how much fluid we can insert into the ME system
|
||||
int partialAmount = insertME(canSend, insertionResults, fluidContainer.stackSize, fluidPerContainer);
|
||||
|
||||
// Step 4: Separate the outputs into no drain (1), fully drained (2), and partially drained (3)
|
||||
// 4.1: Handle the partial stack
|
||||
if (partialAmount > 0) {
|
||||
// We now extract the extra amount from the ME system. Blame simulate not working :P
|
||||
int extract = FluidContainerRegistry.getContainerCapacity(fluidContainer) - partialAmount;
|
||||
if (extract > 0) {
|
||||
IAEFluidStack toExtract = canSend.copy().setStackSize(extract);
|
||||
this.host.getFluidInventory().extractItems(toExtract, Actionable.MODULATE, this.getActionSource());
|
||||
}
|
||||
insertionResults[PARTIAL_IDX] = 0;
|
||||
}
|
||||
|
||||
// 4.2: Handle empty output
|
||||
if (insertionResults[ACT_IDX] > 0) {
|
||||
emptyStack = FluidContainerRegistry.drainFluidContainer(fluidContainer);
|
||||
emptyStack.stackSize = insertionResults[ACT_IDX];
|
||||
}
|
||||
fluidStackPerContainer = FluidContainerRegistry.getFluidForFilledItem(targetStack);
|
||||
fluidPerContainer = fluidStackPerContainer.amount;
|
||||
partialInsertSupported = false;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
// Step 2: determine network capacity
|
||||
final IAEFluidStack totalFluid = AEFluidStack.create(fluidStackPerContainer);
|
||||
totalFluid.setStackSize((long) fluidPerContainer * containersRequestedToInsert);
|
||||
|
||||
final IAEFluidStack notInsertable = this.host.getFluidInventory()
|
||||
.injectItems(totalFluid, Actionable.SIMULATE, this.getActionSource());
|
||||
|
||||
final long insertableFluid;
|
||||
if (notInsertable == null || notInsertable.getStackSize() == 0) {
|
||||
insertableFluid = totalFluid.getStackSize();
|
||||
} else {
|
||||
long insertable = totalFluid.getStackSize() - notInsertable.getStackSize();
|
||||
if (partialInsertSupported) {
|
||||
insertableFluid = insertable;
|
||||
} else {
|
||||
// avoid remainder
|
||||
insertableFluid = insertable - (insertable % fluidPerContainer);
|
||||
}
|
||||
}
|
||||
totalFluid.setStackSize(insertableFluid);
|
||||
|
||||
// Step 3: perform insert
|
||||
final long totalInserted;
|
||||
final IAEFluidStack notInserted = this.host.getFluidInventory()
|
||||
.injectItems(totalFluid, Actionable.MODULATE, this.getActionSource());
|
||||
if (notInserted != null && notInserted.getStackSize() > 0) {
|
||||
// User has a setup that causes discrepancy between simulation and modulation. Likely double storage bus.
|
||||
long total = totalFluid.getStackSize() - notInserted.getStackSize();
|
||||
if (partialInsertSupported) {
|
||||
totalInserted = total;
|
||||
} else {
|
||||
// We cant have partially filled containers -> user will receive a fluid packet as last resort
|
||||
long overflowAmount = fluidPerContainer - (total % fluidPerContainer);
|
||||
IAEFluidStack overflow = AEFluidStack.create(fluidStackPerContainer);
|
||||
overflow.setStackSize(overflowAmount);
|
||||
dropItem(ItemFluidPacket.newStack(overflow));
|
||||
totalInserted = total + overflowAmount;
|
||||
}
|
||||
} else {
|
||||
totalInserted = totalFluid.getStackSize();
|
||||
}
|
||||
|
||||
// Step 4: calculate outputs
|
||||
final int emptiedTanks;
|
||||
final int partialDrain;
|
||||
if (fluidPerContainer > 0) {
|
||||
emptiedTanks = (int) (totalInserted / fluidPerContainer);
|
||||
partialDrain = (int) (totalInserted % fluidPerContainer);
|
||||
} else {
|
||||
emptiedTanks = containersRequestedToInsert;
|
||||
partialDrain = 0;
|
||||
}
|
||||
final int partialTanks = partialDrain > 0 && partialInsertSupported ? 1 : 0;
|
||||
final int usedTanks = emptiedTanks + partialTanks;
|
||||
final int untouchedTanks = targetStack.stackSize - usedTanks;
|
||||
|
||||
final ItemStack emptiedTanksStack;
|
||||
final ItemStack partialTanksStack;
|
||||
|
||||
if (targetStack.getItem() instanceof IFluidContainerItem fcItem) {
|
||||
if (emptiedTanks > 0) {
|
||||
emptiedTanksStack = targetStack.copy();
|
||||
emptiedTanksStack.stackSize = 1;
|
||||
fcItem.drain(emptiedTanksStack, fluidPerContainer, true);
|
||||
emptiedTanksStack.stackSize = emptiedTanks;
|
||||
} else {
|
||||
emptiedTanksStack = null;
|
||||
}
|
||||
if (partialTanks > 0) {
|
||||
partialTanksStack = targetStack.copy();
|
||||
partialTanksStack.stackSize = 1;
|
||||
fcItem.drain(partialTanksStack, partialDrain, true);
|
||||
} else {
|
||||
partialTanksStack = null;
|
||||
}
|
||||
} else {
|
||||
if (emptiedTanks > 0) {
|
||||
emptiedTanksStack = FluidContainerRegistry.drainFluidContainer(targetStack);
|
||||
emptiedTanksStack.stackSize = emptiedTanks;
|
||||
} else {
|
||||
emptiedTanksStack = null;
|
||||
}
|
||||
// Not possible > see Step 2 and Step 3
|
||||
partialTanksStack = null;
|
||||
}
|
||||
|
||||
// Done. Put the output in the inventory or ground, and update stack size.
|
||||
boolean shouldSendStack = true;
|
||||
int emptyTanks = insertionResults[ACT_IDX];
|
||||
int extraTanks = heldContainers - emptyTanks - insertionResults[PARTIAL_IDX];
|
||||
if (slotIndex == -1) {
|
||||
// Item is in mouse hand
|
||||
if (extraTanks > 0) {
|
||||
ItemStack stack = player.inventory.getItemStack();
|
||||
stack.stackSize = extraTanks;
|
||||
adjustStack(stack);
|
||||
dropItem(emptyStack);
|
||||
dropItem(partialStack);
|
||||
} else if (emptyTanks != 0) {
|
||||
adjustStack(emptyStack);
|
||||
player.inventory.setItemStack(emptyStack);
|
||||
dropItem(partialStack);
|
||||
} else if (partialStack != null) {
|
||||
player.inventory.setItemStack(partialStack);
|
||||
if (untouchedTanks > 0) {
|
||||
targetStack.stackSize = untouchedTanks;
|
||||
adjustStack(targetStack);
|
||||
dropItem(emptiedTanksStack);
|
||||
dropItem(partialTanksStack);
|
||||
} else if (emptiedTanksStack != null) {
|
||||
adjustStack(emptiedTanksStack);
|
||||
player.inventory.setItemStack(emptiedTanksStack);
|
||||
dropItem(partialTanksStack);
|
||||
} else if (partialTanksStack != null) {
|
||||
player.inventory.setItemStack(partialTanksStack);
|
||||
} else {
|
||||
player.inventory.setItemStack(null);
|
||||
shouldSendStack = false;
|
||||
}
|
||||
} else {
|
||||
// Shift clicked in
|
||||
ItemStack stack = player.inventory.getStackInSlot(slotIndex);
|
||||
if (extraTanks > 0) {
|
||||
stack.stackSize = extraTanks;
|
||||
adjustStack(stack);
|
||||
dropItem(emptyStack);
|
||||
dropItem(partialStack);
|
||||
} else if (emptyTanks != 0) {
|
||||
adjustStack(emptyStack);
|
||||
player.inventory.setInventorySlotContents(slotIndex, emptyStack);
|
||||
dropItem(partialStack);
|
||||
} else if (partialStack != null) {
|
||||
player.inventory.setInventorySlotContents(slotIndex, partialStack);
|
||||
if (untouchedTanks > 0) {
|
||||
targetStack.stackSize = untouchedTanks;
|
||||
adjustStack(targetStack);
|
||||
dropItem(emptiedTanksStack);
|
||||
dropItem(partialTanksStack);
|
||||
} else if (emptiedTanksStack != null) {
|
||||
adjustStack(emptiedTanksStack);
|
||||
player.inventory.setInventorySlotContents(slotIndex, emptiedTanksStack);
|
||||
dropItem(partialTanksStack);
|
||||
} else if (partialTanksStack != null) {
|
||||
player.inventory.setInventorySlotContents(slotIndex, partialTanksStack);
|
||||
} else {
|
||||
player.inventory.setItemStack(null);
|
||||
shouldSendStack = false;
|
||||
@@ -422,97 +412,119 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
|
||||
* </ol>
|
||||
* In order above, the itemstack at `slotIndex` is transformed into the output.
|
||||
*/
|
||||
private void extractFluid(IAEFluidStack fluid, ItemStack fluidContainer, EntityPlayer player, int heldContainers) {
|
||||
// Step 1: Check if fluid can actually get filled into the fluidContainer
|
||||
if (fluidContainer.getItem() instanceof IFluidContainerItem fcItem) {
|
||||
ItemStack testStack = fluidContainer.copy();
|
||||
private void extractFluid(IAEFluidStack clientRequestedFluid, EntityPlayer player, int slotIndex, boolean shift) {
|
||||
if (slotIndex != -1) {
|
||||
// shift-click from inventory cant fill fluids
|
||||
return;
|
||||
}
|
||||
final ItemStack targetStack = player.inventory.getItemStack();
|
||||
final int containersRequestedToExtract = shift ? targetStack.stackSize : 1;
|
||||
|
||||
final FluidStack clientRequestedFluidStack = clientRequestedFluid.getFluidStack();
|
||||
clientRequestedFluidStack.amount = Integer.MAX_VALUE;
|
||||
|
||||
// Step 1: Determine container characteristics and verify fluid to be insertable
|
||||
final int fluidPerContainer;
|
||||
final boolean partialInsertSupported;
|
||||
if (targetStack.getItem() instanceof IFluidContainerItem fcItem) {
|
||||
ItemStack testStack = targetStack.copy();
|
||||
testStack.stackSize = 1;
|
||||
int test = fcItem.fill(testStack, fluid.getFluidStack(), false);
|
||||
if (test == 0) {
|
||||
return;
|
||||
}
|
||||
} else if (FluidContainerRegistry.isContainer(fluidContainer)) {
|
||||
ItemStack test = FluidContainerRegistry.fillFluidContainer(fluid.getFluidStack(), fluidContainer);
|
||||
if (test == null) {
|
||||
fluidPerContainer = fcItem.fill(testStack, clientRequestedFluidStack, false);
|
||||
if (fluidPerContainer == 0) {
|
||||
return;
|
||||
}
|
||||
partialInsertSupported = true;
|
||||
} else if (FluidContainerRegistry.isContainer(targetStack)) {
|
||||
fluidPerContainer = FluidContainerRegistry.getContainerCapacity(clientRequestedFluidStack, targetStack);
|
||||
partialInsertSupported = false;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
IAEFluidStack storedFluid = this.monitor.getStorageList().findPrecise(fluid);
|
||||
if (storedFluid == null || storedFluid.getStackSize() <= 0) return;
|
||||
int capacity = Util.FluidUtil.getCapacity(fluidContainer, storedFluid.getFluid());
|
||||
if (capacity == 0) return;
|
||||
// The fluidstack that we will try to extract from the system.
|
||||
final IAEFluidStack canExtract = storedFluid.copy();
|
||||
// Maximum amount of fluid we can extract with the given container(s). Guarantees that we won't
|
||||
// run into issues w/ remainder fluid later.
|
||||
canExtract.setStackSize((long) capacity * fluidContainer.stackSize);
|
||||
IAEFluidStack actualExtract = this.host.getFluidInventory()
|
||||
.extractItems(canExtract, Actionable.MODULATE, this.getActionSource());
|
||||
if (actualExtract == null) return;
|
||||
// Calculate the number of full fluid containers we extracted
|
||||
long toExtract = actualExtract.getStackSize();
|
||||
int filledTanks = (int) (toExtract / capacity);
|
||||
int remainder = (int) (toExtract % capacity);
|
||||
int emptyTanks = heldContainers - filledTanks;
|
||||
// Fill the filled tanks
|
||||
ItemStack filledStack = fluidContainer.copy();
|
||||
filledStack.stackSize = 1;
|
||||
if (filledTanks > 0) {
|
||||
if (filledStack.getItem() instanceof IFluidContainerItem) {
|
||||
int amt = ((IFluidContainerItem) filledStack.getItem())
|
||||
.fill(filledStack, actualExtract.getFluidStack(), true);
|
||||
assert amt == capacity;
|
||||
} else {
|
||||
// Should not be NPE since we affirmed that we have enough capacity.
|
||||
filledStack = FluidContainerRegistry.fillFluidContainer(actualExtract.getFluidStack(), filledStack);
|
||||
assert capacity == FluidContainerRegistry.getContainerCapacity(filledStack);
|
||||
}
|
||||
filledStack.stackSize = filledTanks;
|
||||
} else {
|
||||
filledStack.stackSize = 0;
|
||||
|
||||
// Step 2: determine fluid in network
|
||||
final IAEFluidStack totalRequestedFluid = clientRequestedFluid.copy();
|
||||
totalRequestedFluid.setStackSize((long) fluidPerContainer * containersRequestedToExtract);
|
||||
|
||||
final IAEFluidStack availableFluid = this.host.getFluidInventory()
|
||||
.extractItems(totalRequestedFluid, Actionable.SIMULATE, this.getActionSource());
|
||||
if (availableFluid == null || availableFluid.getStackSize() == 0) {
|
||||
return;
|
||||
}
|
||||
// Calculate the remaining fluid to extract, if any
|
||||
ItemStack partialStack = fluidContainer.copy();
|
||||
if (remainder > 0) {
|
||||
actualExtract.setStackSize(remainder);
|
||||
partialStack.stackSize = 1;
|
||||
if (partialStack.getItem() instanceof IFluidContainerItem) {
|
||||
int amt = ((IFluidContainerItem) partialStack.getItem())
|
||||
.fill(partialStack, actualExtract.getFluidStack(), true);
|
||||
assert amt == remainder;
|
||||
emptyTanks--;
|
||||
|
||||
if (availableFluid.getStackSize() != totalRequestedFluid.getStackSize() && !partialInsertSupported) {
|
||||
availableFluid.decStackSize(availableFluid.getStackSize() % fluidPerContainer);
|
||||
}
|
||||
|
||||
// Step 3: perform extract
|
||||
final IAEFluidStack extracted = this.host.getFluidInventory()
|
||||
.extractItems(availableFluid, Actionable.MODULATE, this.getActionSource());
|
||||
final long totalExtracted = extracted != null ? extracted.getStackSize() : 0;
|
||||
|
||||
// Step 4: calculate outputs
|
||||
final int filledTanks = (int) (totalExtracted / fluidPerContainer);
|
||||
final int partialFill = (int) (totalExtracted % fluidPerContainer);
|
||||
final int partialTanks = partialFill > 0 && partialInsertSupported ? 1 : 0;
|
||||
final int usedTanks = filledTanks + partialTanks;
|
||||
final int untouchedTanks = targetStack.stackSize - usedTanks;
|
||||
|
||||
final ItemStack filledTanksStack;
|
||||
final ItemStack partialTanksStack;
|
||||
|
||||
if (targetStack.getItem() instanceof IFluidContainerItem fcItem) {
|
||||
if (filledTanks > 0) {
|
||||
filledTanksStack = targetStack.copy();
|
||||
filledTanksStack.stackSize = 1;
|
||||
FluidStack toInsert = extracted.getFluidStack().copy();
|
||||
toInsert.amount = fluidPerContainer;
|
||||
fcItem.fill(filledTanksStack, toInsert, true);
|
||||
filledTanksStack.stackSize = filledTanks;
|
||||
} else {
|
||||
ItemStack dummy = FluidContainerRegistry
|
||||
.fillFluidContainer(actualExtract.getFluidStack(), partialStack);
|
||||
if (dummy == null) {
|
||||
// Failed to fill partial...
|
||||
partialStack.stackSize = 0;
|
||||
} else {
|
||||
partialStack = dummy;
|
||||
emptyTanks--;
|
||||
}
|
||||
filledTanksStack = null;
|
||||
}
|
||||
if (partialTanks > 0) {
|
||||
partialTanksStack = targetStack.copy();
|
||||
partialTanksStack.stackSize = 1;
|
||||
FluidStack toInsert = extracted.getFluidStack().copy();
|
||||
toInsert.amount = partialFill;
|
||||
fcItem.fill(partialTanksStack, toInsert, true);
|
||||
} else {
|
||||
partialTanksStack = null;
|
||||
}
|
||||
} else {
|
||||
partialStack.stackSize = 0;
|
||||
if (filledTanks > 0) {
|
||||
FluidStack toInsert = extracted.getFluidStack().copy();
|
||||
toInsert.amount = fluidPerContainer;
|
||||
filledTanksStack = FluidContainerRegistry.fillFluidContainer(toInsert, targetStack);
|
||||
filledTanksStack.stackSize = filledTanks;
|
||||
} else {
|
||||
filledTanksStack = null;
|
||||
}
|
||||
if (partialFill > 0) {
|
||||
// User has a setup that causes discrepancy between simulation and modulation. Likely double storage
|
||||
// bus.
|
||||
// We cant have partially filled containers -> user will receive a fluid packet as last resort
|
||||
IAEFluidStack overflow = extracted.copy();
|
||||
overflow.setStackSize(partialFill);
|
||||
dropItem(ItemFluidPacket.newStack(overflow));
|
||||
}
|
||||
partialTanksStack = null;
|
||||
}
|
||||
|
||||
// Done. Put the output in the inventory or ground, and update stack size.
|
||||
// We can assume slotIndex == -1, since we don't actually allow extraction via shift click.
|
||||
boolean shouldSendStack = true;
|
||||
if (emptyTanks > 0) {
|
||||
if (untouchedTanks > 0) {
|
||||
ItemStack emptyStack = player.inventory.getItemStack();
|
||||
emptyStack.stackSize = emptyTanks;
|
||||
emptyStack.stackSize = untouchedTanks;
|
||||
adjustStack(emptyStack);
|
||||
dropItem(filledStack);
|
||||
dropItem(partialStack);
|
||||
} else if (filledStack.stackSize != 0) {
|
||||
adjustStack(filledStack);
|
||||
player.inventory.setItemStack(filledStack);
|
||||
dropItem(partialStack);
|
||||
} else if (partialStack.stackSize != 0) {
|
||||
player.inventory.setItemStack(partialStack);
|
||||
dropItem(filledTanksStack);
|
||||
dropItem(partialTanksStack);
|
||||
} else if (filledTanksStack != null) {
|
||||
adjustStack(filledTanksStack);
|
||||
player.inventory.setItemStack(filledTanksStack);
|
||||
dropItem(partialTanksStack);
|
||||
} else if (partialTanksStack != null) {
|
||||
player.inventory.setItemStack(partialTanksStack);
|
||||
} else {
|
||||
player.inventory.setItemStack(null);
|
||||
shouldSendStack = false;
|
||||
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.glodblock.github.common.item.ItemBaseWirelessTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
|
||||
import com.glodblock.github.common.parts.PartLevelTerminal;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.container.implementations.ContainerOptimizePatterns;
|
||||
|
||||
public class ContainerFluidOptimizePatterns extends ContainerOptimizePatterns {
|
||||
|
||||
public ContainerFluidOptimizePatterns(InventoryPlayer ip, ITerminalHost te) {
|
||||
super(ip, te);
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
return this.getPlayerInv().player.worldObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switchToOriginalGUI() {
|
||||
GuiType originalGui = null;
|
||||
|
||||
final IActionHost ah = this.getActionHost();
|
||||
if (ah instanceof PartFluidPatternTerminal) {
|
||||
originalGui = GuiType.FLUID_PATTERN_TERMINAL;
|
||||
}
|
||||
if (ah instanceof PartFluidPatternTerminalEx) {
|
||||
originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
|
||||
}
|
||||
if (ah instanceof PartLevelTerminal) {
|
||||
originalGui = GuiType.LEVEL_TERMINAL;
|
||||
}
|
||||
if (ah instanceof IWirelessTerminal) {
|
||||
ItemStack terminal = ((IWirelessTerminal) ah).getItemStack();
|
||||
if (terminal.getItem() instanceof ItemBaseWirelessTerminal) {
|
||||
originalGui = ((ItemBaseWirelessTerminal) terminal.getItem()).guiGuiType(terminal);
|
||||
}
|
||||
}
|
||||
if (ah instanceof IWirelessTerminal) {
|
||||
InventoryHandler.openGui(
|
||||
this.getInventoryPlayer().player,
|
||||
getWorld(),
|
||||
new BlockPos(((IWirelessTerminal) ah).getInventorySlot(), 0, 0),
|
||||
ForgeDirection.UNKNOWN,
|
||||
originalGui);
|
||||
} else if (this.getOpenContext() != null) {
|
||||
InventoryHandler.openGui(
|
||||
this.getInventoryPlayer().player,
|
||||
getWorld(),
|
||||
new BlockPos(this.getOpenContext().getTile()),
|
||||
Objects.requireNonNull(this.getOpenContext().getSide()),
|
||||
originalGui);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -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);
|
||||
|
||||
+2
-2
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-1
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
+11
-4
@@ -93,6 +93,7 @@ public class ContainerLevelMaintainer extends AEBaseContainer {
|
||||
createLevelValues(Objects.requireNonNull(Util.copyStackWithSize(stack, 1))));
|
||||
}
|
||||
}
|
||||
default -> {}
|
||||
}
|
||||
} else {
|
||||
super.doAction(player, action, slotId, id);
|
||||
@@ -105,10 +106,13 @@ public class ContainerLevelMaintainer extends AEBaseContainer {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (SlotFluidConvertingFake slot : this.getRequestSlots()) {
|
||||
for (int i = 0; i < this.getRequestSlots().length; i++) {
|
||||
SlotFluidConvertingFake slot = this.getRequestSlots()[i];
|
||||
if (!slot.getHasStack()) {
|
||||
ItemStack itemStack = ((Slot) this.inventorySlots.get(idx)).getStack();
|
||||
slot.putConvertedStack(createLevelValues(itemStack.copy()));
|
||||
ItemStack configuration = createLevelValues(itemStack.copy());
|
||||
configuration.getTagCompound().setInteger(TLMTags.Index.tagName, i);
|
||||
slot.putConvertedStack(configuration);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -132,14 +136,17 @@ public class ContainerLevelMaintainer extends AEBaseContainer {
|
||||
data.setTag(TLMTags.Stack.tagName, itemStackTag);
|
||||
}
|
||||
if (!data.hasKey(TLMTags.Quantity.tagName)) {
|
||||
data.setLong(TLMTags.Quantity.tagName, itemStack.stackSize);
|
||||
data.setLong(TLMTags.Quantity.tagName, itemStack.stackSize > 0 ? itemStack.stackSize : 1);
|
||||
}
|
||||
if (!data.hasKey(TLMTags.Batch.tagName)) {
|
||||
data.setLong(TLMTags.Batch.tagName, 0);
|
||||
data.setLong(TLMTags.Batch.tagName, 1);
|
||||
}
|
||||
if (!data.hasKey(TLMTags.Enable.tagName)) {
|
||||
data.setBoolean(TLMTags.Enable.tagName, false);
|
||||
}
|
||||
if (data.hasKey(TLMTags.Index.tagName)) {
|
||||
data.removeTag(TLMTags.Index.tagName);
|
||||
}
|
||||
|
||||
data.setInteger(TLMTags.State.tagName, State.None.ordinal());
|
||||
itemStack.setTagCompound(data);
|
||||
|
||||
+10
-9
@@ -46,7 +46,7 @@ public class ContainerLevelTerminal extends FCBaseContainer {
|
||||
*/
|
||||
private int nextId = 0;
|
||||
|
||||
private final Map<ILevelViewable, ContainerLevelTerminal.InvTracker> tracked = new HashMap<>();
|
||||
private final Map<IGridHost, ContainerLevelTerminal.InvTracker> tracked = new HashMap<>();
|
||||
private final Map<Long, ContainerLevelTerminal.InvTracker> trackedById = new HashMap<>();
|
||||
|
||||
private IGrid grid;
|
||||
@@ -246,21 +246,22 @@ public class ContainerLevelTerminal extends FCBaseContainer {
|
||||
private SPacketLevelTerminalUpdate updateList() {
|
||||
SPacketLevelTerminalUpdate update = null;
|
||||
var supported = LevelTerminalRegistry.instance().getSupportedClasses();
|
||||
Set<ILevelViewable> visited = new HashSet<>();
|
||||
Set<IGridHost> visited = new HashSet<>();
|
||||
|
||||
for (Class<? extends ILevelViewable> clz : supported) {
|
||||
boolean isAdopted = LevelTerminalRegistry.instance().isAdopted(clz);
|
||||
Class<? extends IGridHost> machineClass = isAdopted ? LevelTerminalRegistry.instance().getAdopted(clz)
|
||||
: clz;
|
||||
for (IGridNode gridNode : grid.getMachines(machineClass)) {
|
||||
final IGridHost gridHost = gridNode.getMachine();
|
||||
final ILevelViewable machine = isAdopted
|
||||
? LevelTerminalRegistry.instance().getAdapter(clz).adapt(gridNode.getMachine())
|
||||
: (ILevelViewable) gridNode.getMachine();
|
||||
? LevelTerminalRegistry.instance().getAdapter(clz).adapt(gridHost)
|
||||
: (ILevelViewable) gridHost;
|
||||
|
||||
/* First check if we are already tracking this node */
|
||||
if (tracked.containsKey(machine)) {
|
||||
if (tracked.containsKey(gridHost)) {
|
||||
/* Check for updates */
|
||||
ContainerLevelTerminal.InvTracker knownTracker = tracked.get(machine);
|
||||
ContainerLevelTerminal.InvTracker knownTracker = tracked.get(gridHost);
|
||||
|
||||
/* Name changed? */
|
||||
String name = machine.getCustomName();
|
||||
@@ -310,15 +311,15 @@ public class ContainerLevelTerminal extends FCBaseContainer {
|
||||
.setLocation(entry.x, entry.y, entry.z, entry.dim, entry.side.ordinal())
|
||||
.setItems(entry.rows, entry.rowSize, entry.inventoryNbt)
|
||||
.setViewItemStack(machine.getSelfItemStack(), machine.getDisplayItemStack());
|
||||
tracked.put(machine, entry);
|
||||
tracked.put(gridHost, entry);
|
||||
trackedById.put(entry.id, entry);
|
||||
}
|
||||
visited.add(machine);
|
||||
visited.add(gridHost);
|
||||
}
|
||||
}
|
||||
|
||||
/* Now find any entries that we need to remove */
|
||||
Iterator<Map.Entry<ILevelViewable, ContainerLevelTerminal.InvTracker>> it = tracked.entrySet().iterator();
|
||||
Iterator<Map.Entry<IGridHost, ContainerLevelTerminal.InvTracker>> it = tracked.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
var entry = it.next();
|
||||
if (visited.contains(entry.getKey())) {
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
+87
-51
@@ -17,9 +17,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
|
||||
import com.glodblock.github.client.gui.container.ContainerItemMonitor;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
@@ -55,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;
|
||||
@@ -133,17 +133,19 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
|
||||
}
|
||||
Slot slot = getSlot(slotId);
|
||||
ItemStack stack = player.inventory.getItemStack();
|
||||
if (Util.getFluidFromItem(stack) == null || Util.getFluidFromItem(stack).amount <= 0) {
|
||||
FluidStack fluid = Util.getFluidFromItem(stack);
|
||||
|
||||
if (fluid == null || fluid.amount <= 0) {
|
||||
super.doAction(player, action, slotId, id);
|
||||
return;
|
||||
}
|
||||
if (validPatternSlot(slot)
|
||||
&& (stack.getItem() instanceof IFluidContainerItem || FluidContainerRegistry.isContainer(stack))) {
|
||||
FluidStack fluid = null;
|
||||
|
||||
if (validPatternSlot(slot)) {
|
||||
|
||||
switch (action) {
|
||||
case PICKUP_OR_SET_DOWN -> {
|
||||
fluid = Util.getFluidFromItem(stack);
|
||||
slot.putStack(ItemFluidPacket.newStack(fluid));
|
||||
return;
|
||||
}
|
||||
case SPLIT_OR_PLACE_SINGLE -> {
|
||||
fluid = Util.getFluidFromItem(Util.copyStackWithSize(stack, 1));
|
||||
@@ -153,13 +155,11 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
|
||||
if (fluid.amount <= 0) fluid = null;
|
||||
}
|
||||
slot.putStack(ItemFluidPacket.newStack(fluid));
|
||||
return;
|
||||
}
|
||||
default -> {}
|
||||
}
|
||||
if (fluid == null) {
|
||||
super.doAction(player, action, slotId, id);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
}
|
||||
super.doAction(player, action, slotId, id);
|
||||
}
|
||||
@@ -492,8 +492,7 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
|
||||
protected NBTBase createItemTag(final ItemStack i) {
|
||||
final NBTTagCompound c = new NBTTagCompound();
|
||||
if (i != null) {
|
||||
i.writeToNBT(c);
|
||||
c.setInteger("Count", i.stackSize);
|
||||
Util.writeItemStackToNBT(i, c);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
@@ -541,52 +540,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();
|
||||
}
|
||||
|
||||
+2
-1
@@ -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);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ public class EssentiaRepo extends FluidRepo {
|
||||
super(src, sortSrc);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void updateView() {
|
||||
this.view.clear();
|
||||
|
||||
@@ -97,6 +97,7 @@ public class FluidRepo implements IDisplayRepo {
|
||||
this.updateView();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void updateView() {
|
||||
this.view.clear();
|
||||
|
||||
@@ -8,8 +8,6 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.common.block.BlockFluidBuffer;
|
||||
import com.glodblock.github.common.tile.TileFluidBuffer;
|
||||
|
||||
@@ -38,8 +36,6 @@ public class RenderBlockFluidBuffer extends BaseBlockRender<BlockFluidBuffer, Ti
|
||||
if (tileEntity != null && tileEntity.getFluidStack() != null) {
|
||||
Fluid storedFluid = tileEntity.getFluidStack().getFluid();
|
||||
if (storedFluid != null) {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
Block id = Block.getBlockById(FluidRegistry.WATER.getID());
|
||||
IIcon fluidIcon = storedFluid.getIcon();
|
||||
if (fluidIcon == null) fluidIcon = FluidRegistry.LAVA.getIcon();
|
||||
@@ -60,7 +56,6 @@ public class RenderBlockFluidBuffer extends BaseBlockRender<BlockFluidBuffer, Ti
|
||||
renderer.renderFaceXNeg(id, x, y, z, fluidIcon);
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
renderer.renderFaceXPos(id, x, y, z, fluidIcon);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.glodblock.github.common.block;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
@@ -61,6 +62,14 @@ public class BlockFluidInterface extends FCBaseBlock {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange(World worldIn, int x, int y, int z, Block neighbor) {
|
||||
TileFluidInterface tile = this.getTileEntity(worldIn, x, y, z);
|
||||
if (tile != null) {
|
||||
tile.getInterfaceDuality().updateRedstoneState();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasCustomRotation() {
|
||||
return true;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -16,8 +16,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.FluidCellInventoryHandler;
|
||||
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.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
@@ -37,6 +37,7 @@ 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;
|
||||
|
||||
@@ -61,7 +62,6 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
|
||||
this.component = null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
public FCBaseItemCell(final Optional<String> subName) {
|
||||
super(subName);
|
||||
}
|
||||
@@ -96,12 +96,12 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
|
||||
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell()
|
||||
.getCellInventory(stack, null, StorageChannel.FLUIDS);
|
||||
|
||||
if (inventory instanceof final IFluidCellInventoryHandler handler) {
|
||||
if (inventory instanceof final FluidCellInventoryHandler handler) {
|
||||
final IFluidCellInventory cellInventory = handler.getCellInv();
|
||||
|
||||
if (cellInventory != null) {
|
||||
lines.add(
|
||||
EnumChatFormatting.WHITE + String.valueOf(cellInventory.getUsedBytes())
|
||||
EnumChatFormatting.WHITE + NumberFormat.getInstance().format(cellInventory.getUsedBytes())
|
||||
+ EnumChatFormatting.GRAY
|
||||
+ " "
|
||||
+ GuiText.Of.getLocal()
|
||||
@@ -112,7 +112,7 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
|
||||
+ EnumChatFormatting.GRAY
|
||||
+ GuiText.BytesUsed.getLocal());
|
||||
lines.add(
|
||||
EnumChatFormatting.WHITE + String.valueOf(cellInventory.getStoredFluidTypes())
|
||||
EnumChatFormatting.WHITE + NumberFormat.getInstance().format(cellInventory.getStoredFluidTypes())
|
||||
+ EnumChatFormatting.GRAY
|
||||
+ " "
|
||||
+ GuiText.Of.getLocal()
|
||||
@@ -155,6 +155,9 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
|
||||
} else {
|
||||
lines.add(StatCollector.translateToLocal(NameConst.TT_SHIFT_FOR_MORE));
|
||||
}
|
||||
if (handler.getSticky()) {
|
||||
lines.add(GuiText.Sticky.getLocal());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,7 +190,7 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
|
||||
|
||||
@Override
|
||||
public IInventory getUpgradesInventory(ItemStack is) {
|
||||
return new CellUpgrades(is, 0);
|
||||
return new CellUpgrades(is, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -221,7 +224,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));
|
||||
}
|
||||
|
||||
@@ -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, 0);
|
||||
}
|
||||
|
||||
@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 {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.glodblock.github.common.item;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
@@ -82,7 +83,7 @@ public class ItemPortableFluidCell extends AEBasePoweredItem
|
||||
final IFluidCellInventory cellInventory = handler.getCellInv();
|
||||
if (cellInventory != null) {
|
||||
lines.add(
|
||||
EnumChatFormatting.WHITE + String.valueOf(cellInventory.getUsedBytes())
|
||||
EnumChatFormatting.WHITE + NumberFormat.getInstance().format(cellInventory.getUsedBytes())
|
||||
+ EnumChatFormatting.GRAY
|
||||
+ " "
|
||||
+ GuiText.Of.getLocal()
|
||||
@@ -93,7 +94,7 @@ public class ItemPortableFluidCell extends AEBasePoweredItem
|
||||
+ EnumChatFormatting.GRAY
|
||||
+ GuiText.BytesUsed.getLocal());
|
||||
lines.add(
|
||||
EnumChatFormatting.WHITE + String.valueOf(cellInventory.getStoredFluidTypes())
|
||||
EnumChatFormatting.WHITE + NumberFormat.getInstance().format(cellInventory.getStoredFluidTypes())
|
||||
+ EnumChatFormatting.GRAY
|
||||
+ " "
|
||||
+ GuiText.Of.getLocal()
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,27 +24,19 @@ import com.glodblock.github.util.BlockPos;
|
||||
import com.glodblock.github.util.DualityFluidInterface;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.parts.IPartRenderHelper;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.client.texture.CableBusTextures;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.parts.misc.PartInterface;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -52,7 +44,6 @@ import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class PartFluidInterface extends PartInterface implements IDualHost {
|
||||
|
||||
private final BaseActionSource ownActionSource = new MachineSource(this);
|
||||
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, 6);
|
||||
private final DualityFluidInterface fluidDuality = new DualityFluidInterface(this.getProxy(), this);
|
||||
|
||||
@@ -201,35 +192,9 @@ public class PartFluidInterface extends PartInterface implements IDualHost {
|
||||
return getInterfaceDuality().getInstalledUpgrades(u);
|
||||
}
|
||||
|
||||
private IMEMonitor<IAEFluidStack> getFluidGrid() {
|
||||
try {
|
||||
return getProxy().getGrid().<IStorageGrid>getCache(IStorageGrid.class).getFluidInventory();
|
||||
} catch (GridAccessException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnergyGrid getEnergyGrid() {
|
||||
try {
|
||||
return getProxy().getGrid().getCache(IEnergyGrid.class);
|
||||
} catch (GridAccessException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
IMEMonitor<IAEFluidStack> fluidGrid = getFluidGrid();
|
||||
IEnergyGrid energyGrid = getEnergyGrid();
|
||||
if (energyGrid == null || fluidGrid == null || resource == null) return 0;
|
||||
int ori = resource.amount;
|
||||
IAEFluidStack remove;
|
||||
if (doFill) {
|
||||
remove = fluidGrid.injectItems(AEFluidStack.create(resource), Actionable.MODULATE, ownActionSource);
|
||||
} else {
|
||||
remove = fluidGrid.injectItems(AEFluidStack.create(resource), Actionable.SIMULATE, ownActionSource);
|
||||
}
|
||||
return remove == null ? ori : (int) (ori - remove.getStackSize());
|
||||
return fluidDuality.fill(from, resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -244,12 +209,12 @@ public class PartFluidInterface extends PartInterface implements IDualHost {
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
return true;
|
||||
return fluidDuality.canFill(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
return true;
|
||||
return fluidDuality.canDrain(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -190,6 +190,11 @@ public class PartFluidLevelEmitter extends PartUpgradeable implements IStackWatc
|
||||
if (this.myWatcher != null && myStack != null) {
|
||||
this.myWatcher.add(myStack);
|
||||
}
|
||||
|
||||
if (myStack == null) {
|
||||
this.getProxy().getStorage().getFluidInventory().addListener(this, this.getProxy().getGrid());
|
||||
}
|
||||
|
||||
this.updateReportingValue(this.getProxy().getStorage().getFluidInventory());
|
||||
} catch (final GridAccessException ignored) {}
|
||||
}
|
||||
@@ -221,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();
|
||||
@@ -524,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();
|
||||
}
|
||||
|
||||
|
||||
@@ -38,14 +38,11 @@ import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
import appeng.api.networking.crafting.ICraftingPatternDetails;
|
||||
import appeng.api.networking.crafting.ICraftingProviderHelper;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
import appeng.api.networking.events.MENetworkCraftingPatternChange;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
@@ -60,6 +57,7 @@ import appeng.helpers.IInterfaceHost;
|
||||
import appeng.helpers.IPriorityHost;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.parts.automation.UpgradeInventory;
|
||||
import appeng.parts.p2p.PartP2PTunnel;
|
||||
import appeng.parts.p2p.PartP2PTunnelStatic;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
@@ -67,7 +65,6 @@ import appeng.tile.inventory.IAEAppEngInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.inv.IInventoryDestination;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
|
||||
public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInterface>
|
||||
implements IGridTickable, IStorageMonitorable, IInventoryDestination, IDualHost, ISidedInventory,
|
||||
@@ -107,7 +104,6 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
||||
};
|
||||
private final DualityFluidInterface dualityFluid = new DualityFluidInterface(this.getProxy(), this);
|
||||
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, 6);
|
||||
private final BaseActionSource ownActionSource = new MachineSource(this);
|
||||
|
||||
public PartFluidP2PInterface(ItemStack is) {
|
||||
super(is);
|
||||
@@ -131,6 +127,11 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
||||
dualityFluid.gridChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChanged() {
|
||||
this.duality.updateRedstoneState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPartActivate(final EntityPlayer player, final Vec3 pos) {
|
||||
AppEngInternalInventory patterns = (AppEngInternalInventory) duality.getPatterns();
|
||||
@@ -349,35 +350,9 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
||||
return true;
|
||||
}
|
||||
|
||||
private IMEMonitor<IAEFluidStack> getFluidGrid() {
|
||||
try {
|
||||
return getProxy().getGrid().<IStorageGrid>getCache(IStorageGrid.class).getFluidInventory();
|
||||
} catch (GridAccessException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnergyGrid getEnergyGrid() {
|
||||
try {
|
||||
return getProxy().getGrid().getCache(IEnergyGrid.class);
|
||||
} catch (GridAccessException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
IMEMonitor<IAEFluidStack> fluidGrid = getFluidGrid();
|
||||
IEnergyGrid energyGrid = getEnergyGrid();
|
||||
if (energyGrid == null || fluidGrid == null || resource == null) return 0;
|
||||
int ori = resource.amount;
|
||||
IAEFluidStack remove;
|
||||
if (doFill) {
|
||||
remove = fluidGrid.injectItems(AEFluidStack.create(resource), Actionable.MODULATE, ownActionSource);
|
||||
} else {
|
||||
remove = fluidGrid.injectItems(AEFluidStack.create(resource), Actionable.SIMULATE, ownActionSource);
|
||||
}
|
||||
return remove == null ? ori : (int) (ori - remove.getStackSize());
|
||||
return dualityFluid.fill(from, resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -392,12 +367,12 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid) {
|
||||
return true;
|
||||
return dualityFluid.canFill(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
return true;
|
||||
return dualityFluid.canDrain(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -502,6 +477,19 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
||||
duality.writeToNBT(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getMemoryCardData() {
|
||||
final NBTTagCompound output = super.getMemoryCardData();
|
||||
this.duality.getConfigManager().writeToNBT(output);
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void pasteMemoryCardData(PartP2PTunnel<?> newTunnel, NBTTagCompound data) throws GridAccessException {
|
||||
this.duality.getConfigManager().readFromNBT(data);
|
||||
super.pasteMemoryCardData(newTunnel, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addToWorld() {
|
||||
super.addToWorld();
|
||||
@@ -516,6 +504,54 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
|
||||
|
||||
@Override
|
||||
public boolean shouldDisplay() {
|
||||
return IInterfaceHost.super.shouldDisplay() && !isOutput();
|
||||
return IInterfaceHost.super.shouldDisplay();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getPatterns() {
|
||||
if (isOutput()) {
|
||||
PartFluidP2PInterface input = getInput();
|
||||
if (input != null) {
|
||||
return input.getPatterns();
|
||||
}
|
||||
return IInterfaceHost.super.getPatterns();
|
||||
}
|
||||
return IInterfaceHost.super.getPatterns();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int rows() {
|
||||
if (isOutput()) {
|
||||
PartFluidP2PInterface input = getInput();
|
||||
if (input != null) {
|
||||
return input.rows();
|
||||
}
|
||||
return IInterfaceHost.super.rows();
|
||||
}
|
||||
return IInterfaceHost.super.rows();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int rowSize() {
|
||||
if (isOutput()) {
|
||||
PartFluidP2PInterface input = getInput();
|
||||
if (input != null) {
|
||||
return input.rowSize();
|
||||
}
|
||||
return IInterfaceHost.super.rowSize();
|
||||
}
|
||||
return IInterfaceHost.super.rowSize();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
if (isOutput()) {
|
||||
PartFluidP2PInterface input = getInput();
|
||||
if (input != null) {
|
||||
return input.getName();
|
||||
}
|
||||
return IInterfaceHost.super.getName();
|
||||
}
|
||||
return IInterfaceHost.super.getName();
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -29,6 +30,7 @@ import appeng.api.config.IncludeExclude;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.StorageFilter;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.events.MENetworkCellArrayUpdate;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
@@ -42,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;
|
||||
@@ -62,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 {
|
||||
@@ -85,15 +87,39 @@ 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);
|
||||
this.getConfigManager().registerSetting(Settings.ACCESS, AccessRestriction.READ_WRITE);
|
||||
this.getConfigManager().registerSetting(Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL);
|
||||
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
|
||||
@@ -127,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();
|
||||
}
|
||||
@@ -146,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
|
||||
@@ -199,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;
|
||||
@@ -219,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);
|
||||
}
|
||||
@@ -237,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
|
||||
@@ -270,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
|
||||
@@ -354,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);
|
||||
@@ -363,15 +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);
|
||||
}
|
||||
@@ -382,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -432,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);
|
||||
|
||||
@@ -61,7 +61,7 @@ public class CreativeFluidCellInventory extends FluidCellInventory {
|
||||
if (fs == null) continue;
|
||||
IAEFluidStack iaeFluidStack = Util.FluidUtil.createAEFluidStack(fs);
|
||||
if (this.cellFluids.findPrecise(iaeFluidStack) == null) {
|
||||
iaeFluidStack.setStackSize(Integer.MAX_VALUE);
|
||||
iaeFluidStack.setStackSize(Integer.MAX_VALUE * 1_000_000L);
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@ 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;
|
||||
|
||||
@@ -82,10 +83,12 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
|
||||
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));
|
||||
}
|
||||
@@ -188,13 +191,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() {
|
||||
@@ -380,7 +386,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 +394,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);
|
||||
}
|
||||
|
||||
@@ -401,6 +407,11 @@ public class FluidCellInventory implements IFluidCellInventory {
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getUpgradesInventory() {
|
||||
return this.cellType.getUpgradesInventory(this.cellItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel() {
|
||||
return StorageChannel.FLUIDS;
|
||||
|
||||
@@ -2,12 +2,16 @@ package com.glodblock.github.common.storage;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.glodblock.github.util.Ae2Reflect;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.IncludeExclude;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.implementations.items.IUpgradeModule;
|
||||
import appeng.api.storage.ICellCacheRegistry;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
@@ -17,7 +21,8 @@ import appeng.me.storage.MEPassThrough;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
import appeng.util.prioitylist.PrecisePriorityList;
|
||||
|
||||
public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack> implements IFluidCellInventoryHandler {
|
||||
public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack>
|
||||
implements IFluidCellInventoryHandler, ICellCacheRegistry {
|
||||
|
||||
protected FluidCellInventoryHandler(final IMEInventory<IAEFluidStack> c) {
|
||||
super(c, StorageChannel.FLUIDS);
|
||||
@@ -30,13 +35,32 @@ public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack>
|
||||
final IItemList<IAEFluidStack> priorityList = AEApi.instance().storage().createFluidList();
|
||||
for (int x = 0; x < config.getSizeInventory(); x++) {
|
||||
final ItemStack is = config.getStackInSlot(x);
|
||||
if (Util.getFluidFromItem(is) != null) {
|
||||
priorityList.add(AEFluidStack.create(Util.getFluidFromItem(is)));
|
||||
final FluidStack fluid = Util.getFluidFromItem(is);
|
||||
if (fluid != null) {
|
||||
priorityList.add(AEFluidStack.create(fluid));
|
||||
}
|
||||
}
|
||||
if (!priorityList.isEmpty()) {
|
||||
this.setPartitionList(new PrecisePriorityList<>(priorityList));
|
||||
}
|
||||
|
||||
final IInventory upgrades = ci.getUpgradesInventory();
|
||||
boolean hasSticky = false;
|
||||
|
||||
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 == Upgrades.STICKY) {
|
||||
hasSticky = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasSticky) {
|
||||
setSticky(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,10 +92,60 @@ 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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canGetInv() {
|
||||
IFluidCellInventory cellInv = this.getCellInv();
|
||||
if (cellInv instanceof CreativeFluidCellInventory) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTotalBytes() {
|
||||
return this.getCellInv().getTotalBytes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getFreeBytes() {
|
||||
return this.getCellInv().getFreeBytes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getUsedBytes() {
|
||||
return this.getCellInv().getUsedBytes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTotalTypes() {
|
||||
return this.getCellInv().getTotalFluidTypes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getFreeTypes() {
|
||||
return this.getCellInv().getRemainingFluidTypes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getUsedTypes() {
|
||||
return this.getCellInv().getStoredFluidTypes();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCellStatus() {
|
||||
return this.getStatusForCell();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TYPE getCellType() {
|
||||
return TYPE.FLUID;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -86,4 +86,9 @@ public interface IFluidCellInventory extends IMEInventory<IAEFluidStack> {
|
||||
long getTotalFluidTypes();
|
||||
|
||||
List<IAEFluidStack> getContents();
|
||||
|
||||
/**
|
||||
* @return access installed upgrades.
|
||||
*/
|
||||
IInventory getUpgradesInventory();
|
||||
}
|
||||
@@ -180,8 +180,7 @@ public class TileFluidAutoFiller extends AENetworkInvTile
|
||||
protected NBTBase createItemTag(final ItemStack i) {
|
||||
final NBTTagCompound c = new NBTTagCompound();
|
||||
if (i != null) {
|
||||
i.writeToNBT(c);
|
||||
c.setInteger("Count", i.stackSize);
|
||||
Util.writeItemStackToNBT(i, c);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -187,7 +187,7 @@ public class TileFluidInterface extends TileInterface implements IDualHost {
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
return true;
|
||||
return fluidDuality.canDrain(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.glodblock.github.common.tile;
|
||||
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.function.UnaryOperator;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -13,10 +14,10 @@ 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.Updater;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -26,6 +27,7 @@ import appeng.api.implementations.IPowerChannelState;
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.crafting.ICraftingCPU;
|
||||
import appeng.api.networking.crafting.ICraftingGrid;
|
||||
import appeng.api.networking.crafting.ICraftingJob;
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
@@ -60,6 +62,7 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
|
||||
public static final int REQ_COUNT = 5;
|
||||
public final InventoryRequest requests = new InventoryRequest(this);
|
||||
private int firstRequest = 0;
|
||||
private final BaseActionSource source;
|
||||
private final IInventory inv = new AeItemStackHandler(requests.requestStacks);
|
||||
private boolean isPowered = false;
|
||||
@@ -139,48 +142,82 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
final ICraftingGrid craftingGrid = getProxy().getCrafting();
|
||||
final IGrid grid = getProxy().getGrid();
|
||||
final IItemList<IAEItemStack> inv = getProxy().getStorage().getItemInventory().getStorageList();
|
||||
for (int i = 0; i < REQ_COUNT; i++) {
|
||||
|
||||
// Check there are available crafting CPUs before doing any work.
|
||||
// This hopefully stops level maintainers busy-looping calculating
|
||||
// crafting tasks that cannot be successfully submitted.
|
||||
boolean allBusy = true;
|
||||
for (final ICraftingCPU cpu : craftingGrid.getCpus()) {
|
||||
if (!cpu.isBusy()) {
|
||||
allBusy = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Find a request that we can submit to the network.
|
||||
// If there is none, find the next request we can begin calculating.
|
||||
ICraftingJob jobToSubmit = null;
|
||||
int jobToSubmitIdx = -1;
|
||||
IAEItemStack itemToBegin = null;
|
||||
int itemToBeginIdx = -1;
|
||||
|
||||
for (int j = 0; j < REQ_COUNT; ++j) {
|
||||
int i = (firstRequest + j) % REQ_COUNT;
|
||||
|
||||
long quantity = requests.getQuantity(i);
|
||||
long batchSize = requests.getBatchSize(i);
|
||||
boolean isEnable = requests.isEnable(i);
|
||||
if (!isEnable || batchSize == 0) requests.updateState(i, State.None);
|
||||
if (batchSize > 0) {
|
||||
IAEItemStack craftItem = requests.getCraftItem(i);
|
||||
|
||||
if (ThaumicEnergisticsCrafting.isAspectStack(craftItem.getItemStack())) {
|
||||
craftItem = ThaumicEnergisticsCrafting.convertAspectStack(craftItem);
|
||||
}
|
||||
|
||||
IAEItemStack aeItem = inv.findPrecise(craftItem);
|
||||
|
||||
long stackSize = aeItem == null ? 0 : aeItem.getStackSize();
|
||||
|
||||
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 (craftingGrid.canEmitFor(craftItem) || craftingGrid.isRequesting(craftItem)
|
||||
|| !isDone
|
||||
|| !shouldCraft)
|
||||
|
||||
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) {
|
||||
requests.updateJob(
|
||||
i,
|
||||
craftingGrid.beginCraftingJob(getWorldObj(), grid, source, craftItem, null));
|
||||
requests.updateState(i, State.Craft);
|
||||
|
||||
// calculate only one job per tick request
|
||||
return TickRateModulation.SAME;
|
||||
if (jobTask == null) {
|
||||
if (itemToBegin == null) {
|
||||
itemToBegin = craftItem;
|
||||
itemToBeginIdx = i;
|
||||
}
|
||||
} else if (jobTask.isDone()) {
|
||||
requests.updateState(i, State.Craft);
|
||||
try {
|
||||
ICraftingJob job = jobTask.get();
|
||||
if (job != null) {
|
||||
ICraftingLink link = craftingGrid.submitJob(job, this, null, false, source);
|
||||
requests.updateJob(i, null);
|
||||
if (link != null) {
|
||||
requests.updateState(i, State.Craft);
|
||||
requests.updateLink(i, link);
|
||||
|
||||
// submit only one job per tick request
|
||||
return TickRateModulation.SAME;
|
||||
} else {
|
||||
requests.updateState(i, State.Error);
|
||||
if (jobToSubmit == null) {
|
||||
jobToSubmit = job;
|
||||
jobToSubmitIdx = i;
|
||||
}
|
||||
} else {
|
||||
requests.updateState(i, State.Error);
|
||||
@@ -191,6 +228,31 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (jobToSubmit != null) {
|
||||
// Finished calculating a request, try to submit it.
|
||||
ICraftingLink link = craftingGrid.submitJob(jobToSubmit, this, null, false, source);
|
||||
requests.updateJob(jobToSubmitIdx, null);
|
||||
if (link != null) {
|
||||
requests.updateState(jobToSubmitIdx, State.Craft);
|
||||
requests.updateLink(jobToSubmitIdx, link);
|
||||
} else {
|
||||
requests.updateState(jobToSubmitIdx, State.Error);
|
||||
}
|
||||
} else if (itemToBegin != null) {
|
||||
// No jobs to submit, start calculating some item.
|
||||
requests.updateJob(
|
||||
itemToBeginIdx,
|
||||
craftingGrid.beginCraftingJob(getWorldObj(), grid, source, itemToBegin, null));
|
||||
requests.updateState(itemToBeginIdx, State.Craft);
|
||||
|
||||
// Try the next item next time.
|
||||
firstRequest = (firstRequest + 1) % REQ_COUNT;
|
||||
} else {
|
||||
// No work to be done:
|
||||
// Every item is at desired quantity, being crafted, or has no patterns.
|
||||
return TickRateModulation.IDLE;
|
||||
}
|
||||
} catch (final GridAccessException ignore) {
|
||||
|
||||
}
|
||||
@@ -256,22 +318,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
|
||||
*/
|
||||
@@ -348,7 +394,8 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
}
|
||||
|
||||
private ItemStack removeRecursion(ItemStack itemStack) {
|
||||
if (itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey(TLMTags.Stack.tagName)) {
|
||||
if (itemStack != null && itemStack.hasTagCompound()
|
||||
&& itemStack.getTagCompound().hasKey(TLMTags.Stack.tagName)) {
|
||||
return removeRecursion(loadItemStackFromTag(itemStack));
|
||||
}
|
||||
return itemStack;
|
||||
@@ -503,14 +550,14 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
jobs[idx] = job;
|
||||
}
|
||||
|
||||
private void updateField(int idx, Updater<NBTTagCompound, NBTTagCompound> updater) {
|
||||
private void updateField(int idx, UnaryOperator<NBTTagCompound> updater) {
|
||||
IAEItemStack ias = requestStacks.getStack(idx);
|
||||
if (ias == null) return;
|
||||
|
||||
ItemStack itemStack = ias.getItemStack();
|
||||
NBTTagCompound data = itemStack.hasTagCompound() ? itemStack.getTagCompound() : new NBTTagCompound();
|
||||
data.setInteger(TLMTags.Index.tagName, idx);
|
||||
itemStack.setTagCompound(updater.update(data));
|
||||
itemStack.setTagCompound(updater.apply(data));
|
||||
IAEItemStack newRequestStack = AEItemStack.create(itemStack);
|
||||
newRequestStack.setStackSize(ias.getStackSize());
|
||||
requestStacks.setStack(idx, newRequestStack);
|
||||
@@ -607,7 +654,9 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
public IAEItemStack getCraftItem(int idx) {
|
||||
IAEItemStack is = requestStacks.getStack(idx);
|
||||
if (is == null) return null;
|
||||
if (is.getItemStack() == null) return null;
|
||||
ItemStack qis = loadItemStackFromTag(is.getItemStack());
|
||||
if (qis == null) return null;
|
||||
IAEItemStack qais = AEItemStack.create(qis);
|
||||
qais.setStackSize(getBatchSize(idx));
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
+14
-8
@@ -12,12 +12,17 @@ import com.glodblock.github.api.registries.ILevelViewable;
|
||||
import com.glodblock.github.api.registries.ILevelViewableAdapter;
|
||||
import com.glodblock.github.common.tile.TileLevelMaintainer.State;
|
||||
import com.glodblock.github.common.tile.TileLevelMaintainer.TLMTags;
|
||||
import com.glodblock.github.inventory.AeItemStackHandler;
|
||||
import com.glodblock.github.inventory.AeStackInventoryImpl;
|
||||
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.parts.automation.PartLevelEmitter;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
public class PartLevelEmitterAdapter implements ILevelViewable, ILevelViewableAdapter {
|
||||
|
||||
@@ -30,20 +35,21 @@ public class PartLevelEmitterAdapter implements ILevelViewable, ILevelViewableAd
|
||||
public ILevelViewable adapt(IGridHost gridHost) {
|
||||
if (gridHost instanceof PartLevelEmitter levelEmitter) this.delegate = levelEmitter;
|
||||
return this;
|
||||
};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
static public IInventory getPatchedInventory(IInventory inventory, long quantity, State state) {
|
||||
ItemStack itemStack = inventory.getStackInSlot(SLOT_IN).copy();
|
||||
ItemStack itemStack = inventory.getStackInSlot(SLOT_IN);
|
||||
if (itemStack == null) return inventory;
|
||||
NBTTagCompound data = !itemStack.hasTagCompound() ? new NBTTagCompound() : itemStack.getTagCompound();
|
||||
if (!data.hasKey(TLMTags.Quantity.tagName) || data.getLong(TLMTags.Quantity.tagName) != quantity)
|
||||
data.setLong(TLMTags.Quantity.tagName, quantity);
|
||||
if (!data.hasKey(TLMTags.State.tagName) || data.getInteger(TLMTags.State.tagName) != state.ordinal())
|
||||
data.setInteger(TLMTags.State.tagName, state.ordinal());
|
||||
data.setLong(TLMTags.Quantity.tagName, quantity);
|
||||
data.setInteger(TLMTags.State.tagName, state.ordinal());
|
||||
itemStack.setTagCompound(data);
|
||||
inventory.setInventorySlotContents(SLOT_IN, itemStack);
|
||||
|
||||
return inventory;
|
||||
AeStackInventoryImpl<IAEItemStack> inv = new AeStackInventoryImpl<>(StorageChannel.ITEMS, 1);
|
||||
inv.setStack(SLOT_IN, AEItemStack.create(itemStack));
|
||||
|
||||
return new AeItemStackHandler(inv);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+67
@@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -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
|
||||
|
||||
+1
-5
@@ -10,11 +10,9 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.tile.TileLevelMaintainer;
|
||||
import com.glodblock.github.inventory.AeItemStackHandler;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.util.item.AEItemStack;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import li.cil.oc.api.driver.EnvironmentProvider;
|
||||
import li.cil.oc.api.driver.NamedBlock;
|
||||
@@ -124,9 +122,7 @@ public class DriverLevelMaintainer extends DriverSidedTileEntity {
|
||||
if (dbStack == null) {
|
||||
throw new IllegalArgumentException("Invalid slot");
|
||||
}
|
||||
dbStack.stackSize = 1;
|
||||
((AeItemStackHandler) tileEntity.getInventory()).getAeInventory()
|
||||
.setStack(slot, AEItemStack.create(dbStack));
|
||||
tileEntity.requests.updateStack(slot, dbStack);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Not a database");
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
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 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 (stack == null) return false;
|
||||
|
||||
return stack.getItem() == neiAddonAspect || stack.getItem() == thaumicEnergisticsAspect;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Method(modid = "thaumicenergistics")
|
||||
public static String getAspectName(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;
|
||||
}
|
||||
|
||||
if (stack.getItem() == thaumicEnergisticsAspect) {
|
||||
return ItemCraftingAspect.getAspect(stack).getTag();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Method(modid = "thaumicenergistics")
|
||||
public static ItemStack getAspectStack(String aspectName, int stackSize) {
|
||||
return ItemCraftingAspect.createStackForAspect(Aspect.getAspect(aspectName), stackSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an aspect stack into a thaumic energistics stack.
|
||||
*/
|
||||
public static IAEItemStack convertAspectStack(IAEItemStack stack) {
|
||||
if (stack == null) return null;
|
||||
|
||||
String aspect = getAspectName(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.
|
||||
*/
|
||||
@Method(modid = "thaumicenergistics")
|
||||
public static long getEssentiaAmount(IAEItemStack stack, IGrid grid) {
|
||||
String aspectName = getAspectName(stack.getItemStack());
|
||||
|
||||
if (aspectName == null) return 0;
|
||||
|
||||
Aspect aspect = Aspect.getAspect(aspectName);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loaded 100 of 157 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user