mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-22 21:09:43 +00:00
Compare commits
37
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da533d07bd | ||
|
|
51a1821b01 | ||
|
|
2f58e74c22 | ||
|
|
802671d504 | ||
|
|
3468394b49 | ||
|
|
c6938cc921 | ||
|
|
411065ea67 | ||
|
|
3dcc7a72d1 | ||
|
|
12102ed23d | ||
|
|
bc6ba7918e | ||
|
|
29907760c3 | ||
|
|
5444d5312c | ||
|
|
201ac78563 | ||
|
|
808196f3c0 | ||
|
|
eb41b9d8b4 | ||
|
|
952cba09e4 | ||
|
|
4bbfd2f68e | ||
|
|
531e55a013 | ||
|
|
475c910fa2 | ||
|
|
ff92f7168f | ||
|
|
1ad7d5318e | ||
|
|
fbab434bbc | ||
|
|
8b85f2be65 | ||
|
|
8d77a6ee4c | ||
|
|
6a86504e2e | ||
|
|
6b793c1dc7 | ||
|
|
9096734722 | ||
|
|
ecde78111d | ||
|
|
1253a9002d | ||
|
|
e7c1e55518 | ||
|
|
c13d83f06d | ||
|
|
0c4063b41b | ||
|
|
3201e54dc3 | ||
|
|
de89555092 | ||
|
|
5054565fca | ||
|
|
281620f695 | ||
|
|
632c0c3b8f |
No files matched your search
@@ -1,19 +0,0 @@
|
||||
# This is the universal Text Editor Configuration
|
||||
# for all GTNewHorizons projects
|
||||
# See: https://editorconfig.org/
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.{bat,ini}]
|
||||
end_of_line = crlf
|
||||
|
||||
[*.{dtd,json,info,mcmeta,md,sh,svg,xml,xsd,xsl,yaml,yml}]
|
||||
indent_size = 2
|
||||
@@ -1,2 +0,0 @@
|
||||
# Ignore spotlessApply reformat
|
||||
69a5c0e6ee71fe714eabe24002f9e39aae3b97be
|
||||
+2
-44
@@ -1,44 +1,2 @@
|
||||
* text eol=lf
|
||||
|
||||
*.[jJ][aA][rR] binary
|
||||
|
||||
*.[pP][nN][gG] binary
|
||||
*.[jJ][pP][gG] binary
|
||||
*.[jJ][pP][eE][gG] binary
|
||||
*.[gG][iI][fF] binary
|
||||
*.[tT][iI][fF] binary
|
||||
*.[tT][iI][fF][fF] binary
|
||||
*.[iI][cC][oO] binary
|
||||
*.[sS][vV][gG] text
|
||||
*.[eE][pP][sS] binary
|
||||
*.[xX][cC][fF] binary
|
||||
|
||||
*.[kK][aA][rR] binary
|
||||
*.[mM]4[aA] binary
|
||||
*.[mM][iI][dD] binary
|
||||
*.[mM][iI][dD][iI] binary
|
||||
*.[mM][pP]3 binary
|
||||
*.[oO][gG][gG] binary
|
||||
*.[rR][aA] binary
|
||||
|
||||
*.7[zZ] binary
|
||||
*.[gG][zZ] binary
|
||||
*.[tT][aA][rR] binary
|
||||
*.[tT][gG][zZ] binary
|
||||
*.[zZ][iI][pP] binary
|
||||
|
||||
*.[tT][cC][nN] binary
|
||||
*.[sS][oO] binary
|
||||
*.[dD][lL][lL] binary
|
||||
*.[dD][yY][lL][iI][bB] binary
|
||||
*.[pP][sS][dD] binary
|
||||
*.[tT][tT][fF] binary
|
||||
*.[oO][tT][fF] binary
|
||||
|
||||
*.[pP][aA][tT][cC][hH] -text
|
||||
|
||||
*.[bB][aA][tT] text eol=crlf
|
||||
*.[cC][mM][dD] text eol=crlf
|
||||
*.[pP][sS]1 text eol=crlf
|
||||
|
||||
*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary
|
||||
# Auto detect text files and perform LF normalization
|
||||
* text=auto
|
||||
@@ -1,13 +0,0 @@
|
||||
|
||||
name: Build and test
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, main ]
|
||||
push:
|
||||
branches: [ master, main ]
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/build-and-test.yml@master
|
||||
secrets: inherit
|
||||
@@ -1,14 +0,0 @@
|
||||
|
||||
name: Release tagged build
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: [ '*' ]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
release-tags:
|
||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/release-tags.yml@master
|
||||
secrets: inherit
|
||||
+19
-33
@@ -1,38 +1,24 @@
|
||||
.gradle
|
||||
# eclipse
|
||||
bin
|
||||
*.launch
|
||||
.settings
|
||||
/.idea/
|
||||
/.vscode/
|
||||
/run/
|
||||
/build/
|
||||
/eclipse/
|
||||
.metadata
|
||||
.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
|
||||
|
||||
# idea
|
||||
out
|
||||
*.ipr
|
||||
*.iws
|
||||
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
|
||||
*.iml
|
||||
/.idea
|
||||
|
||||
# gradle
|
||||
build
|
||||
.gradle
|
||||
|
||||
# other
|
||||
/run
|
||||
classes
|
||||
logs/debug.log
|
||||
logs/latest.log
|
||||
@@ -1,48 +0,0 @@
|
||||
|
||||
Port with permission from phantamanta44.
|
||||
|
||||
# AE2 Fluid Crafting Rework
|
||||
|
||||
[](https://www.curseforge.com/minecraft/mc-mods/ae2-fluid-crafting-rework) 
|
||||
|
||||
Put fluids in the pattern!
|
||||
|
||||
AE2 autocrafting is amazing and everyone loves it, but it is always becoming painful when dealing with fluids. You have to put fluids in a container or use a dummy item to write patterns with fluids.
|
||||
|
||||
That's because AE2 doesn't support fluid as valid crafting ingredients before 1.16, so it can't handle fluids directly.
|
||||
|
||||
However, it is changed now! With **AE2 Fluid Crafting** you can write patterns with fluids freely. Your AE system can output and accept fluids like items without worrying about how to handle these fluid cells.
|
||||
|
||||
This is a rework and ported version of [ae2-fluid-crafting](https://github.com/phantamanta44/ae2-fluid-crafting)
|
||||
|
||||
## Features
|
||||
|
||||
- You can code fluid patterns on fluid terminal directly.
|
||||
- Mult/Div/Add/Sub Button also works on fluid.
|
||||
- An extended fluid terminal with 16 inputs and 4 outputs.
|
||||
- You can add or decrease fluid's amount by clicking with container.
|
||||
- Fluid Pattern can display its contents when put on pattern terminal.
|
||||
- [1.12.2] Fix the fluid amount display error when removing fluid.
|
||||
- [1.12.2] Upgrade cards can be inserted in Dual Interface.
|
||||
- [1.12.2] Fluid pattern is searchable in interface terminal.
|
||||
- [1.12.2] Fix crash when using block mode, fluid will also be considered as blockable.
|
||||
- [1.12.2] Fluid export bus supports crafting card.
|
||||
|
||||
## Installation
|
||||
|
||||
### 1.7.10
|
||||
Any version of AE2(Both Official AE2 and GTNH edition AE2 works).
|
||||
|
||||
**Extra Cells isn't needed**
|
||||
|
||||
### 1.12.2
|
||||
Unofficial AE2([PAE2](https://www.curseforge.com/minecraft/mc-mods/ae2-extended-life)).
|
||||
|
||||
Official AE2 isn't supported, you can use origin [AE2FC](https://github.com/phantamanta44/ae2-fluid-crafting) if you are playing with Official AE2.
|
||||
|
||||
## How to Use It
|
||||
https://github.com/GlodBlock/AE2FluidCraft-Rework/wiki
|
||||
|
||||
## Credited Works
|
||||
|
||||
E. Geng(@phantamanta44) and KilaBash (@Yefancy) - Their amazing origin work in 1.12.
|
||||
@@ -0,0 +1,88 @@
|
||||
|
||||
Port with permission from phantamanta44.
|
||||
|
||||
# AE2 Fluid Crafting Rework
|
||||
|
||||
[](https://www.curseforge.com/minecraft/mc-mods/ae2-fluid-crafting-rework) 
|
||||
|
||||
Put fluids in the pattern!
|
||||
|
||||
AE2 autocrafting is amazing and everyone loves it, but it is always becoming painful when dealing with fluids. You have to put fluids in a container or use a dummy item to write patterns with fluids.
|
||||
|
||||
That's because AE2 doesn't support fluid as valid crafting ingredients before 1.16, so it can't handle fluids directly.
|
||||
|
||||
However, it is changed now! With **AE2 Fluid Crafting** you can write patterns with fluids freely. Your AE system can output and accept fluids like items without worrying about how to handle these fluid cells.
|
||||
|
||||
This is a rework and ported version of [ae2-fluid-crafting](https://github.com/phantamanta44/ae2-fluid-crafting)
|
||||
|
||||
## Features
|
||||
|
||||
- You can code fluid patterns on fluid terminal directly.
|
||||
- Mult/Div/Add/Sub Button also works on fluid.
|
||||
- An extended fluid terminal with 16 inputs and 4 outputs.
|
||||
- You can add or decrease fluid's amount by clicking with container.
|
||||
- Fluid Pattern can display its contents when put on pattern terminal.
|
||||
- [1.12.2] Fix the fluid amount display error when removing fluid.
|
||||
- [1.12.2] Upgrade cards can be inserted in Dual Interface.
|
||||
- [1.12.2] Fluid pattern is searchable in interface terminal.
|
||||
- [1.12.2] Fix crash when using block mode, fluid will also be considered as blockable.
|
||||
- [1.12.2] Fluid export bus supports crafting card.
|
||||
|
||||
## Installation
|
||||
|
||||
### 1.7.10
|
||||
Any version of AE2(Both Official AE2 and GTNH edition AE2 works).
|
||||
|
||||
**Extra Cells isn't needed**
|
||||
|
||||
### 1.12.2
|
||||
Unofficial AE2([PAE2](https://www.curseforge.com/minecraft/mc-mods/ae2-extended-life)).
|
||||
|
||||
You can directly upgrade origin AE2FC2 in your old save.
|
||||
|
||||
Official AE2 isn't supported, you can use origin [AE2FC](https://github.com/phantamanta44/ae2-fluid-crafting) if you are playing with Official AE2.
|
||||
|
||||
## Basic Devices
|
||||
|
||||
### Fluid Discretizer
|
||||
The **Fluid Discretizer** is a device that, when attached to ME network, exposes the contents of its fluid storage grid as items, which take the form of "fluid drops".
|
||||
It does this by functioning as a sort of storage bus: when fluid drops are removed from its storage via the item grid, it extracts the corresponding fluid from the fluid grid.
|
||||
Conversely, when fluid drops inserted into its storage via the item grid, it injects the corresponding fluid into the fluid grid.
|
||||
Each fluid drop is equivalent to one mB of its respective fluid, which means a full stack of them is equivalent to 64 mB.
|
||||
Fluid drops have an important property: when an ME interface attempts to export fluid drops to a machine, it will attempt to convert them to fluid.
|
||||
This means an interface exporting drops of gelid cryotheum into a fluid transposer will successfully fill the transposer's internal tank rather than inserting the drops as items.
|
||||
This is the central mechanic that makes fluid autocrafting possible.
|
||||
Note that the only way to convert between fluids and fluid drops is a discretizer attached to an ME network.
|
||||
While you could theoretically use this as a very convoluted method of transporting fluids, it is not recomomended to do so.
|
||||
|
||||
### Fluid Pattern Encoder
|
||||
Most crafting recipes involving fluids require far more than 64 mB of a particular fluid, and so the standard pattern terminal will not do for encoding such recipes into patterns.
|
||||
This problem is solved by the **Fluid Pattern Encoder**, a utility that functions similarly to a pattern terminal.
|
||||
When a fluid-handling item (e.g. a bucket or tank) is inserted into the crafting ingredient slots, they will be converted into an equivalent stack of the corresponding fluid drops.
|
||||
Using this, patterns for recipes that require more than a stack of fluid drops can easily be encoded.
|
||||
AE2 Fluid Crafting also comes with a handy JEI integration module that allows the fluid pattern encoder to encode any JEI recipe involving fluids.
|
||||
This is the recommended way to play with the mod, since encoding patterns by hand is a little cumbersome.
|
||||
|
||||
### Fluid Pattern Terminal
|
||||
|
||||
Encoding recipes in a big and bulky workbench separate from the rest of your AE2 equipment can be a little inconvenient.
|
||||
Luckily, we have the **Fluid Pattern Terminal**, which combines the functionality of the standard pattern terminal and the fluid pattern encoder.
|
||||
Now, you can encode your fluid recipes using the same familiar interface you know and love!
|
||||
|
||||
### Fluid Pattern Interface
|
||||
|
||||
The standard ME interface lets you emit items and fluid packets with AE2FC, but it will only accept items, as in vanilla AE2.
|
||||
This is a little inconvenient when you want to build compact setups for autocrafting with fluid outputs, where you would need to use both an item interface for inputs, and a separate fluid interface for outputs.
|
||||
To make things easier, we have the **Fluid Pattern Interface**, which functions as a combination of an item interface and a fluid interface!
|
||||
Its GUI is the same as normal ME interface, but it can emit fluids directly instead of fluid packets! It also accepts fluid and item inputs.
|
||||
Automating fluid crafting machines has never been this quick and painless!
|
||||
|
||||
### Fluid Packets
|
||||
|
||||
When putting fluid pattern in a normal ME interface, it will emit fluid packets as fluid.
|
||||
So if you prefer to deal with item instead of fluids, you can transport these packets and turn them back to fluid with **ME Fluid Packet Decoder**.
|
||||
Simply connect the decoder to your ME network and insert the fluid packet; the decoder will, if possible, inject the fluid into your fluid storage grid.
|
||||
|
||||
## Credited Works
|
||||
|
||||
E. Geng(@phantamanta44) and KilaBash (@Yefancy) - Their amazing origin work in 1.12.
|
||||
+85
-4
@@ -1,5 +1,86 @@
|
||||
//version: 1707058017
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhconvention'
|
||||
buildscript {
|
||||
repositories {
|
||||
maven {
|
||||
url 'https://maven.minecraftforge.net/'
|
||||
}
|
||||
maven {
|
||||
name 'sonatype'
|
||||
url 'https://oss.sonatype.org/content/repositories/snapshots/'
|
||||
}
|
||||
maven {
|
||||
name 'Scala CI dependencies'
|
||||
url 'https://repo1.maven.org/maven2/'
|
||||
}
|
||||
maven {
|
||||
name 'jitpack'
|
||||
url 'https://jitpack.io'
|
||||
}
|
||||
maven {
|
||||
name "forge"
|
||||
url "http://files.minecraftforge.net/maven"
|
||||
}
|
||||
mavenLocal()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||
apply plugin: 'idea'
|
||||
|
||||
version = "2.3.0-r"
|
||||
group = "ae2fc"
|
||||
archivesBaseName = "Fluid Craft for AE2"
|
||||
|
||||
sourceCompatibility = targetCompatibility = '1.8'
|
||||
compileJava {
|
||||
sourceCompatibility = targetCompatibility = '1.8'
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven { url 'https://dvs1.progwml6.com/files/maven/' }
|
||||
maven { url 'https://jitpack.io/' }
|
||||
maven { url 'https://cursemaven.com/' }
|
||||
maven { url "https://minecraft.curseforge.com/api/maven/" }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile 'com.github.phantamanta44:jsr305:1.0.1'
|
||||
deobfCompile 'mezz.jei:jei_1.12.2:4.15.0.293' //jei
|
||||
deobfCompile "curse.maven:ae2-extended-life-570458:3785381" // pae2
|
||||
deobfCompile "curse.maven:packagedauto-308380:2977147" // 1.0.3.14
|
||||
deobfCompile "curse.maven:modular-machinery-270790:2761302" // 1.11.1
|
||||
deobfCompile "curse.maven:codechicken-lib-1-8-242818:2779848" //ccl
|
||||
deobfCompile "curse.maven:gregtech-ce-unofficial-557242:3784798" // gt
|
||||
}
|
||||
|
||||
minecraft {
|
||||
version = "1.12.2-14.23.5.2847"
|
||||
runDir = "run"
|
||||
mappings = "stable_39"
|
||||
useDepAts = true
|
||||
makeObfSourceJar = false
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'FMLCorePluginContainsFMLMod': 'true'
|
||||
attributes 'FMLCorePlugin' : 'com.glodblock.github.coremod.FCCoreMod'
|
||||
}
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
inputs.property "mcversion", project.minecraft.version
|
||||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include 'mcmod.info'
|
||||
|
||||
expand 'version': project.version, 'mcversion': project.minecraft.version
|
||||
}
|
||||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude 'mcmod.info'
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* 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.7.40-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-602-GTNH:dev')
|
||||
api('curse.maven:cofh-core-69162:2388751')
|
||||
api('com.github.GTNewHorizons:waila:1.8.4:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.6.21:dev")
|
||||
|
||||
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.12.0:dev") {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
|
||||
}
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.1.7-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.35:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.10.7:dev')
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.9.12:dev')
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.282: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.11.13-GTNH:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.7.7-GTNH:dev') { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.6.53:dev") { transitive = false }
|
||||
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.3.4:dev")
|
||||
}
|
||||
+4
-203
@@ -1,203 +1,4 @@
|
||||
# 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
|
||||
|
||||
# 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
|
||||
|
||||
# Whether to use modGroup as the maven publishing group.
|
||||
# When false, com.github.GTNewHorizons is used.
|
||||
useModGroupForPublishing = false
|
||||
|
||||
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
||||
autoUpdateBuildScript = false
|
||||
|
||||
# Version of Minecraft to target
|
||||
minecraftVersion = 1.7.10
|
||||
|
||||
# Version of Minecraft Forge to target
|
||||
forgeVersion = 10.13.4.1614
|
||||
|
||||
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
|
||||
channel = stable
|
||||
|
||||
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
|
||||
mappingsVersion = 12
|
||||
|
||||
# Defines other MCP mappings for dependency deobfuscation.
|
||||
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
|
||||
|
||||
# Select a default username for testing your mod. You can always override this per-run by running
|
||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||
developmentEnvironmentUserName = Developer
|
||||
|
||||
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
||||
# See https://github.com/bsideup/jabel for details on how this works.
|
||||
enableModernJavaSyntax = true
|
||||
|
||||
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
||||
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||
enableGenericInjection = 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 mod's version when compiled. You should use this to specify your mod's
|
||||
# version in @Mod([...], version = VERSION, [...]).
|
||||
# Leave these properties empty to skip individual token replacements.
|
||||
replaceGradleTokenInFile =
|
||||
|
||||
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
|
||||
# leave this property empty.
|
||||
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
|
||||
apiPackage = api
|
||||
|
||||
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
|
||||
# There can be multiple files in a space-separated list.
|
||||
# Example value: mymodid_at.cfg nei_at.cfg
|
||||
accessTransformersFile = ae2fc_at.cfg
|
||||
|
||||
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
|
||||
usesMixins = false
|
||||
|
||||
# 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
|
||||
coreModClass = coremod.FluidCraftCore
|
||||
|
||||
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
||||
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||
containsMixinsAndOrCoreModOnly = false
|
||||
|
||||
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
|
||||
forceEnableMixins = false
|
||||
|
||||
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
|
||||
# responsibility to check the license and request permission for distribution if required.
|
||||
usesShadowedDependencies = false
|
||||
|
||||
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
|
||||
# their own classes, making the minimization unreliable.
|
||||
minimizeShadowedDependencies = true
|
||||
|
||||
# If disabled, won't rename the shadowed classes.
|
||||
relocateShadowedDependencies = true
|
||||
|
||||
# Adds 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
|
||||
|
||||
systemProp.http.proxyHost=127.0.0.1
|
||||
systemProp.http.proxyPort=7890
|
||||
systemProp.https.proxyHost=127.0.0.1
|
||||
systemProp.https.proxyPort=7890
|
||||
Vendored
BIN
Binary file not shown.
+3
-4
@@ -1,7 +1,6 @@
|
||||
#Sun May 24 18:34:45 CEST 2020
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
@@ -1,129 +1,78 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/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/.
|
||||
#
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD=$JAVA_HOME/jre/sh/java
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD=$JAVA_HOME/bin/java
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
@@ -132,120 +81,92 @@ Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
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.
|
||||
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.
|
||||
|
||||
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.
|
||||
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=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# 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, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
Vendored
+34
-44
@@ -1,22 +1,4 @@
|
||||
@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
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@@ -27,29 +9,25 @@
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
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"
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@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
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
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
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
@@ -57,36 +35,48 @@ goto fail
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
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
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@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 %*
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
if "%ERRORLEVEL%"=="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%
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
// Add any additional repositories for your dependencies here
|
||||
|
||||
repositories {
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
|
||||
pluginManagement {
|
||||
repositories {
|
||||
maven {
|
||||
// RetroFuturaGradle
|
||||
name "GTNH Maven"
|
||||
url "https://nexus.gtnewhorizons.com/repository/public/"
|
||||
mavenContent {
|
||||
includeGroup("com.gtnewhorizons")
|
||||
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
||||
}
|
||||
}
|
||||
gradlePluginPortal()
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.38'
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
package yalter.mousetweaks.api;
|
||||
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
/**
|
||||
* This is the interface you want to implement in your GuiScreen to make it compatible with Mouse Tweaks.
|
||||
* If this interface is not enough (for example, you need a custom slot click function, or if you use a custom Container
|
||||
* which happens to be incompatible), check IMTModGuiContainer2Ex instead.
|
||||
* If you just need to disable Mouse Tweaks or the wheel tweak, see the MouseTweaksIgnore
|
||||
* or the MouseTweaksDisableWheelTweak annotations.
|
||||
*/
|
||||
public interface IMTModGuiContainer2 {
|
||||
/**
|
||||
* If you want to disable Mouse Tweaks in your GuiScreen, return true from this method.
|
||||
*
|
||||
* @return True if Mouse Tweaks should be disabled, false otherwise.
|
||||
*/
|
||||
boolean MT_isMouseTweaksDisabled();
|
||||
|
||||
/**
|
||||
* If you want to disable the Wheel Tweak in your GuiScreen, return true from this method.
|
||||
*
|
||||
* @return True if the Wheel Tweak should be disabled, false otherwise.
|
||||
*/
|
||||
boolean MT_isWheelTweakDisabled();
|
||||
|
||||
/**
|
||||
* Returns the Container.
|
||||
*
|
||||
* @return Container that is currently in use.
|
||||
*/
|
||||
Container MT_getContainer();
|
||||
|
||||
/**
|
||||
* Returns the Slot that is currently selected by the player, or null if no Slot is selected.
|
||||
*
|
||||
* @return Slot that is located under the mouse, or null if no Slot it currently under the mouse.
|
||||
*/
|
||||
Slot MT_getSlotUnderMouse();
|
||||
|
||||
/**
|
||||
* Return true if the given Slot behaves like the vanilla crafting output slots (inside the crafting table,
|
||||
* or the furnace output slot, or the anvil output slot, etc.). These slots are handled differently by Mouse Tweaks.
|
||||
*
|
||||
* @param slot the slot to check
|
||||
* @return True if slot is a crafting output slot.
|
||||
*/
|
||||
boolean MT_isCraftingOutput(Slot slot);
|
||||
|
||||
/**
|
||||
* Return true if the given Slot should be ignored by Mouse Tweaks. Examples of ignored slots are the item select
|
||||
* slots and the Destroy Item slot in the vanilla creative inventory.
|
||||
*
|
||||
* @param slot the slot to check
|
||||
* @return Tru if slot should be ignored by Mouse Tweaks.
|
||||
*/
|
||||
boolean MT_isIgnored(Slot slot);
|
||||
|
||||
/**
|
||||
* If your container has an RMB dragging functionality (like vanilla containers), disable it inside this method.
|
||||
* This method is called every frame (render tick), which is after all mouseClicked / mouseClickMove / mouseReleased
|
||||
* events are handled (although note these events are handled every game tick, which is far less frequent than every
|
||||
* render tick).<br><br>
|
||||
*
|
||||
* If true is returned from this method, Mouse Tweaks (after checking other conditions like isIgnored) will click
|
||||
* the slot on which the right mouse button was initially pressed (in most cases this is the slot currently under
|
||||
* mouse). This is needed because the vanilla RMB dragging functionality prevents the initial slot click.<br><br>
|
||||
*
|
||||
* For vanilla containers this method looks like this:
|
||||
* <pre>
|
||||
* this.ignoreMouseUp = true;
|
||||
*
|
||||
* if (this.dragSplitting) {
|
||||
* if (this.dragSplittingButton == 1) {
|
||||
* this.dragSplitting = false;
|
||||
* return true;
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* return false;
|
||||
* </pre>
|
||||
*
|
||||
* @return True if Mouse Tweaks should click the slot on which the RMB was pressed.
|
||||
*/
|
||||
boolean MT_disableRMBDraggingFunctionality();
|
||||
}
|
||||
@@ -1,121 +1,59 @@
|
||||
package com.glodblock.github;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import com.glodblock.github.common.Config;
|
||||
import com.glodblock.github.common.storage.FluidCellHandler;
|
||||
import com.glodblock.github.crossmod.extracells.EC2Replacer;
|
||||
import com.glodblock.github.crossmod.opencomputers.OCDriverInit;
|
||||
import com.glodblock.github.crossmod.waila.WailaInit;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.loader.CalculatorV2PluginLoader;
|
||||
import com.glodblock.github.loader.ChannelLoader;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.loader.RecipeLoader;
|
||||
import com.glodblock.github.loader.filter.FluidFilter;
|
||||
import com.glodblock.github.network.SPacketMEUpdateBuffer;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Upgrades;
|
||||
import com.glodblock.github.loader.FCBlocks;
|
||||
import com.glodblock.github.loader.FCItems;
|
||||
import com.glodblock.github.proxy.CommonProxy;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
|
||||
import cpw.mods.fml.common.event.FMLMissingMappingsEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStartingEvent;
|
||||
import cpw.mods.fml.common.event.FMLServerStoppedEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@Mod(
|
||||
modid = FluidCraft.MODID,
|
||||
version = FluidCraft.VERSION,
|
||||
name = FluidCraft.MODNAME,
|
||||
dependencies = "required-after:appliedenergistics2@[rv3-beta-238,);required-after:CoFHCore;required-after:Baubles;after:waila;after:thaumicenergistics;after:ae2wct")
|
||||
@Mod(modid = FluidCraft.MODID, version = FluidCraft.VERSION, useMetadata = true)
|
||||
public class FluidCraft {
|
||||
|
||||
public static final String MODID = "ae2fc";
|
||||
public static final String VERSION = FCTags.VERSION;
|
||||
public static final String MODNAME = "AE2 Fluid Crafting";
|
||||
public static final String VERSION = "2.3.0-r";
|
||||
|
||||
@Mod.Instance(MODID)
|
||||
public static FluidCraft INSTANCE;
|
||||
|
||||
@SidedProxy(
|
||||
clientSide = "com.glodblock.github.proxy.ClientProxy",
|
||||
serverSide = "com.glodblock.github.proxy.CommonProxy")
|
||||
@SidedProxy(clientSide = "com.glodblock.github.proxy.ClientProxy", serverSide = "com.glodblock.github.proxy.CommonProxy")
|
||||
public static CommonProxy proxy;
|
||||
|
||||
public static Logger log;
|
||||
|
||||
@Mod.EventHandler
|
||||
public static void preInit(FMLPreInitializationEvent event) {
|
||||
Config.run();
|
||||
ChannelLoader.INSTANCE.run();
|
||||
public void onPreInit(FMLPreInitializationEvent event) {
|
||||
log = event.getModLog();
|
||||
ModAndClassUtil.init();
|
||||
proxy.preInit(event);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public static void init(FMLInitializationEvent event) {
|
||||
if (ModAndClassUtil.OC) {
|
||||
OCDriverInit.run();
|
||||
}
|
||||
if (ModAndClassUtil.WAILA) {
|
||||
WailaInit.run();
|
||||
}
|
||||
public void onInit(FMLInitializationEvent event) {
|
||||
proxy.init(event);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public static void postInit(FMLPostInitializationEvent event) {
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(FluidCraft.INSTANCE, new InventoryHandler());
|
||||
|
||||
AEApi.instance().registries().cell().addCellHandler(new FluidCellHandler());
|
||||
ItemAndBlockHolder.loadSetting();
|
||||
|
||||
if (!Config.removeRecipe) {
|
||||
RecipeLoader.INSTANCE.run();
|
||||
}
|
||||
if (!ModAndClassUtil.NEW_HORIZONS_CORE_MOD) {
|
||||
RecipeLoader.addTerminalCards();
|
||||
RecipeLoader.addInfiniteWaterCell();
|
||||
}
|
||||
RecipeLoader.runTerminalRecipe();
|
||||
RecipeLoader.addDisassembleRecipe();
|
||||
|
||||
if (ModAndClassUtil.isV2) {
|
||||
CalculatorV2PluginLoader.installCalculatorV2Plugins();
|
||||
}
|
||||
if (ModAndClassUtil.isTypeFilter) {
|
||||
AEApi.instance().registries().itemDisplay().addItemFilter(FluidFilter::filter);
|
||||
}
|
||||
|
||||
public void onPostInit(FMLPostInitializationEvent event) {
|
||||
Upgrades.PATTERN_EXPANSION.registerItem(new ItemStack(FCBlocks.DUAL_INTERFACE), 3 );
|
||||
Upgrades.CRAFTING.registerItem(new ItemStack(FCBlocks.DUAL_INTERFACE), 1 );
|
||||
Upgrades.PATTERN_EXPANSION.registerItem(new ItemStack(FCItems.PART_DUAL_INTERFACE), 3 );
|
||||
Upgrades.CRAFTING.registerItem(new ItemStack(FCItems.PART_DUAL_INTERFACE), 1 );
|
||||
Upgrades.CRAFTING.registerItem( AEApi.instance().definitions().parts().fluidExportBus(), 1 );
|
||||
proxy.postInit(event);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void onLoadComplete(FMLLoadCompleteEvent event) {
|
||||
proxy.onLoadComplete(event);
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void onServerStart(FMLServerStartingEvent event) {
|
||||
SPacketMEUpdateBuffer.init();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void onServerStop(FMLServerStoppedEvent event) {
|
||||
SPacketMEUpdateBuffer.disable();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
public void missingMappings(FMLMissingMappingsEvent event) {
|
||||
if (!ModAndClassUtil.EC2 && Config.replaceEC2) {
|
||||
EC2Replacer.replaceExtraCells(event);
|
||||
}
|
||||
}
|
||||
|
||||
public static ResourceLocation resource(String path) {
|
||||
return new ResourceLocation(MODID, path);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package com.glodblock.github.api;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import com.glodblock.github.api.registries.ILevelTerminalRegistry;
|
||||
import com.glodblock.github.coremod.registries.LevelTerminalRegistry;
|
||||
|
||||
public final class FluidCraftAPI implements IFluidCraftAPI {
|
||||
|
||||
private static final FluidCraftAPI API = new FluidCraftAPI();
|
||||
|
||||
/**
|
||||
* These fluids will not be allowed to be stored in fluid storage cells.
|
||||
*/
|
||||
private final Set<Class<? extends Fluid>> blacklistedFluids = new HashSet<>();
|
||||
|
||||
/**
|
||||
* These fluids will not be displayed in a fluid terminal.
|
||||
*/
|
||||
private final Set<Class<? extends Fluid>> blacklistedDispFluids = new HashSet<>();
|
||||
|
||||
public static FluidCraftAPI instance() {
|
||||
return API;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blacklistFluidInStorage(Class<? extends Fluid> fluid) {
|
||||
blacklistedFluids.add(fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void blacklistFluidInDisplay(Class<? extends Fluid> fluid) {
|
||||
blacklistedDispFluids.add(fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlacklistedInStorage(Class<? extends Fluid> fluid) {
|
||||
return blacklistedFluids.contains(fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBlacklistedInDisplay(Class<? extends Fluid> fluid) {
|
||||
return blacklistedDispFluids.contains(fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILevelTerminalRegistry levelTerminalRegistry() {
|
||||
return LevelTerminalRegistry.instance();
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.glodblock.github.api;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import com.glodblock.github.api.registries.ILevelTerminalRegistry;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public interface IFluidCraftAPI {
|
||||
|
||||
/**
|
||||
* Blacklisted fluids will not be allowed to be added to a storage cell.
|
||||
*/
|
||||
void blacklistFluidInStorage(Class<? extends Fluid> fluid);
|
||||
|
||||
/**
|
||||
* Blacklisted fluids will not be displayed in fluid terminals.
|
||||
*/
|
||||
void blacklistFluidInDisplay(Class<? extends Fluid> fluid);
|
||||
|
||||
/**
|
||||
* Mostly for internal use; queries whether the fluid is blacklisted from storage cells.
|
||||
*/
|
||||
boolean isBlacklistedInStorage(Class<? extends Fluid> fluid);
|
||||
|
||||
/**
|
||||
* Mostly for internal use; queries whether the fluid is blacklisted from being displayed.
|
||||
*/
|
||||
boolean isBlacklistedInDisplay(Class<? extends Fluid> fluid);
|
||||
|
||||
/**
|
||||
* Get instance of `ILevelTerminalRegistry` to add new supported machines into terminal
|
||||
*/
|
||||
ILevelTerminalRegistry levelTerminalRegistry();
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.glodblock.github.api;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public interface ISide {
|
||||
|
||||
ForgeDirection getSide();
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.glodblock.github.api.registries;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import appeng.api.networking.IGridHost;
|
||||
|
||||
public interface ILevelTerminalRegistry {
|
||||
|
||||
void register(Class<? extends ILevelViewable> clazz);
|
||||
|
||||
void register(Class<? extends IGridHost> aeClass, ILevelViewableAdapter adapter);
|
||||
|
||||
Set<Class<? extends ILevelViewable>> getSupportedClasses();
|
||||
|
||||
boolean isAdopted(Class<? extends ILevelViewable> clazz);
|
||||
|
||||
Class<? extends IGridHost> getAdopted(Class<? extends ILevelViewable> clazz);
|
||||
|
||||
ILevelViewableAdapter getAdapter(Class<? extends ILevelViewable> clazz);
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package com.glodblock.github.api.registries;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
import com.glodblock.github.api.ISide;
|
||||
|
||||
import appeng.api.implementations.tiles.ISegmentedInventory;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.helpers.ICustomNameObject;
|
||||
|
||||
public interface ILevelViewable extends IGridHost, ISide, ISegmentedInventory, ICustomNameObject {
|
||||
|
||||
DimensionalCoord getLocation();
|
||||
|
||||
TileEntity getTile();
|
||||
|
||||
default long getSortValue() {
|
||||
TileEntity te = getTile();
|
||||
return ((long) te.zCoord << 24) ^ ((long) te.xCoord << 8) ^ te.yCoord;
|
||||
}
|
||||
|
||||
default boolean shouldDisplay() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Number of rows to expect. This is used with {@link #rowSize()} to determine how to render the slots.
|
||||
*/
|
||||
default int rows() {
|
||||
return 1;
|
||||
};
|
||||
|
||||
/**
|
||||
* Number of slots per row.
|
||||
*/
|
||||
default int rowSize() {
|
||||
return 1;
|
||||
};
|
||||
|
||||
default ItemStack getSelfItemStack() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* "Target" Display representation
|
||||
*/
|
||||
default ItemStack getDisplayItemStack() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.glodblock.github.api.registries;
|
||||
|
||||
import appeng.api.networking.IGridHost;
|
||||
|
||||
public interface ILevelViewableAdapter extends ILevelViewable {
|
||||
|
||||
ILevelViewable adapt(IGridHost gridHost);
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.glodblock.github.client;
|
||||
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class ClientHelper {
|
||||
|
||||
@SubscribeEvent
|
||||
public void updateTextureSheet(final TextureStitchEvent.Pre ev) {
|
||||
if (ev.map.getTextureType() == 0) {
|
||||
for (final FCPartsTexture cb : FCPartsTexture.values()) {
|
||||
cb.registerIcon(ev.map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
ClientHelper handler = new ClientHelper();
|
||||
MinecraftForge.EVENT_BUS.register(handler);
|
||||
FMLCommonHandler.instance().bus().register(handler);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.glodblock.github.client;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiNumberBox;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.fluids.util.IAEFluidTank;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.container.ContainerBurette;
|
||||
import com.glodblock.github.client.render.FluidRenderUtils;
|
||||
import com.glodblock.github.common.tile.TileBurette;
|
||||
import com.glodblock.github.handler.ButtonMouseHandler;
|
||||
import com.glodblock.github.handler.TankMouseHandler;
|
||||
import com.glodblock.github.network.CPacketTransposeFluid;
|
||||
import com.glodblock.github.util.MouseRegionManager;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class GuiBurette extends AEBaseGui {
|
||||
|
||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/burette.png");
|
||||
private static final int TANK_X = 52, TANK_Y = 17;
|
||||
private static final int TANK_WIDTH = 16, TANK_HEIGHT = 32;
|
||||
|
||||
private final ContainerBurette cont;
|
||||
private GuiNumberBox amountField;
|
||||
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
|
||||
|
||||
public GuiBurette(InventoryPlayer ipl, TileBurette tile) {
|
||||
super(new ContainerBurette(ipl, tile));
|
||||
this.cont = (ContainerBurette)inventorySlots;
|
||||
|
||||
mouseRegions.addRegion(TANK_X, TANK_Y, TANK_WIDTH, TANK_HEIGHT,
|
||||
new TankMouseHandler(cont.getTile().getFluidInventory(), 0));
|
||||
mouseRegions.addRegion(70, 16, 7, 7, ButtonMouseHandler.dumpTank(cont, 0));
|
||||
mouseRegions.addRegion(73, 42, 8, 16, createTransposeButton(true));
|
||||
mouseRegions.addRegion(81, 42, 8, 16, createTransposeButton(false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
amountField = new GuiNumberBox(fontRenderer, guiLeft + 95, guiTop + 46, 28, fontRenderer.FONT_HEIGHT, Integer.class);
|
||||
amountField.setEnableBackgroundDrawing(false);
|
||||
amountField.setMaxStringLength(4);
|
||||
amountField.setTextColor(0xffffff);
|
||||
amountField.setVisible(true);
|
||||
amountField.setFocused(true);
|
||||
amountField.setText("1000");
|
||||
}
|
||||
|
||||
private ButtonMouseHandler createTransposeButton(boolean into) {
|
||||
return new ButtonMouseHandler(into ? NameConst.TT_TRANSPOSE_IN : NameConst.TT_TRANSPOSE_OUT, () -> {
|
||||
try {
|
||||
int amount = Integer.parseInt(amountField.getText());
|
||||
if (cont.canTranferFluid(into)) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketTransposeFluid(amount, into));
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
// NO-OP
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int xCoord, int yCoord, int btn) throws IOException {
|
||||
if (mouseRegions.onClick(xCoord, yCoord, btn)) {
|
||||
amountField.mouseClicked(xCoord, yCoord, btn);
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(final char character, final int key) throws IOException {
|
||||
if (!checkHotbarKeys(key)) {
|
||||
if ((key == 211 || key == 205 || key == 203 || key == 14 || Character.isDigit(character))
|
||||
&& amountField.textboxKeyTyped(character, key)) {
|
||||
try {
|
||||
int amount = Integer.parseInt(amountField.getText());
|
||||
if (amount < 0) {
|
||||
amountField.setText("1");
|
||||
} else {
|
||||
amountField.setText(Long.toString(amount));
|
||||
}
|
||||
} catch (final NumberFormatException e) {
|
||||
// NO-OP
|
||||
}
|
||||
} else {
|
||||
super.keyTyped(character, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
mc.getTextureManager().bindTexture(TEX_BG);
|
||||
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
|
||||
amountField.drawTextBox();
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRenderer.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_BURETTE)), 8, 6, 0x404040);
|
||||
fontRenderer.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
|
||||
IAEFluidTank fluidInv = cont.getTile().getFluidInventory();
|
||||
FluidRenderUtils.renderFluidIntoGuiCleanly(TANK_X, TANK_Y, TANK_WIDTH, TANK_HEIGHT,
|
||||
fluidInv.getFluidInSlot(0), fluidInv.getTankProperties()[0].getCapacity());
|
||||
|
||||
mouseRegions.render(mouseX, mouseY);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.glodblock.github.client;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.implementations.GuiExpandedProcessingPatternTerm;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.client.render.StackSizeRenderer;
|
||||
import appeng.container.slot.SlotFake;
|
||||
import com.glodblock.github.client.container.ContainerExtendedFluidPatternTerminal;
|
||||
import com.glodblock.github.client.render.FluidRenderUtils;
|
||||
import com.glodblock.github.inventory.GuiType;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
public class GuiExtendedFluidPatternTerminal extends GuiExpandedProcessingPatternTerm {
|
||||
|
||||
private final StackSizeRenderer stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
|
||||
private GuiTabButton craftingStatusBtn;
|
||||
|
||||
public GuiExtendedFluidPatternTerminal(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||
super(inventoryPlayer, te);
|
||||
ContainerExtendedFluidPatternTerminal container = new ContainerExtendedFluidPatternTerminal(inventoryPlayer, te);
|
||||
container.setGui(this);
|
||||
this.inventorySlots = container;
|
||||
Ae2ReflectClient.setGuiExContainer(this, container);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
craftingStatusBtn = Ae2ReflectClient.getCraftingStatusButton(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawSlot(Slot slot) {
|
||||
if (!(slot instanceof SlotFake && FluidRenderUtils.renderFluidPacketIntoGuiSlot(
|
||||
slot, slot.getStack(), stackSizeRenderer, fontRenderer))) {
|
||||
super.drawSlot(slot);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (btn == craftingStatusBtn) {
|
||||
InventoryHandler.switchGui(GuiType.FLUID_PAT_TERM_CRAFTING_STATUS);
|
||||
} else {
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.glodblock.github.client;
|
||||
|
||||
import appeng.client.gui.implementations.GuiPriority;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import com.glodblock.github.interfaces.FCPriorityHost;
|
||||
import com.glodblock.github.inventory.GuiType;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class GuiFCPriority extends GuiPriority {
|
||||
|
||||
private final GuiType originalGui;
|
||||
private GuiTabButton originalGuiBtn;
|
||||
|
||||
public GuiFCPriority(final InventoryPlayer inventoryPlayer, final FCPriorityHost te) {
|
||||
super(inventoryPlayer, te);
|
||||
this.originalGui = te.getGuiType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
originalGuiBtn = Ae2ReflectClient.getOriginalGuiButton(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) throws IOException {
|
||||
if (btn == originalGuiBtn) {
|
||||
InventoryHandler.switchGui(originalGui);
|
||||
} else {
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
}
|
||||
|
||||
protected String getBackground() {
|
||||
return "guis/priority.png";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.glodblock.github.client;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.fluids.client.gui.GuiFluidInterface;
|
||||
import appeng.fluids.helper.IFluidInterfaceHost;
|
||||
import com.glodblock.github.inventory.GuiType;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class GuiFluidDualInterface extends GuiFluidInterface {
|
||||
|
||||
private GuiTabButton switchInterface;
|
||||
private GuiTabButton priorityBtn;
|
||||
|
||||
public GuiFluidDualInterface(final InventoryPlayer ip, final IFluidInterfaceHost te) {
|
||||
super(ip, te);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
ItemStack icon = AEApi.instance().definitions().blocks().iface().maybeStack(1).orElse(ItemStack.EMPTY);
|
||||
switchInterface = new GuiTabButton(guiLeft + 133, guiTop, icon, icon.getDisplayName(), itemRender);
|
||||
buttonList.add(switchInterface);
|
||||
priorityBtn = Ae2ReflectClient.getPriorityButton(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) throws IOException {
|
||||
if (btn == switchInterface) {
|
||||
InventoryHandler.switchGui(GuiType.DUAL_ITEM_INTERFACE);
|
||||
} else if (btn == priorityBtn) {
|
||||
InventoryHandler.switchGui(GuiType.PRIORITY);
|
||||
} else {
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean drawUpgrades() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.glodblock.github.client;
|
||||
|
||||
import appeng.client.gui.implementations.GuiUpgradeable;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.fluids.client.gui.widgets.GuiFluidSlot;
|
||||
import appeng.fluids.client.gui.widgets.GuiOptionalFluidSlot;
|
||||
import appeng.fluids.container.ContainerFluidIO;
|
||||
import appeng.fluids.parts.PartSharedFluidBus;
|
||||
import appeng.fluids.util.IAEFluidTank;
|
||||
import com.glodblock.github.client.container.ContainerFluidExportBus;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class GuiFluidExportBus extends GuiUpgradeable {
|
||||
|
||||
private final PartSharedFluidBus bus;
|
||||
|
||||
public GuiFluidExportBus(InventoryPlayer inventoryPlayer, PartSharedFluidBus te) {
|
||||
super(new ContainerFluidExportBus(inventoryPlayer, te));
|
||||
this.bus = te;
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
ContainerFluidIO container = (ContainerFluidIO)this.inventorySlots;
|
||||
IAEFluidTank inv = this.bus.getConfig();
|
||||
this.guiSlots.add(new GuiFluidSlot(inv, 0, 0, 80, 40));
|
||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 1, 1, 1, 80, 40, -1, 0));
|
||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 2, 2, 1, 80, 40, 1, 0));
|
||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 3, 3, 1, 80, 40, 0, -1));
|
||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 4, 4, 1, 80, 40, 0, 1));
|
||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 5, 5, 2, 80, 40, -1, -1));
|
||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 6, 6, 2, 80, 40, 1, -1));
|
||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 7, 7, 2, 80, 40, -1, 1));
|
||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 8, 8, 2, 80, 40, 1, 1));
|
||||
}
|
||||
|
||||
protected GuiText getName() {
|
||||
return GuiText.ExportBusFluids;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
package com.glodblock.github.client;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiNumberBox;
|
||||
import appeng.core.localization.GuiText;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.container.ContainerFluidLevelMaintainer;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.common.tile.TileFluidLevelMaintainer;
|
||||
import com.glodblock.github.network.CPacketUpdateFluidLevel;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class GuiFluidLevelMaintainer extends AEBaseGui {
|
||||
|
||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/fluid_level_maintainer.png");
|
||||
|
||||
private final ContainerFluidLevelMaintainer cont;
|
||||
private final GuiNumberBox[] maintain = new GuiNumberBox[TileFluidLevelMaintainer.MAX_FLUID];
|
||||
private final GuiNumberBox[] request = new GuiNumberBox[TileFluidLevelMaintainer.MAX_FLUID];
|
||||
|
||||
public GuiFluidLevelMaintainer(InventoryPlayer ipl, TileFluidLevelMaintainer tile) {
|
||||
super(new ContainerFluidLevelMaintainer(ipl, tile));
|
||||
this.cont = (ContainerFluidLevelMaintainer) inventorySlots;
|
||||
this.ySize = 223;
|
||||
}
|
||||
|
||||
public void setMaintainNumber(int id, int size) {
|
||||
if (id < 0 || id >= TileFluidLevelMaintainer.MAX_FLUID || size < 0)
|
||||
return;
|
||||
this.maintain[id].setText(String.valueOf(size));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderHoveredToolTip(int x, int y) {
|
||||
if (this.mc.player.inventory.getItemStack().isEmpty() && this.getSlotUnderMouse() != null
|
||||
&& this.getSlotUnderMouse().getHasStack() && this.getSlotUnderMouse() instanceof ContainerFluidLevelMaintainer.DisplayFluidSlot)
|
||||
{
|
||||
ItemStack packet = this.getSlotUnderMouse().getStack();
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(packet);
|
||||
this.renderToolTip(ItemFluidPacket.newDisplayStack(fluid), x, y);
|
||||
}
|
||||
else {
|
||||
super.renderHoveredToolTip(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char character, int key) throws IOException {
|
||||
|
||||
if (!this.checkHotbarKeys(key)) {
|
||||
GuiNumberBox focus = null;
|
||||
int id = 0;
|
||||
for (int i = 0; i < TileFluidLevelMaintainer.MAX_FLUID; i ++) {
|
||||
if (maintain[i].isFocused()) {
|
||||
focus = maintain[i];
|
||||
id = i;
|
||||
}
|
||||
if (request[i].isFocused()) {
|
||||
focus = request[i];
|
||||
id = i + 10;
|
||||
}
|
||||
}
|
||||
if (focus != null && key != 1) {
|
||||
if ((key == 211 || key == 205 || key == 203 || key == 14 || character == '-' || Character.isDigit(character)) && focus.textboxKeyTyped(character, key)) {
|
||||
try {
|
||||
String out = focus.getText();
|
||||
|
||||
boolean fixed;
|
||||
for(fixed = false; out.startsWith("0") && out.length() > 1; fixed = true) {
|
||||
out = out.substring(1);
|
||||
}
|
||||
|
||||
if (fixed) {
|
||||
focus.setText(out);
|
||||
}
|
||||
|
||||
if (out.isEmpty()) {
|
||||
out = "0";
|
||||
}
|
||||
|
||||
long result = Long.parseLong(out);
|
||||
if (result < 0L) {
|
||||
focus.setText("1");
|
||||
result = 1;
|
||||
}
|
||||
|
||||
if (result > Integer.MAX_VALUE) {
|
||||
result = Integer.MAX_VALUE;
|
||||
focus.setText(String.valueOf(result));
|
||||
}
|
||||
|
||||
if (id >= 10 || result != 0)
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketUpdateFluidLevel(id, (int) result));
|
||||
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
super.keyTyped(character, key);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
for (int i = 0; i < TileFluidLevelMaintainer.MAX_FLUID; i ++) {
|
||||
maintain[i] = new GuiNumberBox(this.fontRenderer, this.guiLeft + 39, this.guiTop + 33 + i * 20, 51, 10, Integer.class);
|
||||
request[i] = new GuiNumberBox(this.fontRenderer, this.guiLeft + 102, this.guiTop + 33 + i * 20, 51, 10, Integer.class);
|
||||
maintain[i].setTextColor(16777215);
|
||||
request[i].setTextColor(16777215);
|
||||
maintain[i].setEnableBackgroundDrawing(false);
|
||||
request[i].setEnableBackgroundDrawing(false);
|
||||
maintain[i].setMaxStringLength(10);
|
||||
request[i].setMaxStringLength(10);
|
||||
}
|
||||
TileFluidLevelMaintainer tile = this.cont.getTile();
|
||||
IItemHandler inv = tile.getInventoryHandler();
|
||||
for (int i = 0; i < inv.getSlots(); i ++) {
|
||||
if (!inv.getStackInSlot(i).isEmpty()) {
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(inv.getStackInSlot(i));
|
||||
this.maintain[i].setText(String.valueOf(fluid == null ? "0" : fluid.amount));
|
||||
}
|
||||
else {
|
||||
this.maintain[i].setText("0");
|
||||
}
|
||||
this.request[i].setText(String.valueOf(tile.getRequest()[i]));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int xCoord, int yCoord, int btn) throws IOException {
|
||||
for (int i = 0; i < TileFluidLevelMaintainer.MAX_FLUID; i ++) {
|
||||
this.configNumberBar(request[i], xCoord, yCoord, btn);
|
||||
this.configNumberBar(maintain[i], xCoord, yCoord, btn);
|
||||
}
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
|
||||
private void configNumberBar(GuiNumberBox bar, int xCoord, int yCoord, int btn) {
|
||||
bar.mouseClicked(xCoord, yCoord, btn);
|
||||
if (btn == 1 && bar.isFocused()) {
|
||||
bar.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRenderer.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_LEVEL_MAINTAINER)), 8, 6, 0x404040);
|
||||
fontRenderer.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
fontRenderer.drawString(I18n.format(NameConst.MISC_THRESHOLD), 39, 19, 0x404040);
|
||||
fontRenderer.drawString(I18n.format(NameConst.MISC_REQ), 102, 19, 0x404040);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
mc.getTextureManager().bindTexture(TEX_BG);
|
||||
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
|
||||
for (int i = 0; i < TileFluidLevelMaintainer.MAX_FLUID ; i ++) {
|
||||
this.maintain[i].drawTextBox();
|
||||
this.request[i].drawTextBox();
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
-13
@@ -1,16 +1,14 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidPacketDecoder;
|
||||
import com.glodblock.github.common.tile.TileFluidPacketDecoder;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
package com.glodblock.github.client;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.core.localization.GuiText;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.container.ContainerFluidPacketDecoder;
|
||||
import com.glodblock.github.common.tile.TileFluidPacketDecoder;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GuiFluidPacketDecoder extends AEBaseGui {
|
||||
|
||||
@@ -28,7 +26,8 @@ public class GuiFluidPacketDecoder extends AEBaseGui {
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_PACKET_DECODER)), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
fontRenderer.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_PACKET_DECODER)), 8, 6, 0x404040);
|
||||
fontRenderer.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+40
-70
@@ -1,33 +1,33 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
package com.glodblock.github.client;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.render.StackSizeRenderer;
|
||||
import appeng.core.localization.GuiText;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.container.ContainerFluidPatternEncoder;
|
||||
import com.glodblock.github.client.render.FluidRenderUtils;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.common.tile.TileFluidPatternEncoder;
|
||||
import com.glodblock.github.interfaces.SlotFluid;
|
||||
import com.glodblock.github.inventory.slot.SlotSingleItem;
|
||||
import com.glodblock.github.network.CPacketEncodePattern;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
import com.glodblock.github.util.MouseRegionManager;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
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;
|
||||
import com.glodblock.github.common.tile.TileFluidPatternEncoder;
|
||||
import com.glodblock.github.inventory.gui.MouseRegionManager;
|
||||
import com.glodblock.github.inventory.slot.ISlotFluid;
|
||||
import com.glodblock.github.inventory.slot.SlotSingleItem;
|
||||
import com.glodblock.github.network.CPacketEncodePattern;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.core.localization.GuiText;
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class GuiFluidPatternEncoder extends AEBaseGui {
|
||||
|
||||
@@ -35,12 +35,12 @@ public class GuiFluidPatternEncoder extends AEBaseGui {
|
||||
|
||||
private final ContainerFluidPatternEncoder cont;
|
||||
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
|
||||
private final StackSizeRenderer stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
|
||||
|
||||
public GuiFluidPatternEncoder(InventoryPlayer ipl, TileFluidPatternEncoder tile) {
|
||||
super(new ContainerFluidPatternEncoder(ipl, tile));
|
||||
this.cont = (ContainerFluidPatternEncoder) inventorySlots;
|
||||
this.cont = (ContainerFluidPatternEncoder)inventorySlots;
|
||||
mouseRegions.addRegion(141, 38, 10, 10, new MouseRegionManager.Handler() {
|
||||
|
||||
@Override
|
||||
public List<String> getTooltip() {
|
||||
return Collections.singletonList(I18n.format(NameConst.TT_ENCODE_PATTERN));
|
||||
@@ -60,7 +60,7 @@ public class GuiFluidPatternEncoder extends AEBaseGui {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int xCoord, int yCoord, int btn) {
|
||||
protected void mouseClicked(int xCoord, int yCoord, int btn) throws IOException {
|
||||
if (mouseRegions.onClick(xCoord, yCoord, btn)) {
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
@@ -74,65 +74,35 @@ public class GuiFluidPatternEncoder extends AEBaseGui {
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_PATTERN_ENCODER)), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
fontRenderer.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_PATTERN_ENCODER)), 8, 6, 0x404040);
|
||||
fontRenderer.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
mouseRegions.render(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_146977_a(final Slot s) {
|
||||
this.drawSlot0(s);
|
||||
}
|
||||
|
||||
public void drawSlot0(Slot slot) {
|
||||
if (slot instanceof ISlotFluid) {
|
||||
IAEItemStack stack = ((ISlotFluid) slot).getAeStack();
|
||||
super.func_146977_a(new SlotSingleItem(slot));
|
||||
if (stack == null) return;
|
||||
IAEItemStack fake = stack.copy();
|
||||
if (fake.getItemStack().getItem() instanceof ItemFluidPacket) {
|
||||
if (ItemFluidPacket.getFluidStack(stack) != null && ItemFluidPacket.getFluidStack(stack).amount > 0)
|
||||
fake.setStackSize(ItemFluidPacket.getFluidStack(stack).amount);
|
||||
public void drawSlot(Slot slot) {
|
||||
if (slot instanceof SlotFluid) {
|
||||
IAEItemStack stack = ((SlotFluid)slot).getAeStack();
|
||||
if (FluidRenderUtils.renderFluidPacketIntoGuiSlot(slot, stack, stackSizeRenderer, fontRenderer)) {
|
||||
return;
|
||||
}
|
||||
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);
|
||||
super.drawSlot(new SlotSingleItem(slot));
|
||||
stackSizeRenderer.renderStackSize(fontRenderer, stack, slot.xPos, slot.yPos);
|
||||
} else {
|
||||
super.func_146977_a(slot);
|
||||
super.drawSlot(slot);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void renderToolTip(ItemStack stack, int x, int y) {
|
||||
List list;
|
||||
@Nonnull
|
||||
public List<String> getItemToolTip(ItemStack stack) {
|
||||
if (stack.getItem() instanceof ItemFluidPacket) {
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(stack);
|
||||
if (fluid != null) {
|
||||
list = Arrays.asList(
|
||||
fluid.getLocalizedName(),
|
||||
String.format(EnumChatFormatting.GRAY + "%,d mB", fluid.amount));
|
||||
} else {
|
||||
list = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
|
||||
}
|
||||
} else {
|
||||
list = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
|
||||
}
|
||||
|
||||
for (int k = 0; k < list.size(); ++k) {
|
||||
if (k == 0) {
|
||||
list.set(k, stack.getRarity().rarityColor + (String) list.get(k));
|
||||
} else {
|
||||
list.set(k, EnumChatFormatting.GRAY + (String) list.get(k));
|
||||
return Arrays.asList(fluid.getLocalizedName(), String.format(TextFormatting.GRAY + "%,d mB", fluid.amount));
|
||||
}
|
||||
}
|
||||
FontRenderer font = stack.getItem().getFontRenderer(stack);
|
||||
drawHoveringText(list, x, y, (font == null ? fontRendererObj : font));
|
||||
return super.getItemToolTip(stack);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.glodblock.github.client;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.implementations.GuiPatternTerm;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.client.render.StackSizeRenderer;
|
||||
import appeng.container.slot.SlotFake;
|
||||
import com.glodblock.github.client.container.ContainerFluidPatternTerminal;
|
||||
import com.glodblock.github.client.render.FluidRenderUtils;
|
||||
import com.glodblock.github.inventory.GuiType;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
public class GuiFluidPatternTerminal extends GuiPatternTerm {
|
||||
|
||||
private final StackSizeRenderer stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
|
||||
private GuiTabButton craftingStatusBtn;
|
||||
|
||||
public GuiFluidPatternTerminal(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||
super(inventoryPlayer, te);
|
||||
ContainerFluidPatternTerminal container = new ContainerFluidPatternTerminal(inventoryPlayer, te);
|
||||
container.setGui(this);
|
||||
this.inventorySlots = container;
|
||||
Ae2ReflectClient.setGuiContainer(this, container);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
craftingStatusBtn = Ae2ReflectClient.getCraftingStatusButton(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawSlot(Slot slot) {
|
||||
if (!(slot instanceof SlotFake && FluidRenderUtils.renderFluidPacketIntoGuiSlot(
|
||||
slot, slot.getStack(), stackSizeRenderer, fontRenderer))) {
|
||||
super.drawSlot(slot);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (btn == craftingStatusBtn) {
|
||||
InventoryHandler.switchGui(GuiType.FLUID_PAT_TERM_CRAFTING_STATUS);
|
||||
} else {
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.glodblock.github.client;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.implementations.GuiCraftingStatus;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import com.glodblock.github.common.part.PartExtendedFluidPatternTerminal;
|
||||
import com.glodblock.github.common.part.PartFluidPatternTerminal;
|
||||
import com.glodblock.github.inventory.GuiType;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class GuiFluidPatternTerminalCraftingStatus extends GuiCraftingStatus {
|
||||
|
||||
private GuiTabButton originalGuiBtn;
|
||||
private final ITerminalHost part;
|
||||
|
||||
public GuiFluidPatternTerminalCraftingStatus(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||
super(inventoryPlayer, te);
|
||||
this.part = te;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
originalGuiBtn = Ae2ReflectClient.getOriginalGuiButton(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) throws IOException {
|
||||
if (btn == originalGuiBtn) {
|
||||
if (part instanceof PartFluidPatternTerminal)
|
||||
InventoryHandler.switchGui(GuiType.FLUID_PATTERN_TERMINAL);
|
||||
else if (part instanceof PartExtendedFluidPatternTerminal)
|
||||
InventoryHandler.switchGui(GuiType.FLUID_EXTENDED_PATTERN_TERMINAL);
|
||||
} else {
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.glodblock.github.client;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.fluids.util.IAEFluidTank;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.container.ContainerIngredientBuffer;
|
||||
import com.glodblock.github.client.render.FluidRenderUtils;
|
||||
import com.glodblock.github.common.tile.TileIngredientBuffer;
|
||||
import com.glodblock.github.handler.ButtonMouseHandler;
|
||||
import com.glodblock.github.handler.TankMouseHandler;
|
||||
import com.glodblock.github.util.MouseRegionManager;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import net.minecraft.client.renderer.BufferBuilder;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class GuiIngredientBuffer extends AEBaseGui {
|
||||
|
||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/ingredient_buffer.png");
|
||||
private static final int TANK_X = 47, TANK_X_OFF = 22, TANK_Y = 18;
|
||||
private static final int TANK_WIDTH = 16, TANK_HEIGHT = 74;
|
||||
|
||||
private final ContainerIngredientBuffer cont;
|
||||
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
|
||||
|
||||
public GuiIngredientBuffer(InventoryPlayer ipl, TileIngredientBuffer tile) {
|
||||
super(new ContainerIngredientBuffer(ipl, tile));
|
||||
this.cont = (ContainerIngredientBuffer) inventorySlots;
|
||||
this.ySize = 222;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
mouseRegions.addRegion(TANK_X + TANK_X_OFF * i, TANK_Y, TANK_WIDTH, TANK_HEIGHT,
|
||||
new TankMouseHandler(cont.getTile().getFluidInventory(), i));
|
||||
mouseRegions.addRegion(TANK_X + 10 + 22 * i, TANK_Y + TANK_HEIGHT + 2, 7, 7,
|
||||
ButtonMouseHandler.dumpTank(cont, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int xCoord, int yCoord, int btn) throws IOException {
|
||||
if (mouseRegions.onClick(xCoord, yCoord, btn)) {
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
mc.getTextureManager().bindTexture(TEX_BG);
|
||||
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRenderer.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_INGREDIENT_BUFFER)), 8, 6, 0x404040);
|
||||
fontRenderer.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
|
||||
IAEFluidTank fluidInv = cont.getTile().getFluidInventory();
|
||||
mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
Tessellator tess = Tessellator.getInstance();
|
||||
BufferBuilder buf = tess.getBuffer();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
FluidRenderUtils.renderFluidIntoGui(tess, buf, TANK_X + i * TANK_X_OFF, TANK_Y, TANK_WIDTH, TANK_HEIGHT,
|
||||
fluidInv.getFluidInSlot(i), fluidInv.getTankProperties()[i].getCapacity());
|
||||
}
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
|
||||
mouseRegions.render(mouseX, mouseY);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.glodblock.github.client;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.client.gui.implementations.GuiInterface;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.helpers.IInterfaceHost;
|
||||
import com.glodblock.github.inventory.GuiType;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class GuiItemDualInterface extends GuiInterface {
|
||||
|
||||
private GuiTabButton switchInterface;
|
||||
private GuiTabButton priorityBtn;
|
||||
|
||||
public GuiItemDualInterface(final InventoryPlayer inventoryPlayer, final IInterfaceHost te) {
|
||||
super(inventoryPlayer, te);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addButtons() {
|
||||
super.addButtons();
|
||||
ItemStack icon = AEApi.instance().definitions().blocks().fluidIface().maybeStack(1).orElse(ItemStack.EMPTY);
|
||||
switchInterface = new GuiTabButton(guiLeft + 133, guiTop, icon, icon.getDisplayName(), itemRender);
|
||||
buttonList.add(switchInterface);
|
||||
priorityBtn = Ae2ReflectClient.getPriorityButton(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBackground() {
|
||||
return "guis/interface.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) throws IOException {
|
||||
if (btn == switchInterface) {
|
||||
InventoryHandler.switchGui(GuiType.DUAL_FLUID_INTERFACE);
|
||||
} else if (btn == priorityBtn) {
|
||||
InventoryHandler.switchGui(GuiType.PRIORITY);
|
||||
} else {
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.glodblock.github.client.container;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotNormal;
|
||||
import appeng.fluids.container.IFluidSyncContainer;
|
||||
import appeng.fluids.helper.FluidSyncHelper;
|
||||
import appeng.fluids.util.IAEFluidTank;
|
||||
import appeng.util.Platform;
|
||||
import com.glodblock.github.common.tile.TileBurette;
|
||||
import com.glodblock.github.interfaces.TankDumpable;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IContainerListener;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidHandlerItem;
|
||||
import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ContainerBurette extends AEBaseContainer implements IFluidSyncContainer, TankDumpable {
|
||||
|
||||
private final TileBurette tile;
|
||||
private final FluidSyncHelper fluidSync;
|
||||
|
||||
public ContainerBurette(InventoryPlayer ipl, TileBurette tile) {
|
||||
super(ipl, tile);
|
||||
this.tile = tile;
|
||||
this.fluidSync = new FluidSyncHelper(tile.getFluidInventory(), 0);
|
||||
addSlotToContainer(new SlotNormal(tile.getInternalInventory(), 0, 52, 53));
|
||||
bindPlayerInventory(ipl, 0, 84);
|
||||
}
|
||||
|
||||
public TileBurette getTile() {
|
||||
return tile;
|
||||
}
|
||||
|
||||
public boolean canTranferFluid(boolean into) {
|
||||
IAEFluidTank tileTank = tile.getFluidInventory();
|
||||
IFluidTankProperties tileTankInfo = tileTank.getTankProperties()[0];
|
||||
IAEFluidStack tileFluid = tileTank.getFluidInSlot(0);
|
||||
if (into) {
|
||||
if (tileFluid != null && tileFluid.getStackSize() >= tileTankInfo.getCapacity()) {
|
||||
return false;
|
||||
}
|
||||
} else if (tileFluid == null) {
|
||||
return false;
|
||||
}
|
||||
ItemStack stack = tile.getInternalInventory().getStackInSlot(0);
|
||||
if (stack.isEmpty() || !stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) {
|
||||
return false;
|
||||
}
|
||||
IFluidHandlerItem itemTank = Objects.requireNonNull(
|
||||
stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null));
|
||||
for (IFluidTankProperties itemTankInfo : itemTank.getTankProperties()) {
|
||||
if (into) {
|
||||
if (itemTankInfo.canDrain() && tileTankInfo.canFillFluidType(itemTankInfo.getContents())) {
|
||||
return true;
|
||||
}
|
||||
} else if (itemTankInfo.canFillFluidType(tileFluid.getFluidStack())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void tryTransferFluid(int amount, boolean into) {
|
||||
ItemStack stack = tile.getInternalInventory().getStackInSlot(0);
|
||||
if (stack.isEmpty() || !stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) {
|
||||
return;
|
||||
}
|
||||
IAEFluidTank tileTank = tile.getFluidInventory();
|
||||
IFluidHandlerItem itemTank = Objects.requireNonNull(
|
||||
stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null));
|
||||
if (into) {
|
||||
transferFluidBetween(itemTank, tileTank, amount);
|
||||
} else {
|
||||
transferFluidBetween(tileTank, itemTank, amount);
|
||||
}
|
||||
tile.getInternalInventory().setStackInSlot(0, itemTank.getContainer());
|
||||
}
|
||||
|
||||
private void transferFluidBetween(IFluidHandler from, IFluidHandler to, int amount) {
|
||||
// simulated pass to figure out the real amount we can transfer
|
||||
FluidStack fluid = from.drain(amount, false);
|
||||
if (fluid == null) {
|
||||
return;
|
||||
}
|
||||
amount = Math.min(amount, to.fill(fluid, false));
|
||||
// actually do the transfer
|
||||
fluid = from.drain(amount, true);
|
||||
if (fluid != null) {
|
||||
fluid.amount -= to.fill(fluid, true);
|
||||
if (fluid.amount > 0) { // just in case the tanks don't behave exactly as simulated
|
||||
from.fill(fluid, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
if (Platform.isServer()) {
|
||||
fluidSync.sendDiff(listeners);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(@Nonnull IContainerListener listener) {
|
||||
super.addListener(listener);
|
||||
fluidSync.sendFull(Collections.singleton(listener));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveFluidSlots(Map<Integer, IAEFluidStack> fluids) {
|
||||
fluidSync.readPacket(fluids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDumpTank(int index) {
|
||||
return tile.getFluidInventory().getFluidInSlot(0) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dumpTank(int index) {
|
||||
tile.getFluidInventory().setFluidInSlot(0, null);
|
||||
}
|
||||
|
||||
}
|
||||
+436
@@ -0,0 +1,436 @@
|
||||
package com.glodblock.github.client.container;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.container.implementations.ContainerExpandedProcessingPatternTerm;
|
||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||
import appeng.container.slot.SlotPatternOutputs;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.item.ItemFluidEncodedPattern;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.common.part.PartExtendedFluidPatternTerminal;
|
||||
import com.glodblock.github.interfaces.PatternConsumer;
|
||||
import com.glodblock.github.loader.FCItems;
|
||||
import com.glodblock.github.util.Ae2Reflect;
|
||||
import com.glodblock.github.util.FluidPatternDetails;
|
||||
import com.glodblock.github.util.Util;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ContainerExtendedFluidPatternTerminal extends ContainerExpandedProcessingPatternTerm implements PatternConsumer {
|
||||
|
||||
private final Slot[] craftingSlots;
|
||||
private final Slot[] outputSlots;
|
||||
private final Slot patternSlotIN;
|
||||
private final Slot patternSlotOUT;
|
||||
public final ITerminalHost part;
|
||||
|
||||
public ContainerExtendedFluidPatternTerminal(InventoryPlayer ip, ITerminalHost monitorable) {
|
||||
super(ip, monitorable);
|
||||
craftingSlots = Ae2Reflect.getExCraftingSlots(this);
|
||||
outputSlots = Ae2Reflect.getExOutputSlots(this);
|
||||
patternSlotIN = Ae2Reflect.getExPatternSlotIn(this);
|
||||
patternSlotOUT = Ae2Reflect.getExPatternSlotOut(this);
|
||||
part = monitorable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode() {
|
||||
if (!checkHasFluidPattern()) {
|
||||
super.encode();
|
||||
return;
|
||||
}
|
||||
ItemStack stack = this.patternSlotOUT.getStack();
|
||||
if (stack.isEmpty()) {
|
||||
stack = this.patternSlotIN.getStack();
|
||||
if (stack.isEmpty() || !isPattern(stack)) {
|
||||
return;
|
||||
}
|
||||
if (stack.getCount() == 1) {
|
||||
this.patternSlotIN.putStack(ItemStack.EMPTY);
|
||||
} else {
|
||||
stack.shrink(1);
|
||||
}
|
||||
encodeFluidPattern();
|
||||
} else if (isPattern(stack)) {
|
||||
encodeFluidPattern();
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isPattern(final ItemStack output) {
|
||||
if (output.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if (output.getItem() instanceof ItemFluidEncodedPattern) {
|
||||
return true;
|
||||
}
|
||||
final IDefinitions defs = AEApi.instance().definitions();
|
||||
return defs.items().encodedPattern().isSameAs(output) || defs.materials().blankPattern().isSameAs(output);
|
||||
}
|
||||
|
||||
private boolean checkHasFluidPattern() {
|
||||
boolean hasFluid = false, search = false;
|
||||
for (Slot craftingSlot : this.craftingSlots) {
|
||||
final ItemStack crafting = craftingSlot.getStack();
|
||||
if (crafting.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
search = true;
|
||||
if (crafting.getItem() instanceof ItemFluidPacket) {
|
||||
hasFluid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!search) { // search=false -> inputs were empty
|
||||
return false;
|
||||
}
|
||||
// `search` should be true at this point
|
||||
for (Slot outputSlot : this.outputSlots) {
|
||||
final ItemStack out = outputSlot.getStack();
|
||||
if (out.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
search = false;
|
||||
if (hasFluid) {
|
||||
break;
|
||||
} else if (out.getItem() instanceof ItemFluidPacket) {
|
||||
hasFluid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return hasFluid && !search; // search=true -> outputs were empty
|
||||
}
|
||||
|
||||
private void encodeFluidPattern() {
|
||||
ItemStack patternStack = new ItemStack(FCItems.DENSE_ENCODED_PATTERN);
|
||||
FluidPatternDetails pattern = new FluidPatternDetails(patternStack);
|
||||
pattern.setInputs(collectInventory(craftingSlots));
|
||||
pattern.setOutputs(collectInventory(outputSlots));
|
||||
patternSlotOUT.putStack(pattern.writeToStack());
|
||||
}
|
||||
|
||||
private static IAEItemStack[] collectInventory(Slot[] slots) {
|
||||
// see note at top of DensePatternDetails
|
||||
List<IAEItemStack> acc = new ArrayList<>();
|
||||
for (Slot slot : slots) {
|
||||
ItemStack stack = slot.getStack();
|
||||
if (stack.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
if (stack.getItem() instanceof ItemFluidPacket) {
|
||||
IAEItemStack dropStack = ItemFluidDrop.newAeStack(ItemFluidPacket.getFluidStack(stack));
|
||||
if (dropStack != null) {
|
||||
acc.add(dropStack);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
IAEItemStack aeStack = AEItemStack.fromItemStack(stack);
|
||||
if (aeStack == null) {
|
||||
continue;
|
||||
}
|
||||
acc.add(aeStack);
|
||||
}
|
||||
return acc.toArray(new IAEItemStack[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAction(EntityPlayerMP player, InventoryAction action, int slotId, long id) {
|
||||
if (slotId < 0 || slotId >= this.inventorySlots.size()) {
|
||||
super.doAction(player, action, slotId, id);
|
||||
return;
|
||||
}
|
||||
Slot slot = getSlot(slotId);
|
||||
ItemStack stack = player.inventory.getItemStack();
|
||||
if ((slot instanceof SlotFakeCraftingMatrix || slot instanceof SlotPatternOutputs) && !stack.isEmpty()
|
||||
&& stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null) && Util.getFluidFromItem(stack) != null) {
|
||||
FluidStack fluid = null;
|
||||
switch (action) {
|
||||
case PICKUP_OR_SET_DOWN:
|
||||
fluid = Util.getFluidFromItem(stack);
|
||||
slot.putStack(ItemFluidPacket.newStack(fluid));
|
||||
break;
|
||||
case SPLIT_OR_PLACE_SINGLE:
|
||||
fluid = Util.getFluidFromItem(ItemHandlerHelper.copyStackWithSize(stack, 1));
|
||||
FluidStack origin = ItemFluidPacket.getFluidStack(slot.getStack());
|
||||
if (fluid != null && fluid.equals(origin)) {
|
||||
fluid.amount += origin.amount;
|
||||
if (fluid.amount <= 0) fluid = null;
|
||||
}
|
||||
slot.putStack(ItemFluidPacket.newStack(fluid));
|
||||
break;
|
||||
}
|
||||
if (fluid == null) {
|
||||
super.doAction(player, action, slotId, id);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (action == InventoryAction.SPLIT_OR_PLACE_SINGLE) {
|
||||
if (stack.isEmpty() && !slot.getStack().isEmpty() && slot.getStack().getItem() instanceof ItemFluidPacket) {
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(slot.getStack());
|
||||
if (fluid != null && fluid.amount - 1000 >= 1) {
|
||||
fluid.amount -= 1000;
|
||||
slot.putStack(ItemFluidPacket.newStack(fluid));
|
||||
}
|
||||
}
|
||||
}
|
||||
super.doAction(player, action, slotId, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void multiply(int multiple) {
|
||||
for (Slot slot : this.craftingSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
||||
if (amt * multiple > Integer.MAX_VALUE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
long amt = slot.getStack().getCount();
|
||||
if (amt * multiple > slot.getStack().getMaxStackSize()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.outputSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
||||
if (amt * multiple > Integer.MAX_VALUE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
long amt = slot.getStack().getCount();
|
||||
if (amt * multiple > slot.getStack().getMaxStackSize()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.craftingSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
||||
fluid.amount *= multiple;
|
||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
||||
slot.putStack(packet);
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
stack.setCount(stack.getCount() * multiple);
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.outputSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
||||
fluid.amount *= multiple;
|
||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
||||
slot.putStack(packet);
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
stack.setCount(stack.getCount() * multiple);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void divide(int divide) {
|
||||
for (Slot slot : this.craftingSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
||||
if (amt % divide != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
long amt = slot.getStack().getCount();
|
||||
if (amt % divide != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.outputSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
||||
if (amt % divide != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
long amt = slot.getStack().getCount();
|
||||
if (amt % divide != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.craftingSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
||||
fluid.amount /= divide;
|
||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
||||
slot.putStack(packet);
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
stack.setCount(stack.getCount() / divide);
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.outputSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
||||
fluid.amount /= divide;
|
||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
||||
slot.putStack(packet);
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
stack.setCount(stack.getCount() / divide);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void increase(int increase) {
|
||||
for (Slot slot : this.craftingSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
||||
if (amt + increase * 1000 > Integer.MAX_VALUE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
long amt = slot.getStack().getCount();
|
||||
if (amt + increase > slot.getStack().getMaxStackSize()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.outputSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
||||
if (amt + increase * 1000 > Integer.MAX_VALUE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
long amt = slot.getStack().getCount();
|
||||
if (amt + increase > slot.getStack().getMaxStackSize()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.craftingSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
||||
fluid.amount += increase * 1000;
|
||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
||||
slot.putStack(packet);
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
stack.setCount(stack.getCount() + increase);
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.outputSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
||||
fluid.amount += increase * 1000;
|
||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
||||
slot.putStack(packet);
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
stack.setCount(stack.getCount() + increase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decrease(int decrease) {
|
||||
for (Slot slot : this.craftingSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
||||
if (amt - decrease * 1000 < 1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
long amt = slot.getStack().getCount();
|
||||
if (amt - decrease < 1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.outputSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
||||
if (amt - decrease * 1000 < 1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
long amt = slot.getStack().getCount();
|
||||
if (amt - decrease < 1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.craftingSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
||||
fluid.amount -= decrease * 1000;
|
||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
||||
slot.putStack(packet);
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
stack.setCount(stack.getCount() - decrease);
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.outputSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
||||
fluid.amount -= decrease * 1000;
|
||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
||||
slot.putStack(packet);
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
stack.setCount(stack.getCount() - decrease);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acceptPattern(IAEItemStack[] inputs, IAEItemStack[] outputs) {
|
||||
if (part instanceof PartExtendedFluidPatternTerminal) {
|
||||
((PartExtendedFluidPatternTerminal) part).onChangeCrafting(inputs, outputs);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.glodblock.github.client.container;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.fluids.container.ContainerFluidIO;
|
||||
import appeng.fluids.parts.PartSharedFluidBus;
|
||||
import com.glodblock.github.common.part.PartFluidExportBus;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class ContainerFluidExportBus extends ContainerFluidIO {
|
||||
|
||||
public ContainerFluidExportBus(InventoryPlayer ip, PartSharedFluidBus te) {
|
||||
super(ip, te);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettingsFromHost(IConfigManager cm) {
|
||||
super.loadSettingsFromHost(cm);
|
||||
if (this.getUpgradeable() instanceof PartFluidExportBus) {
|
||||
this.setCraftingMode((YesNo)cm.getSetting(Settings.CRAFT_ONLY));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
package com.glodblock.github.client.container;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotFake;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.common.tile.TileFluidLevelMaintainer;
|
||||
import com.glodblock.github.network.SPacketSetFluidLevel;
|
||||
import com.glodblock.github.util.Util;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ContainerFluidLevelMaintainer extends AEBaseContainer {
|
||||
|
||||
private final TileFluidLevelMaintainer tile;
|
||||
|
||||
public ContainerFluidLevelMaintainer(InventoryPlayer ip, TileFluidLevelMaintainer tile) {
|
||||
super(ip, tile);
|
||||
this.tile = tile;
|
||||
IItemHandler inv = tile.getInventoryHandler();
|
||||
for (int i = 0; i < 5; i++) {
|
||||
addSlotToContainer(new DisplayFluidSlot(inv, i, 17, 28 + i * 20));
|
||||
}
|
||||
bindPlayerInventory(ip, 0, 141);
|
||||
}
|
||||
|
||||
public TileFluidLevelMaintainer getTile() {
|
||||
return tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAction(EntityPlayerMP player, InventoryAction action, int slotId, long id) {
|
||||
Slot slot = getSlot(slotId);
|
||||
if (slot instanceof DisplayFluidSlot) {
|
||||
final ItemStack stack = player.inventory.getItemStack();
|
||||
FluidStack fluid = Util.getFluidFromItem(stack);
|
||||
FluidCraft.proxy.netHandler.sendTo(new SPacketSetFluidLevel(slotId, fluid == null ? 0 : fluid.amount), player);
|
||||
slot.putStack(stack.isEmpty() ? stack : stack.copy());
|
||||
} else {
|
||||
super.doAction(player, action, slotId, id);
|
||||
}
|
||||
}
|
||||
|
||||
public static class DisplayFluidSlot extends SlotFake {
|
||||
|
||||
final AppEngInternalAEInventory handler;
|
||||
|
||||
public DisplayFluidSlot(IItemHandler inv, int idx, int x, int y) {
|
||||
super(inv, idx, x, y);
|
||||
this.handler = (AppEngInternalAEInventory) inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStack(ItemStack is) {
|
||||
if (is.isEmpty()) {
|
||||
super.putStack(is);
|
||||
return;
|
||||
}
|
||||
if (is.getItem() instanceof ItemFluidPacket) {
|
||||
super.putStack(is);
|
||||
return;
|
||||
}
|
||||
if (is.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) {
|
||||
IFluidTankProperties[] tanks = Objects.requireNonNull(
|
||||
is.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null))
|
||||
.getTankProperties();
|
||||
for (IFluidTankProperties tank : tanks) {
|
||||
ItemStack packet = ItemFluidPacket.newStack(tank.getContents());
|
||||
super.putStack(packet);
|
||||
return;
|
||||
}
|
||||
}
|
||||
super.putStack(ItemStack.EMPTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotStackLimit() {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemStackLimit(@Nonnull ItemStack stack) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+7
-10
@@ -1,19 +1,16 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.PACKET;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.common.tile.TileFluidPacketDecoder;
|
||||
import com.glodblock.github.inventory.slot.FCSlotRestrictedInput;
|
||||
package com.glodblock.github.client.container;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotNormal;
|
||||
import com.glodblock.github.common.tile.TileFluidPacketDecoder;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class ContainerFluidPacketDecoder extends AEBaseContainer {
|
||||
|
||||
public ContainerFluidPacketDecoder(InventoryPlayer ipl, TileFluidPacketDecoder tile) {
|
||||
super(ipl, tile);
|
||||
addSlotToContainer(new FCSlotRestrictedInput(PACKET.stack(), tile.getInventory(), 0, 80, 35, ipl));
|
||||
addSlotToContainer(new SlotNormal(tile.getInventory(), 0, 80, 35));
|
||||
bindPlayerInventory(ipl, 0, 84);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+109
-80
@@ -1,33 +1,36 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.item.ItemFluidEncodedPattern;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.common.tile.TileFluidPatternEncoder;
|
||||
import com.glodblock.github.inventory.AeItemStackHandler;
|
||||
import com.glodblock.github.inventory.AeStackInventory;
|
||||
import com.glodblock.github.inventory.IPatternConsumer;
|
||||
import com.glodblock.github.inventory.slot.SlotFluidConvertingFake;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.FluidPatternDetails;
|
||||
import com.glodblock.github.util.Util;
|
||||
package com.glodblock.github.client.container;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotFake;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.item.ItemFluidEncodedPattern;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.common.tile.TileFluidPatternEncoder;
|
||||
import com.glodblock.github.handler.AeItemStackHandler;
|
||||
import com.glodblock.github.interfaces.AeStackInventory;
|
||||
import com.glodblock.github.interfaces.PatternConsumer;
|
||||
import com.glodblock.github.interfaces.SlotFluid;
|
||||
import com.glodblock.github.loader.FCItems;
|
||||
import com.glodblock.github.util.FluidPatternDetails;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.fluids.capability.IFluidTankProperties;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPatternConsumer {
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ContainerFluidPatternEncoder extends AEBaseContainer implements PatternConsumer {
|
||||
|
||||
private final TileFluidPatternEncoder tile;
|
||||
|
||||
@@ -42,22 +45,10 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPa
|
||||
}
|
||||
addSlotToContainer(new SlotFluidConvertingFake(output, y, 113, 17 + y * 18));
|
||||
}
|
||||
addSlotToContainer(
|
||||
new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.BLANK_PATTERN,
|
||||
tile.getInventory(),
|
||||
0,
|
||||
138,
|
||||
20,
|
||||
ipl));
|
||||
addSlotToContainer(
|
||||
new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN,
|
||||
tile.getInventory(),
|
||||
1,
|
||||
138,
|
||||
50,
|
||||
ipl));
|
||||
addSlotToContainer(new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.BLANK_PATTERN, tile.getInventory(), 0, 138, 20, ipl));
|
||||
addSlotToContainer(new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, tile.getInventory(), 1, 138, 50, ipl));
|
||||
bindPlayerInventory(ipl, 0, 84);
|
||||
}
|
||||
|
||||
@@ -65,17 +56,12 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPa
|
||||
return tile;
|
||||
}
|
||||
|
||||
private static boolean isNotPattern(ItemStack stack) {
|
||||
return stack == null || !(AEApi.instance().definitions().materials().blankPattern().isSameAs(stack)
|
||||
|| (stack.getItem() instanceof ItemFluidEncodedPattern));
|
||||
}
|
||||
|
||||
public boolean canEncodePattern() {
|
||||
if (isNotPattern(tile.getInventory().getStackInSlot(0))
|
||||
&& isNotPattern(tile.getInventory().getStackInSlot(1))) {
|
||||
if (isNotPattern(tile.getInventory().getStackInSlot(0)) && isNotPattern(tile.getInventory().getStackInSlot(1))) {
|
||||
return false;
|
||||
}
|
||||
find_input: {
|
||||
find_input:
|
||||
{
|
||||
for (IAEItemStack stack : tile.getCraftingSlots()) {
|
||||
if (stack != null && stack.getStackSize() > 0) {
|
||||
break find_input;
|
||||
@@ -91,25 +77,27 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPa
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean isNotPattern(ItemStack stack) {
|
||||
return stack.isEmpty() || !(AEApi.instance().definitions().materials().blankPattern().isSameAs(stack)
|
||||
|| (stack.getItem() instanceof ItemFluidEncodedPattern));
|
||||
}
|
||||
|
||||
public void encodePattern() {
|
||||
if (canEncodePattern()) {
|
||||
// if there is an encoded pattern, overwrite it; otherwise, consume a blank
|
||||
if (tile.getInventory().getStackInSlot(1) == null) {
|
||||
tile.getInventory().decrStackSize(0, 1); // this better work
|
||||
if (tile.getInventory().getStackInSlot(1).isEmpty()) {
|
||||
tile.getInventory().extractItem(0, 1, false); // this better work
|
||||
}
|
||||
ItemStack patternStack = new ItemStack(ItemAndBlockHolder.PATTERN);
|
||||
ItemStack patternStack = new ItemStack(FCItems.DENSE_ENCODED_PATTERN);
|
||||
FluidPatternDetails pattern = new FluidPatternDetails(patternStack);
|
||||
pattern.setInputs(collectAeInventory(tile.getCraftingSlots()));
|
||||
pattern.setOutputs(collectAeInventory(tile.getOutputSlots()));
|
||||
tile.getInventory().setInventorySlotContents(1, pattern.writeToStack());
|
||||
tile.getInventory().setStackInSlot(1, pattern.writeToStack());
|
||||
}
|
||||
}
|
||||
|
||||
private static IAEItemStack[] collectAeInventory(AeStackInventory<IAEItemStack> inv) {
|
||||
/*
|
||||
* AE2 API documentation says the input/output arrays can contain nulls, but their use of the API directly
|
||||
* contradicts that, so we just go by behaviour and filter out nulls.
|
||||
*/
|
||||
// see note at top of DensePatternDetails
|
||||
List<IAEItemStack> acc = new ArrayList<>();
|
||||
for (IAEItemStack stack : inv) {
|
||||
if (stack != null) {
|
||||
@@ -133,39 +121,33 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPa
|
||||
if (slot instanceof SlotFluidConvertingFake) {
|
||||
final ItemStack stack = player.inventory.getItemStack();
|
||||
switch (action) {
|
||||
case PICKUP_OR_SET_DOWN -> {
|
||||
if (stack == null) {
|
||||
slot.putStack(null);
|
||||
case PICKUP_OR_SET_DOWN:
|
||||
if (stack.isEmpty()) {
|
||||
slot.putStack(ItemStack.EMPTY);
|
||||
} else {
|
||||
((SlotFluidConvertingFake) slot).putConvertedStack(stack.copy());
|
||||
((SlotFluidConvertingFake)slot).putConvertedStack(stack.copy());
|
||||
}
|
||||
}
|
||||
case PLACE_SINGLE -> {
|
||||
if (stack != null) {
|
||||
((SlotFluidConvertingFake) slot)
|
||||
.putConvertedStack(Objects.requireNonNull(Util.copyStackWithSize(stack, 1)));
|
||||
break;
|
||||
case PLACE_SINGLE:
|
||||
if (!stack.isEmpty()) {
|
||||
((SlotFluidConvertingFake)slot).putConvertedStack(ItemHandlerHelper.copyStackWithSize(stack, 1));
|
||||
}
|
||||
}
|
||||
case SPLIT_OR_PLACE_SINGLE -> {
|
||||
break;
|
||||
case SPLIT_OR_PLACE_SINGLE:
|
||||
ItemStack inSlot = slot.getStack();
|
||||
if (inSlot != null) {
|
||||
if (stack == null) {
|
||||
slot.putStack(Util.copyStackWithSize(inSlot, Math.max(1, inSlot.stackSize - 1)));
|
||||
if (!inSlot.isEmpty()) {
|
||||
if (stack.isEmpty()) {
|
||||
slot.putStack(ItemHandlerHelper.copyStackWithSize(inSlot, Math.max(1, inSlot.getCount() - 1)));
|
||||
} else if (stack.isItemEqual(inSlot)) {
|
||||
slot.putStack(
|
||||
Util.copyStackWithSize(
|
||||
inSlot,
|
||||
Math.min(inSlot.getMaxStackSize(), inSlot.stackSize + 1)));
|
||||
slot.putStack(ItemHandlerHelper.copyStackWithSize(inSlot,
|
||||
Math.min(inSlot.getMaxStackSize(), inSlot.getCount() + 1)));
|
||||
} else {
|
||||
((SlotFluidConvertingFake) slot)
|
||||
.putConvertedStack(Objects.requireNonNull(Util.copyStackWithSize(stack, 1)));
|
||||
((SlotFluidConvertingFake)slot).putConvertedStack(ItemHandlerHelper.copyStackWithSize(stack, 1));
|
||||
}
|
||||
} else if (stack != null) {
|
||||
((SlotFluidConvertingFake) slot)
|
||||
.putConvertedStack(Objects.requireNonNull(Util.copyStackWithSize(stack, 1)));
|
||||
} else if (!stack.isEmpty()) {
|
||||
((SlotFluidConvertingFake)slot).putConvertedStack(ItemHandlerHelper.copyStackWithSize(stack, 1));
|
||||
}
|
||||
}
|
||||
default -> {}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
super.doAction(player, action, slotId, id);
|
||||
@@ -184,4 +166,51 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPa
|
||||
dest.setStack(i, src[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private static class SlotFluidConvertingFake extends SlotFake implements SlotFluid {
|
||||
|
||||
private final AeStackInventory<IAEItemStack> inv;
|
||||
|
||||
public SlotFluidConvertingFake(AeItemStackHandler inv, int idx, int x, int y) {
|
||||
super(inv, idx, x, y);
|
||||
this.inv = inv.getAeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStack(ItemStack stack) {
|
||||
inv.setStack(getSlotIndex(), AEItemStack.fromItemStack(stack));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAeStack(@Nullable IAEItemStack stack, boolean sync) {
|
||||
inv.setStack(getSlotIndex(), stack);
|
||||
}
|
||||
|
||||
public void putConvertedStack(ItemStack stack) {
|
||||
if (stack.isEmpty()) {
|
||||
setAeStack(null, false);
|
||||
return;
|
||||
} else if (stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null)) {
|
||||
IFluidTankProperties[] tanks = Objects.requireNonNull(
|
||||
stack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null))
|
||||
.getTankProperties();
|
||||
for (IFluidTankProperties tank : tanks) {
|
||||
IAEItemStack aeStack = ItemFluidPacket.newAeStack(tank.getContents());
|
||||
if (aeStack != null) {
|
||||
setAeStack(aeStack, false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
putStack(stack);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IAEItemStack getAeStack() {
|
||||
return inv.getStack(getSlotIndex());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
+441
@@ -0,0 +1,441 @@
|
||||
package com.glodblock.github.client.container;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.container.implementations.ContainerPatternTerm;
|
||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||
import appeng.container.slot.SlotPatternOutputs;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.item.ItemFluidEncodedPattern;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.common.part.PartFluidPatternTerminal;
|
||||
import com.glodblock.github.interfaces.PatternConsumer;
|
||||
import com.glodblock.github.loader.FCItems;
|
||||
import com.glodblock.github.util.Ae2Reflect;
|
||||
import com.glodblock.github.util.FluidPatternDetails;
|
||||
import com.glodblock.github.util.Util;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class ContainerFluidPatternTerminal extends ContainerPatternTerm implements PatternConsumer {
|
||||
|
||||
private final Slot[] craftingSlots;
|
||||
private final Slot[] outputSlots;
|
||||
private final Slot patternSlotIN;
|
||||
private final Slot patternSlotOUT;
|
||||
|
||||
public ContainerFluidPatternTerminal(InventoryPlayer ip, ITerminalHost monitorable) {
|
||||
super(ip, monitorable);
|
||||
craftingSlots = Ae2Reflect.getCraftingSlots(this);
|
||||
outputSlots = Ae2Reflect.getOutputSlots(this);
|
||||
patternSlotIN = Ae2Reflect.getPatternSlotIn(this);
|
||||
patternSlotOUT = Ae2Reflect.getPatternSlotOut(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode() {
|
||||
if (!checkHasFluidPattern()) {
|
||||
super.encode();
|
||||
return;
|
||||
}
|
||||
ItemStack stack = this.patternSlotOUT.getStack();
|
||||
if (stack.isEmpty()) {
|
||||
stack = this.patternSlotIN.getStack();
|
||||
if (stack.isEmpty() || !isPattern(stack)) {
|
||||
return;
|
||||
}
|
||||
if (stack.getCount() == 1) {
|
||||
this.patternSlotIN.putStack(ItemStack.EMPTY);
|
||||
} else {
|
||||
stack.shrink(1);
|
||||
}
|
||||
encodeFluidPattern();
|
||||
} else if (isPattern(stack)) {
|
||||
encodeFluidPattern();
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isPattern(final ItemStack output) {
|
||||
if (output.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
if (output.getItem() instanceof ItemFluidEncodedPattern) {
|
||||
return true;
|
||||
}
|
||||
final IDefinitions defs = AEApi.instance().definitions();
|
||||
return defs.items().encodedPattern().isSameAs(output) || defs.materials().blankPattern().isSameAs(output);
|
||||
}
|
||||
|
||||
private boolean checkHasFluidPattern() {
|
||||
if (this.craftingMode) {
|
||||
return false;
|
||||
}
|
||||
boolean hasFluid = false, search = false;
|
||||
for (Slot craftingSlot : this.craftingSlots) {
|
||||
final ItemStack crafting = craftingSlot.getStack();
|
||||
if (crafting.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
search = true;
|
||||
if (crafting.getItem() instanceof ItemFluidPacket) {
|
||||
hasFluid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!search) { // search=false -> inputs were empty
|
||||
return false;
|
||||
}
|
||||
// `search` should be true at this point
|
||||
for (Slot outputSlot : this.outputSlots) {
|
||||
final ItemStack out = outputSlot.getStack();
|
||||
if (out.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
search = false;
|
||||
if (hasFluid) {
|
||||
break;
|
||||
} else if (out.getItem() instanceof ItemFluidPacket) {
|
||||
hasFluid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return hasFluid && !search; // search=true -> outputs were empty
|
||||
}
|
||||
|
||||
private void encodeFluidPattern() {
|
||||
ItemStack patternStack = new ItemStack(FCItems.DENSE_ENCODED_PATTERN);
|
||||
FluidPatternDetails pattern = new FluidPatternDetails(patternStack);
|
||||
pattern.setInputs(collectInventory(craftingSlots));
|
||||
pattern.setOutputs(collectInventory(outputSlots));
|
||||
patternSlotOUT.putStack(pattern.writeToStack());
|
||||
}
|
||||
|
||||
private static IAEItemStack[] collectInventory(Slot[] slots) {
|
||||
// see note at top of DensePatternDetails
|
||||
List<IAEItemStack> acc = new ArrayList<>();
|
||||
for (Slot slot : slots) {
|
||||
ItemStack stack = slot.getStack();
|
||||
if (stack.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
if (stack.getItem() instanceof ItemFluidPacket) {
|
||||
IAEItemStack dropStack = ItemFluidDrop.newAeStack(ItemFluidPacket.getFluidStack(stack));
|
||||
if (dropStack != null) {
|
||||
acc.add(dropStack);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
IAEItemStack aeStack = AEItemStack.fromItemStack(stack);
|
||||
if (aeStack == null) {
|
||||
continue;
|
||||
}
|
||||
acc.add(aeStack);
|
||||
}
|
||||
return acc.toArray(new IAEItemStack[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acceptPattern(IAEItemStack[] inputs, IAEItemStack[] outputs) {
|
||||
if (getPatternTerminal() instanceof PartFluidPatternTerminal) {
|
||||
((PartFluidPatternTerminal)getPatternTerminal()).onChangeCrafting(inputs, outputs);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAction(EntityPlayerMP player, InventoryAction action, int slotId, long id) {
|
||||
if (this.isCraftingMode()) {
|
||||
super.doAction(player, action, slotId, id);
|
||||
return;
|
||||
}
|
||||
if (slotId < 0 || slotId >= this.inventorySlots.size()) {
|
||||
super.doAction(player, action, slotId, id);
|
||||
return;
|
||||
}
|
||||
Slot slot = getSlot(slotId);
|
||||
ItemStack stack = player.inventory.getItemStack();
|
||||
if ((slot instanceof SlotFakeCraftingMatrix || slot instanceof SlotPatternOutputs) && !stack.isEmpty()
|
||||
&& stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY, null) && Util.getFluidFromItem(stack) != null) {
|
||||
FluidStack fluid = null;
|
||||
switch (action) {
|
||||
case PICKUP_OR_SET_DOWN:
|
||||
fluid = Util.getFluidFromItem(stack);
|
||||
slot.putStack(ItemFluidPacket.newStack(fluid));
|
||||
break;
|
||||
case SPLIT_OR_PLACE_SINGLE:
|
||||
fluid = Util.getFluidFromItem(ItemHandlerHelper.copyStackWithSize(stack, 1));
|
||||
FluidStack origin = ItemFluidPacket.getFluidStack(slot.getStack());
|
||||
if (fluid != null && fluid.equals(origin)) {
|
||||
fluid.amount += origin.amount;
|
||||
if (fluid.amount <= 0) fluid = null;
|
||||
}
|
||||
slot.putStack(ItemFluidPacket.newStack(fluid));
|
||||
break;
|
||||
}
|
||||
if (fluid == null) {
|
||||
super.doAction(player, action, slotId, id);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (action == InventoryAction.SPLIT_OR_PLACE_SINGLE) {
|
||||
if (stack.isEmpty() && !slot.getStack().isEmpty() && slot.getStack().getItem() instanceof ItemFluidPacket) {
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(slot.getStack());
|
||||
if (fluid != null && fluid.amount - 1000 >= 1) {
|
||||
fluid.amount -= 1000;
|
||||
slot.putStack(ItemFluidPacket.newStack(fluid));
|
||||
}
|
||||
}
|
||||
}
|
||||
super.doAction(player, action, slotId, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void multiply(int multiple) {
|
||||
for (Slot slot : this.craftingSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
||||
if (amt * multiple > Integer.MAX_VALUE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
long amt = slot.getStack().getCount();
|
||||
if (amt * multiple > slot.getStack().getMaxStackSize()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.outputSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
||||
if (amt * multiple > Integer.MAX_VALUE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
long amt = slot.getStack().getCount();
|
||||
if (amt * multiple > slot.getStack().getMaxStackSize()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.craftingSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
||||
fluid.amount *= multiple;
|
||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
||||
slot.putStack(packet);
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
stack.setCount(stack.getCount() * multiple);
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.outputSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
||||
fluid.amount *= multiple;
|
||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
||||
slot.putStack(packet);
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
stack.setCount(stack.getCount() * multiple);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void divide(int divide) {
|
||||
for (Slot slot : this.craftingSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
||||
if (amt % divide != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
long amt = slot.getStack().getCount();
|
||||
if (amt % divide != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.outputSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
||||
if (amt % divide != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
long amt = slot.getStack().getCount();
|
||||
if (amt % divide != 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.craftingSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
||||
fluid.amount /= divide;
|
||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
||||
slot.putStack(packet);
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
stack.setCount(stack.getCount() / divide);
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.outputSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
||||
fluid.amount /= divide;
|
||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
||||
slot.putStack(packet);
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
stack.setCount(stack.getCount() / divide);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void increase(int increase) {
|
||||
for (Slot slot : this.craftingSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
||||
if (amt + increase * 1000 > Integer.MAX_VALUE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
long amt = slot.getStack().getCount();
|
||||
if (amt + increase > slot.getStack().getMaxStackSize()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.outputSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
||||
if (amt + increase * 1000 > Integer.MAX_VALUE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
long amt = slot.getStack().getCount();
|
||||
if (amt + increase > slot.getStack().getMaxStackSize()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.craftingSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
||||
fluid.amount += increase * 1000;
|
||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
||||
slot.putStack(packet);
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
stack.setCount(stack.getCount() + increase);
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.outputSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
||||
fluid.amount += increase * 1000;
|
||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
||||
slot.putStack(packet);
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
stack.setCount(stack.getCount() + increase);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void decrease(int decrease) {
|
||||
for (Slot slot : this.craftingSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
||||
if (amt - decrease * 1000 < 1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
long amt = slot.getStack().getCount();
|
||||
if (amt - decrease < 1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.outputSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
long amt = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack())).amount;
|
||||
if (amt - decrease * 1000 < 1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
long amt = slot.getStack().getCount();
|
||||
if (amt - decrease < 1) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.craftingSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
||||
fluid.amount -= decrease * 1000;
|
||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
||||
slot.putStack(packet);
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
stack.setCount(stack.getCount() - decrease);
|
||||
}
|
||||
}
|
||||
|
||||
for (Slot slot : this.outputSlots) {
|
||||
if (ItemFluidPacket.isFluidPacket(slot.getStack()) && ItemFluidPacket.getFluidStack(slot.getStack()) != null) {
|
||||
FluidStack fluid = Objects.requireNonNull(ItemFluidPacket.getFluidStack(slot.getStack()));
|
||||
fluid.amount -= decrease * 1000;
|
||||
ItemStack packet = ItemFluidPacket.newStack(fluid);
|
||||
slot.putStack(packet);
|
||||
}
|
||||
else if (!slot.getStack().isEmpty()) {
|
||||
ItemStack stack = slot.getStack();
|
||||
stack.setCount(stack.getCount() - decrease);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.glodblock.github.client.container;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotNormal;
|
||||
import com.glodblock.github.common.tile.TileIngredientBuffer;
|
||||
import com.glodblock.github.interfaces.TankDumpable;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
public class ContainerIngredientBuffer extends AEBaseContainer implements TankDumpable {
|
||||
|
||||
private final TileIngredientBuffer tile;
|
||||
|
||||
public ContainerIngredientBuffer(InventoryPlayer ipl, TileIngredientBuffer tile) {
|
||||
super(ipl, tile);
|
||||
this.tile = tile;
|
||||
IItemHandler inv = tile.getInternalInventory();
|
||||
for (int i = 0; i < 9; i++) {
|
||||
addSlotToContainer(new SlotNormal(inv, i, 8 + 18 * i, 108));
|
||||
}
|
||||
bindPlayerInventory(ipl, 0, 140);
|
||||
}
|
||||
|
||||
public TileIngredientBuffer getTile() {
|
||||
return tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDumpTank(int index) {
|
||||
return tile.getFluidInventory().getFluidInSlot(index) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dumpTank(int index) {
|
||||
if (index >= 0 && index < tile.getFluidInventory().getSlots()) {
|
||||
tile.getFluidInventory().setFluidInSlot(index, null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
|
||||
public class FCGuiLineField extends FCGuiTextField {
|
||||
|
||||
private final int _xPos;
|
||||
private final int _yPos;
|
||||
|
||||
public FCGuiLineField(FontRenderer fontRenderer, int xPos, int yPos, int width) {
|
||||
this(fontRenderer, xPos, yPos, width, 5);
|
||||
}
|
||||
|
||||
public FCGuiLineField(FontRenderer fontRenderer, int xPos, int yPos, int width, int height) {
|
||||
super(fontRenderer, xPos, yPos, width, height);
|
||||
this._xPos = xPos;
|
||||
this._yPos = yPos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTextBox() {
|
||||
if (this.getVisible()) {
|
||||
drawRect(this._xPos, this._yPos, this.xPosition + this.width, this.yPosition + this.height, getColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,171 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.ITooltip;
|
||||
|
||||
public class FCGuiTextField extends GuiTextField {
|
||||
|
||||
private static final int PADDING = 2;
|
||||
private final FontRenderer _fontRender;
|
||||
private String tooltip;
|
||||
|
||||
private final int _xPos;
|
||||
private final int _yPos;
|
||||
private final int _width;
|
||||
private final int _height;
|
||||
private int _border;
|
||||
private int _color;
|
||||
|
||||
/**
|
||||
* Uses the values to instantiate a padded version of a text field. Pays attention to the '_' caret.
|
||||
*
|
||||
* @param fontRenderer renderer for the strings
|
||||
* @param xPos absolute left position
|
||||
* @param yPos absolute top position
|
||||
* @param width absolute width
|
||||
* @param height absolute height
|
||||
*/
|
||||
public FCGuiTextField(final FontRenderer fontRenderer, final int xPos, final int yPos, final int width,
|
||||
final int height) {
|
||||
super(
|
||||
fontRenderer,
|
||||
xPos + PADDING,
|
||||
yPos + PADDING,
|
||||
width - 2 * PADDING - fontRenderer.getCharWidth('_'),
|
||||
height - 2 * PADDING);
|
||||
|
||||
this._xPos = xPos;
|
||||
this._yPos = yPos;
|
||||
this._width = width;
|
||||
this._height = height;
|
||||
this._fontRender = fontRenderer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawTextBox() {
|
||||
super.drawTextBox();
|
||||
if (this.getBorder() > 0 && this.getVisible()) {
|
||||
drawRect(
|
||||
this._xPos - getBorder(),
|
||||
this._yPos - getBorder(),
|
||||
this.xPosition + this.width + getBorder(),
|
||||
this.yPosition + this.height + getBorder(),
|
||||
this.getColor());
|
||||
}
|
||||
}
|
||||
|
||||
public void handleTooltip(int mouseX, int mouseY, AEBaseGui gui) {
|
||||
this.handleTooltip(mouseX, mouseY, gui, 0);
|
||||
}
|
||||
|
||||
public void handleTooltip(int mouseX, int mouseY, AEBaseGui gui, int offsetY) {
|
||||
if (isMouseIn(mouseX, mouseY) && this.tooltip != null && !"".equals(this.tooltip)) {
|
||||
int length = 0;
|
||||
for (String s : this.getMessage().split("\n")) {
|
||||
length = Math.max(this._fontRender.getStringWidth(s), length);
|
||||
}
|
||||
if (mouseY < 15) {
|
||||
mouseY = 15;
|
||||
}
|
||||
if (mouseX + length + 20 >= gui.width) {
|
||||
gui.drawTooltip(mouseX - length - 20, mouseY + 4 + offsetY, this.getMessage());
|
||||
} else {
|
||||
gui.drawTooltip(mouseX, mouseY + 4 + offsetY, this.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getBorder() {
|
||||
return this._border;
|
||||
}
|
||||
|
||||
public void setBorder(int border) {
|
||||
this._border = border;
|
||||
this._color = 0;
|
||||
}
|
||||
|
||||
public void setBorder(int border, int color) {
|
||||
this._border = border;
|
||||
this._color = color;
|
||||
}
|
||||
|
||||
public void setBorder() {
|
||||
this._border = 0;
|
||||
this._color = 0;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return this._color;
|
||||
}
|
||||
|
||||
public void setColor(int color) {
|
||||
this._color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(final int xPos, final int yPos, final int button) {
|
||||
super.mouseClicked(xPos, yPos, button);
|
||||
|
||||
final boolean requiresFocus = this.isMouseIn(xPos, yPos);
|
||||
|
||||
this.setFocused(requiresFocus);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the mouse is within the element
|
||||
*
|
||||
* @param xCoord current x coord of the mouse
|
||||
* @param yCoord current y coord of the mouse
|
||||
* @return true if mouse position is within the text field area
|
||||
*/
|
||||
public boolean isMouseIn(final int xCoord, final int yCoord) {
|
||||
final boolean withinXRange = this._xPos <= xCoord && xCoord < this._xPos + this._width;
|
||||
final boolean withinYRange = this._yPos <= yCoord && yCoord < this._yPos + this._height;
|
||||
|
||||
return withinXRange && withinYRange;
|
||||
}
|
||||
|
||||
public void setMessage(String t) {
|
||||
tooltip = t;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return tooltip;
|
||||
}
|
||||
|
||||
public class TooltipProvider implements ITooltip {
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return tooltip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int xPos() {
|
||||
return _xPos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int yPos() {
|
||||
return _yPos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return _height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return _width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return getVisible();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
|
||||
import com.glodblock.github.common.parts.PartFluidTerminal;
|
||||
import com.glodblock.github.common.parts.PartLevelTerminal;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.inventory.item.WirelessFluidTerminalInventory;
|
||||
import com.glodblock.github.inventory.item.WirelessInterfaceTerminalInventory;
|
||||
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
|
||||
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.network.CPacketInventoryAction;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.helpers.InventoryAction;
|
||||
|
||||
public class GuiCraftingStatus extends appeng.client.gui.implementations.GuiCraftingStatus {
|
||||
|
||||
private GuiTabButton originalGuiBtn;
|
||||
private final ITerminalHost host;
|
||||
|
||||
public GuiCraftingStatus(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||
super(inventoryPlayer, te);
|
||||
host = te;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
if (host instanceof PartFluidPatternTerminal)
|
||||
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.FLUID_TERMINAL.stack());
|
||||
else if (host instanceof PartFluidPatternTerminalEx)
|
||||
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.FLUID_TERMINAL_EX.stack());
|
||||
else if (host instanceof PartFluidTerminal)
|
||||
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.FLUID_TERM.stack());
|
||||
else if (host instanceof PartLevelTerminal)
|
||||
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.LEVEL_TERMINAL.stack());
|
||||
else if (host instanceof IWirelessTerminal terminal && terminal.isUniversal(host))
|
||||
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack());
|
||||
else if (host instanceof WirelessFluidTerminalInventory)
|
||||
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.WIRELESS_FLUID_TERM.stack());
|
||||
else if (host instanceof WirelessPatternTerminalInventory)
|
||||
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.WIRELESS_PATTERN_TERM.stack());
|
||||
else if (host instanceof WirelessInterfaceTerminalInventory)
|
||||
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.WIRELESS_INTERFACE_TERM.stack());
|
||||
else if (host instanceof WirelessLevelTerminalInventory)
|
||||
Ae2ReflectClient.rewriteIcon(this, ItemAndBlockHolder.WIRELESS_LEVEL_TERM.stack());
|
||||
super.initGui();
|
||||
originalGuiBtn = Ae2ReflectClient.getOriginalGuiButton(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (btn == originalGuiBtn) {
|
||||
if (host instanceof PartFluidPatternTerminal) InventoryHandler.switchGui(GuiType.FLUID_PATTERN_TERMINAL);
|
||||
else if (host instanceof PartFluidPatternTerminalEx)
|
||||
InventoryHandler.switchGui(GuiType.FLUID_PATTERN_TERMINAL_EX);
|
||||
else if (host instanceof PartFluidTerminal) InventoryHandler.switchGui(GuiType.FLUID_TERMINAL);
|
||||
else if (host instanceof PartLevelTerminal) InventoryHandler.switchGui(GuiType.LEVEL_TERMINAL);
|
||||
else if (host instanceof IWirelessTerminal terminal && terminal.isUniversal(host))
|
||||
InventoryHandler.switchGui(ItemWirelessUltraTerminal.readMode(terminal.getItemStack()));
|
||||
else if (host instanceof WirelessFluidTerminalInventory)
|
||||
InventoryHandler.switchGui(GuiType.WIRELESS_FLUID_TERMINAL);
|
||||
else if (host instanceof WirelessPatternTerminalInventory)
|
||||
InventoryHandler.switchGui(GuiType.WIRELESS_FLUID_PATTERN_TERMINAL);
|
||||
else if (host instanceof WirelessInterfaceTerminalInventory)
|
||||
InventoryHandler.switchGui(GuiType.WIRELESS_INTERFACE_TERMINAL);
|
||||
else if (host instanceof WirelessLevelTerminalInventory)
|
||||
InventoryHandler.switchGui(GuiType.WIRELESS_LEVEL_TERMINAL);
|
||||
} else {
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
|
||||
IAEItemStack hoveredAEStack = getHoveredAEStack();
|
||||
if (hoveredAEStack != null && btn == 2) {
|
||||
((AEBaseContainer) inventorySlots).setTargetStack(hoveredAEStack);
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketInventoryAction(
|
||||
InventoryAction.AUTO_CRAFT,
|
||||
Ae2ReflectClient.getInventorySlots(this).size(),
|
||||
0,
|
||||
hoveredAEStack));
|
||||
return;
|
||||
}
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
}
|
||||
@@ -1,260 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import com.glodblock.github.client.gui.container.ContainerDualInterface;
|
||||
import com.glodblock.github.common.parts.PartFluidInterface;
|
||||
import com.glodblock.github.common.tile.TileFluidInterface;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.config.AdvancedBlockingMode;
|
||||
import appeng.api.config.InsertionMode;
|
||||
import appeng.api.config.LockCraftingMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SidelessMode;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.client.gui.implementations.GuiUpgradeable;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiSimpleImgButton;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.client.gui.widgets.GuiToggleButton;
|
||||
import appeng.container.implementations.ContainerInterface;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketConfigButton;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.helpers.IInterfaceHost;
|
||||
|
||||
public class GuiDualInterface extends GuiUpgradeable {
|
||||
|
||||
private GuiTabButton priority;
|
||||
private GuiTabButton switcher;
|
||||
private GuiImgButton BlockMode;
|
||||
private 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) {
|
||||
super(new ContainerDualInterface(inventoryPlayer, te));
|
||||
this.host = te;
|
||||
this.ySize = 211;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addButtons() {
|
||||
this.priority = new GuiTabButton(
|
||||
this.guiLeft + 154,
|
||||
this.guiTop,
|
||||
2 + 4 * 16,
|
||||
GuiText.Priority.getLocal(),
|
||||
itemRender);
|
||||
this.buttonList.add(this.priority);
|
||||
|
||||
this.switcher = new GuiTabButton(
|
||||
this.guiLeft + 132,
|
||||
this.guiTop,
|
||||
host instanceof PartFluidInterface ? ItemAndBlockHolder.FLUID_INTERFACE.stack()
|
||||
: ItemAndBlockHolder.INTERFACE.stack(),
|
||||
StatCollector.translateToLocal("ae2fc.tooltip.switch_fluid_interface"),
|
||||
itemRender);
|
||||
this.buttonList.add(this.switcher);
|
||||
|
||||
int offset = 8;
|
||||
|
||||
this.BlockMode = new GuiImgButton(this.guiLeft - 18, this.guiTop + offset, Settings.BLOCK, YesNo.NO);
|
||||
this.buttonList.add(this.BlockMode);
|
||||
|
||||
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 + offset,
|
||||
84,
|
||||
85,
|
||||
GuiText.InterfaceTerminal.getLocal(),
|
||||
GuiText.InterfaceTerminalHint.getLocal());
|
||||
this.buttonList.add(this.interfaceMode);
|
||||
|
||||
offset += 18;
|
||||
|
||||
this.insertionMode = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.guiTop + offset,
|
||||
Settings.INSERTION_MODE,
|
||||
InsertionMode.DEFAULT);
|
||||
this.buttonList.add(this.insertionMode);
|
||||
|
||||
offset += 18;
|
||||
|
||||
this.doublePatterns = new GuiSimpleImgButton(this.guiLeft - 18, this.guiTop + offset, 71, "");
|
||||
this.doublePatterns.enabled = false;
|
||||
this.buttonList.add(this.doublePatterns);
|
||||
|
||||
offset += 18;
|
||||
|
||||
this.patternOptimization = new GuiToggleButton(
|
||||
this.guiLeft - 18,
|
||||
this.guiTop + offset,
|
||||
178,
|
||||
194,
|
||||
GuiText.PatternOptimization.getLocal(),
|
||||
GuiText.PatternOptimizationHint.getLocal());
|
||||
this.buttonList.add(this.patternOptimization);
|
||||
|
||||
offset += 18;
|
||||
|
||||
this.advancedBlockingMode = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.guiTop + offset,
|
||||
Settings.ADVANCED_BLOCKING_MODE,
|
||||
AdvancedBlockingMode.DEFAULT);
|
||||
this.buttonList.add(this.advancedBlockingMode);
|
||||
this.advancedBlockingMode.visible = this.bc.getInstalledUpgrades(Upgrades.ADVANCED_BLOCKING) > 0;
|
||||
|
||||
offset += 18;
|
||||
|
||||
if (isTile()) {
|
||||
this.sidelessMode = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.guiTop + offset,
|
||||
Settings.SIDELESS_MODE,
|
||||
SidelessMode.SIDELESS);
|
||||
this.buttonList.add(this.sidelessMode);
|
||||
|
||||
offset += 18;
|
||||
}
|
||||
|
||||
this.lockCraftingMode = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.guiTop + offset,
|
||||
Settings.LOCK_CRAFTING_MODE,
|
||||
LockCraftingMode.NONE);
|
||||
this.lockCraftingMode.visible = this.bc.getInstalledUpgrades(Upgrades.LOCK_CRAFTING) > 0;
|
||||
this.buttonList.add(lockCraftingMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
if (this.BlockMode != null) {
|
||||
this.BlockMode.set(((ContainerInterface) this.cvb).getBlockingMode());
|
||||
}
|
||||
if (this.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,
|
||||
6,
|
||||
4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBackground() {
|
||||
if (!ModAndClassUtil.isBigInterface) return "guis/interface.png";
|
||||
return switch (((ContainerInterface) this.cvb).getPatternCapacityCardsInstalled()) {
|
||||
case -1 -> "guis/interfacenone.png";
|
||||
case 1 -> "guis/interface2.png";
|
||||
case 2 -> "guis/interface3.png";
|
||||
case 3 -> "guis/interface4.png";
|
||||
default -> "guis/interface.png";
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
final boolean backwards = Mouse.isButtonDown(1);
|
||||
if (btn == this.priority) {
|
||||
InventoryHandler.switchGui(GuiType.PRIORITY);
|
||||
} else if (btn == this.switcher) {
|
||||
InventoryHandler.switchGui(GuiType.DUAL_INTERFACE_FLUID);
|
||||
} else if (btn == this.interfaceMode) {
|
||||
NetworkHandler.instance.sendToServer(new PacketConfigButton(Settings.INTERFACE_TERMINAL, backwards));
|
||||
} else if (btn == this.BlockMode) {
|
||||
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.BlockMode.getSetting(), backwards));
|
||||
} else if (btn == this.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 isTile() {
|
||||
return this.host instanceof TileFluidInterface;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleButtonVisibility() {
|
||||
super.handleButtonVisibility();
|
||||
if (this.advancedBlockingMode != null) {
|
||||
this.advancedBlockingMode.setVisibility(this.bc.getInstalledUpgrades(Upgrades.ADVANCED_BLOCKING) > 0);
|
||||
}
|
||||
if (this.lockCraftingMode != null) {
|
||||
this.lockCraftingMode.setVisibility(this.bc.getInstalledUpgrades(Upgrades.LOCK_CRAFTING) > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerEssentiaMonitor;
|
||||
import com.glodblock.github.client.me.EssentiaRepo;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.crossmod.thaumcraft.AspectRender;
|
||||
import com.glodblock.github.crossmod.thaumcraft.AspectUtil;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.network.CPacketFluidUpdate;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.me.SlotME;
|
||||
|
||||
public class GuiEssentiaTerminal extends GuiFluidMonitor {
|
||||
|
||||
protected EntityPlayer player;
|
||||
|
||||
public GuiEssentiaTerminal(InventoryPlayer inventoryPlayer, IWirelessTerminal te) {
|
||||
super(inventoryPlayer, te, new ContainerEssentiaMonitor(inventoryPlayer, te));
|
||||
this.repo = new EssentiaRepo(getScrollBar(), this);
|
||||
this.player = inventoryPlayer.player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTextFieldValue(String displayName, int mousex, int mousey, ItemStack stack) {
|
||||
if (AspectUtil.getAspectFromJar(stack) != null) {
|
||||
setSearchString(Objects.requireNonNull(AspectUtil.getAspectFromJar(stack)).getName(), true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_146977_a(final Slot s) {
|
||||
if (drawSlot0(s)) super.func_146977_a(s);
|
||||
}
|
||||
|
||||
public boolean drawSlot0(Slot slot) {
|
||||
if (slot instanceof SlotME) {
|
||||
IAEItemStack stack = ((SlotME) slot).getAEStack();
|
||||
if (stack == null) return true;
|
||||
FluidStack fluidStack = ItemFluidDrop.getFluidStack(slot.getStack());
|
||||
AspectRender.drawAspect(
|
||||
this.player,
|
||||
slot.xDisplayPosition,
|
||||
slot.yDisplayPosition,
|
||||
this.zLevel,
|
||||
AspectUtil.getAspectFromGas(fluidStack),
|
||||
fluidStack.amount);
|
||||
IAEItemStack gas = stack.copy().setStackSize(stack.getStackSize() / AspectUtil.R);
|
||||
aeRenderItem.setAeStack(gas);
|
||||
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
|
||||
aeRenderItem.renderItemOverlayIntoGUI(
|
||||
fontRendererObj,
|
||||
mc.getTextureManager(),
|
||||
gas.getItemStack(),
|
||||
slot.xDisplayPosition,
|
||||
slot.yDisplayPosition);
|
||||
GL11.glTranslatef(0.0f, 0.0f, -200.0f);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
|
||||
if (slot instanceof SlotME && AspectUtil.isEssentiaContainer(player.inventory.getItemStack())) {
|
||||
IAEFluidStack fluid = ItemFluidDrop.getAeFluidStack(((SlotME) slot).getAEStack());
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(fluid, isShiftKeyDown()));
|
||||
}
|
||||
if (mouseButton == 3 && slot instanceof SlotME) {
|
||||
return;
|
||||
}
|
||||
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (btn == craftingStatusBtn) {
|
||||
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
|
||||
} else {
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
}
|
||||
|
||||
public void update(ItemStack itemStack) {
|
||||
this.player.inventory.setItemStack(itemStack);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,334 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.client.gui.widgets.ITooltip;
|
||||
|
||||
public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
|
||||
private static final Pattern COMPILE = Pattern.compile("%s");
|
||||
private static final Pattern PATTERN_NEW_LINE = Pattern.compile("\\n", Pattern.LITERAL);
|
||||
private static Map<EnumPair, ButtonAppearance> appearances;
|
||||
private final String buttonSetting;
|
||||
private boolean halfSize = false;
|
||||
private String fillVar;
|
||||
private String currentValue;
|
||||
private final boolean background;
|
||||
private static final String prefix = NameConst.TT_KEY;
|
||||
|
||||
public GuiFCImgButton(final int x, final int y, final String idx, final String val) {
|
||||
this(x, y, idx, val, true);
|
||||
}
|
||||
|
||||
public GuiFCImgButton(final int x, final int y, final String idx, final String val, boolean background) {
|
||||
super(0, 0, 16, "");
|
||||
this.background = background;
|
||||
this.buttonSetting = idx;
|
||||
this.currentValue = val;
|
||||
this.xPosition = x;
|
||||
this.yPosition = y;
|
||||
this.width = 16;
|
||||
this.height = 16;
|
||||
|
||||
if (appearances == null) {
|
||||
appearances = new HashMap<>();
|
||||
this.registerApp(0, "NOT_COMBINE", "DONT_COMBINE", "not_combine");
|
||||
this.registerApp(1, "FORCE_COMBINE", "DO_COMBINE", "combine");
|
||||
this.registerApp(2, "FORCE_PRIO", "DO_PRIO", "prio");
|
||||
this.registerApp(3, "NOT_PRIO", "DONT_PRIO", "not_prio");
|
||||
this.registerApp(4, "SUBMIT", "SUBMIT", "submit");
|
||||
this.registerApp(5, "EDIT", "YES", "edit");
|
||||
this.registerApp(6, "DISABLE", "DISABLE", "disable");
|
||||
this.registerApp(7, "ENABLE", "ENABLE", "enable");
|
||||
this.registerApp(10, "FLUID_TEM", "YES", "fluid_terminal_w");
|
||||
this.registerApp(11, "CRAFT_TEM", "YES", "craft_terminal_w");
|
||||
this.registerApp(12, "PATTERN_TEM", "YES", "pattern_terminal_w");
|
||||
this.registerApp(13, "ESSENTIA_TEM", "YES", "essentia_terminal_w");
|
||||
this.registerApp(14, "INTERFACE_TEM", "YES", "interface_terminal_w");
|
||||
this.registerApp(15, "PATTERN_EX_TEM", "YES", "pattern_terminal_ex_w");
|
||||
this.registerApp(16, "FILL_PATTERN", "DO_FILL", "fill_pattern");
|
||||
this.registerApp(17, "NOT_FILL_PATTERN", "DONT_FILL", "not_fill_pattern");
|
||||
this.registerApp(20, "LEVEL_TEM", "YES", "level_terminal_w");
|
||||
this.registerApp(21, "SWITCH", "ON", "edit");
|
||||
this.registerApp(22, "SWITCH", "OFF", "view");
|
||||
this.registerApp(21, "SWITCH", "ENABLE", "enable");
|
||||
this.registerApp(22, "SWITCH", "DISABLE", "disable");
|
||||
this.registerApp(23, "CONFIG", "YES", "open_configuration");
|
||||
this.registerApp(24, "HIGHLIGHT", "YES", "block_highlight");
|
||||
}
|
||||
}
|
||||
|
||||
private void registerApp(final int iconIndex, final String setting, final String val, final String title) {
|
||||
final ButtonAppearance a = new ButtonAppearance();
|
||||
a.displayName = StatCollector.translateToLocal(prefix + title);
|
||||
if (StatCollector.translateToLocal(prefix + title + ".hint").equals(prefix + title + ".hint")) {
|
||||
a.displayValue = null;
|
||||
} else {
|
||||
a.displayValue = StatCollector.translateToLocal(prefix + title + ".hint");
|
||||
}
|
||||
a.index = iconIndex % 10;
|
||||
a.page = iconIndex / 10;
|
||||
appearances.put(new EnumPair(setting, val), a);
|
||||
}
|
||||
|
||||
public void setVisibility(final boolean vis) {
|
||||
this.visible = vis;
|
||||
this.enabled = vis;
|
||||
}
|
||||
|
||||
private int getIconIndex() {
|
||||
if (this.buttonSetting != null && this.currentValue != null) {
|
||||
final ButtonAppearance app = appearances.get(new EnumPair(this.buttonSetting, this.currentValue));
|
||||
if (app == null) {
|
||||
return 8;
|
||||
}
|
||||
return app.index;
|
||||
}
|
||||
return 8;
|
||||
}
|
||||
|
||||
private int getIconPage() {
|
||||
if (this.buttonSetting != null && this.currentValue != null) {
|
||||
final ButtonAppearance app = appearances.get(new EnumPair(this.buttonSetting, this.currentValue));
|
||||
if (app == null) {
|
||||
return 0;
|
||||
}
|
||||
return app.page;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getSetting() {
|
||||
return this.buttonSetting;
|
||||
}
|
||||
|
||||
public String getCurrentValue() {
|
||||
return this.currentValue;
|
||||
}
|
||||
|
||||
public boolean getMouseIn() {
|
||||
return this.field_146123_n;
|
||||
}
|
||||
|
||||
public void set(final String e) {
|
||||
if (!this.currentValue.equals(e)) {
|
||||
this.currentValue = e;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isHalfSize() {
|
||||
return this.halfSize;
|
||||
}
|
||||
|
||||
public void setHalfSize(final boolean halfSize) {
|
||||
this.halfSize = halfSize;
|
||||
}
|
||||
|
||||
public String getFillVar() {
|
||||
return this.fillVar;
|
||||
}
|
||||
|
||||
public void setFillVar(final String fillVar) {
|
||||
this.fillVar = fillVar;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int xPos() {
|
||||
return this.xPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int yPos() {
|
||||
return this.yPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return this.halfSize ? 8 : 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return this.halfSize ? 8 : 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return this.visible;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
String displayName = null;
|
||||
String displayValue = null;
|
||||
|
||||
if (this.buttonSetting != null && this.currentValue != null) {
|
||||
final ButtonAppearance buttonAppearance = appearances
|
||||
.get(new EnumPair(this.buttonSetting, this.currentValue));
|
||||
if (buttonAppearance == null) {
|
||||
return "No Such Message";
|
||||
}
|
||||
displayName = buttonAppearance.displayName;
|
||||
displayValue = buttonAppearance.displayValue;
|
||||
}
|
||||
|
||||
if (displayName != null) {
|
||||
String name = StatCollector.translateToLocal(displayName);
|
||||
if (name == null || name.isEmpty()) {
|
||||
name = displayName;
|
||||
}
|
||||
if (displayValue != null) {
|
||||
String value = StatCollector.translateToLocal(displayValue);
|
||||
|
||||
if (this.fillVar != null) {
|
||||
value = COMPILE.matcher(value).replaceFirst(this.fillVar);
|
||||
}
|
||||
|
||||
value = PATTERN_NEW_LINE.matcher(value).replaceAll("\n");
|
||||
final StringBuilder sb = new StringBuilder(value);
|
||||
|
||||
int i = sb.lastIndexOf("\n");
|
||||
if (i <= 0) {
|
||||
i = 0;
|
||||
}
|
||||
while (i + 30 < sb.length() && (i = sb.lastIndexOf(" ", i + 30)) != -1) {
|
||||
sb.replace(i, i + 1, "\n");
|
||||
}
|
||||
return name + '\n' + sb;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(final Minecraft par1Minecraft, final int par2, final int par3) {
|
||||
if (this.visible) {
|
||||
final int iconIndex = this.getIconIndex();
|
||||
final int iconPage = this.getIconPage();
|
||||
|
||||
if (this.halfSize) {
|
||||
this.width = 8;
|
||||
this.height = 8;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(this.xPosition, this.yPosition, 0.0F);
|
||||
GL11.glScalef(0.5f / 16 * 3, 0.5f / 16 * 3, 0.5f / 16 * 3);
|
||||
|
||||
if (this.enabled) {
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
} else {
|
||||
GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
}
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(FluidCraft.resource("textures/gui/states" + iconPage + ".png"));
|
||||
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition
|
||||
&& par2 < this.xPosition + this.width
|
||||
&& par3 < this.yPosition + this.height;
|
||||
|
||||
final int uv_y = (int) Math.floor(iconIndex / 3.0);
|
||||
final int uv_x = iconIndex - uv_y * 3;
|
||||
if (this.background) {
|
||||
this.drawTexturedModalRect(
|
||||
0,
|
||||
0,
|
||||
Math.round(32F * 16F / 3F),
|
||||
Math.round(32F * 16F / 3F),
|
||||
Math.round(16F * 16F / 3F),
|
||||
Math.round(16F * 16F / 3F));
|
||||
}
|
||||
this.drawTexturedModalRect(
|
||||
0,
|
||||
0,
|
||||
Math.round(uv_x * 16F * 16F / 3F),
|
||||
Math.round(uv_y * 16F * 16F / 3F),
|
||||
Math.round(16F * 16F / 3F),
|
||||
Math.round(16F * 16F / 3F));
|
||||
|
||||
} else {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(this.xPosition, this.yPosition, 0.0F);
|
||||
GL11.glScalef(0.5f / 16 * 6, 0.5f / 16 * 6, 0.5f / 16 * 6);
|
||||
if (this.enabled) {
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
} else {
|
||||
GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
}
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(FluidCraft.resource("textures/gui/states" + iconPage + ".png"));
|
||||
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition
|
||||
&& par2 < this.xPosition + this.width
|
||||
&& par3 < this.yPosition + this.height;
|
||||
|
||||
final int uv_y = (int) Math.floor(iconIndex / 3.0);
|
||||
final int uv_x = iconIndex - uv_y * 3;
|
||||
if (this.background) {
|
||||
this.drawTexturedModalRect(
|
||||
0,
|
||||
0,
|
||||
Math.round(32F * 16F / 3F),
|
||||
Math.round(32F * 16F / 3F),
|
||||
Math.round(16F * 16F / 3F),
|
||||
Math.round(16F * 16F / 3F));
|
||||
}
|
||||
this.drawTexturedModalRect(
|
||||
0,
|
||||
0,
|
||||
Math.round(uv_x * 16F * 16F / 3F),
|
||||
Math.round(uv_y * 16F * 16F / 3F),
|
||||
Math.round(16F * 16F / 3F),
|
||||
Math.round(16F * 16F / 3F));
|
||||
}
|
||||
this.mouseDragged(par1Minecraft, par2, par3);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
private static final class EnumPair {
|
||||
|
||||
final String setting;
|
||||
final String value;
|
||||
|
||||
EnumPair(final String a, final String b) {
|
||||
this.setting = a;
|
||||
this.value = b;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.setting.hashCode() ^ this.value.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (this.getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
final EnumPair other = (EnumPair) obj;
|
||||
return other.setting.equals(this.setting) && other.value.equals(this.value);
|
||||
}
|
||||
}
|
||||
|
||||
private static class ButtonAppearance {
|
||||
|
||||
public int index;
|
||||
public int page;
|
||||
public String displayName;
|
||||
public String displayValue;
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.client.gui.base.FCGuiAmount;
|
||||
import com.glodblock.github.common.parts.PartFluidStorageBus;
|
||||
import com.glodblock.github.inventory.IDualHost;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
|
||||
import appeng.container.implementations.ContainerPriority;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.helpers.IPriorityHost;
|
||||
import appeng.util.calculators.ArithHelper;
|
||||
import appeng.util.calculators.Calculator;
|
||||
|
||||
public class GuiFCPriority extends FCGuiAmount {
|
||||
|
||||
public GuiFCPriority(final InventoryPlayer inventoryPlayer, final IPriorityHost te) {
|
||||
super(new ContainerPriority(inventoryPlayer, te));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.submit.enabled = false;
|
||||
this.submit.visible = false;
|
||||
this.buttonList.remove(this.submit);
|
||||
((ContainerPriority) this.inventorySlots).setTextField(this.amountBox);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getIncrementQuantity(int i) {
|
||||
return AEConfig.instance.priorityByStacksAmounts(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.fontRendererObj.drawString(GuiText.Priority.getLocal(), 8, 6, 0x404040);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
super.drawBG(offsetX, offsetY, mouseX, mouseY);
|
||||
this.amountBox.drawTextBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addQty(final int i) {
|
||||
try {
|
||||
this.amountBox.setText(Long.toString(getAmount() + i));
|
||||
} catch (final NumberFormatException ignore) {}
|
||||
try {
|
||||
NetworkHandler.instance
|
||||
.sendToServer(new PacketValueConfig("PriorityHost.Priority", String.valueOf(getAmount())));
|
||||
} catch (IOException e) {
|
||||
AELog.debug(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setOriginGUI(Object target) {
|
||||
if (target instanceof IDualHost) {
|
||||
this.myIcon = ItemAndBlockHolder.INTERFACE.stack();
|
||||
this.originalGui = GuiType.DUAL_INTERFACE;
|
||||
} else if (target instanceof PartFluidStorageBus) {
|
||||
this.myIcon = ItemAndBlockHolder.FLUID_STORAGE_BUS.stack();
|
||||
this.originalGui = GuiType.FLUID_STORAGE_BUS;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(final char character, final int key) {
|
||||
super.keyTyped(character, key);
|
||||
try {
|
||||
NetworkHandler.instance
|
||||
.sendToServer(new PacketValueConfig("PriorityHost.Priority", String.valueOf(getAmount())));
|
||||
} catch (IOException e) {
|
||||
AELog.debug(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getAmount() {
|
||||
try {
|
||||
String out = this.amountBox.getText();
|
||||
double result = Calculator.conversion(out);
|
||||
if (Double.isNaN(result)) {
|
||||
return 0;
|
||||
} else {
|
||||
return (int) ArithHelper.round(result, 0);
|
||||
}
|
||||
} catch (final NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
protected String getBackground() {
|
||||
return "guis/priority.png";
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidAutoFiller;
|
||||
import com.glodblock.github.common.tile.TileFluidAutoFiller;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.client.gui.AEBaseMEGui;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class GuiFluidAutoFiller extends AEBaseMEGui {
|
||||
|
||||
protected EntityPlayer player;
|
||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/fluid_auto_filler.png");
|
||||
|
||||
public GuiFluidAutoFiller(InventoryPlayer ipl, TileFluidAutoFiller tile) {
|
||||
super(new ContainerFluidAutoFiller(ipl, tile));
|
||||
this.player = ipl.player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
mc.getTextureManager().bindTexture(TEX_BG);
|
||||
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_AUTO_FILLER)), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
}
|
||||
}
|
||||
@@ -1,124 +0,0 @@
|
||||
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;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
|
||||
import com.glodblock.github.common.parts.PartFluidTerminal;
|
||||
import com.glodblock.github.common.parts.PartLevelTerminal;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
|
||||
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.network.CPacketCraftRequest;
|
||||
|
||||
import appeng.api.config.CraftingMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.container.implementations.ContainerCraftAmount;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class GuiFluidCraftAmount extends FCGuiAmount {
|
||||
|
||||
private GuiImgButton craftingMode;
|
||||
|
||||
public GuiFluidCraftAmount(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||
super(new ContainerCraftAmount(inventoryPlayer, te));
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.fontRendererObj.drawString(GuiText.SelectAmount.getLocal(), 8, 6, 0x404040);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
super.drawBG(offsetX, offsetY, mouseX, mouseY);
|
||||
this.submit.displayString = isShiftKeyDown() ? GuiText.Start.getLocal() : GuiText.Next.getLocal();
|
||||
try {
|
||||
this.submit.enabled = getAmount() > 0;
|
||||
} catch (final NumberFormatException e) {
|
||||
this.submit.enabled = false;
|
||||
}
|
||||
this.amountBox.drawTextBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
try {
|
||||
if (btn == this.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");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setOriginGUI(Object target) {
|
||||
if (target instanceof PartFluidPatternTerminal) {
|
||||
this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL.stack();
|
||||
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
|
||||
} else if (target instanceof PartFluidPatternTerminalEx) {
|
||||
this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL_EX.stack();
|
||||
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
|
||||
} else if (target instanceof PartFluidTerminal) {
|
||||
this.myIcon = ItemAndBlockHolder.FLUID_TERM.stack();
|
||||
this.originalGui = GuiType.FLUID_TERMINAL;
|
||||
} else if (target instanceof PartLevelTerminal) {
|
||||
myIcon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
|
||||
originalGui = GuiType.LEVEL_TERMINAL;
|
||||
} else if (target instanceof IWirelessTerminal terminal && terminal.isUniversal(target)) {
|
||||
this.myIcon = ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack();
|
||||
this.originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
|
||||
} else if (target instanceof WirelessPatternTerminalInventory) {
|
||||
this.myIcon = ItemAndBlockHolder.WIRELESS_PATTERN_TERM.stack();
|
||||
this.originalGui = GuiType.FLUID_TERMINAL;
|
||||
} else if (target instanceof WirelessLevelTerminalInventory) {
|
||||
myIcon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
|
||||
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBackground() {
|
||||
return "guis/craftAmt.png";
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
|
||||
import com.glodblock.github.common.parts.PartLevelTerminal;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
|
||||
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.implementations.GuiCraftConfirm;
|
||||
|
||||
public class GuiFluidCraftConfirm extends GuiCraftConfirm {
|
||||
|
||||
private GuiType originalGui;
|
||||
|
||||
public GuiFluidCraftConfirm(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||
super(inventoryPlayer, te);
|
||||
if (te instanceof PartFluidPatternTerminal) {
|
||||
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
|
||||
} else if (te instanceof PartFluidPatternTerminalEx) {
|
||||
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
|
||||
} else if (te instanceof PartLevelTerminal) {
|
||||
originalGui = GuiType.LEVEL_TERMINAL;
|
||||
} else if (te instanceof IWirelessTerminal terminal && terminal.isUniversal(te)) {
|
||||
this.originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
|
||||
} else if (te instanceof WirelessPatternTerminalInventory) {
|
||||
this.originalGui = GuiType.FLUID_TERMINAL;
|
||||
} else if (te instanceof WirelessLevelTerminalInventory) {
|
||||
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switchToOriginalGUI() {
|
||||
InventoryHandler.switchGui(originalGui);
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
import com.glodblock.github.client.gui.container.ContainerCraftingWireless;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.container.slot.SlotCraftingMatrix;
|
||||
import appeng.core.localization.GuiColors;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketInventoryAction;
|
||||
import appeng.helpers.InventoryAction;
|
||||
|
||||
public class GuiFluidCraftingWireless extends GuiItemMonitor {
|
||||
|
||||
private GuiImgButton clearBtn;
|
||||
|
||||
public GuiFluidCraftingWireless(final InventoryPlayer inventoryPlayer, final IWirelessTerminal te) {
|
||||
super(inventoryPlayer, te, new ContainerCraftingWireless(inventoryPlayer, te));
|
||||
this.setReservedSpace(73);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (btn == craftingStatusBtn) {
|
||||
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
|
||||
} else {
|
||||
super.actionPerformed(btn);
|
||||
if (this.clearBtn == btn) {
|
||||
Slot s = null;
|
||||
final Container c = this.inventorySlots;
|
||||
for (final Object j : c.inventorySlots) {
|
||||
if (j instanceof SlotCraftingMatrix) {
|
||||
s = (Slot) j;
|
||||
}
|
||||
}
|
||||
if (s != null) {
|
||||
final PacketInventoryAction p = new PacketInventoryAction(
|
||||
InventoryAction.MOVE_REGION,
|
||||
s.slotNumber,
|
||||
0);
|
||||
NetworkHandler.instance.sendToServer(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.buttonList.add(
|
||||
this.clearBtn = new GuiImgButton(
|
||||
this.guiLeft + 92,
|
||||
this.guiTop + this.ySize - 156,
|
||||
Settings.ACTIONS,
|
||||
ActionItems.STASH));
|
||||
this.clearBtn.setHalfSize(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
super.drawFG(offsetX, offsetY, mouseX, mouseY);
|
||||
this.fontRendererObj.drawString(
|
||||
GuiText.CraftingTerminal.getLocal(),
|
||||
8,
|
||||
this.ySize - 96 + 1 - this.getReservedSpace(),
|
||||
GuiColors.CraftingTerminalTitle.getColor());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBackground() {
|
||||
return "gui/crafting.png";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidIO;
|
||||
import com.glodblock.github.common.parts.PartFluidExportBus;
|
||||
import com.glodblock.github.common.parts.PartFluidImportBus;
|
||||
import com.glodblock.github.common.parts.base.FCSharedFluidBus;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.client.gui.implementations.GuiUpgradeable;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class GuiFluidIO extends GuiUpgradeable {
|
||||
|
||||
private final FCSharedFluidBus bus;
|
||||
|
||||
public GuiFluidIO(InventoryPlayer inventoryPlayer, FCSharedFluidBus te) {
|
||||
super(new ContainerFluidIO(inventoryPlayer, te));
|
||||
this.bus = te;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GuiText getName() {
|
||||
return this.bus instanceof PartFluidImportBus ? GuiText.ImportBus : GuiText.ExportBus;
|
||||
}
|
||||
|
||||
public void update(int id, IAEFluidStack stack) {
|
||||
((ContainerFluidIO) this.cvb).getBus().setFluidInSlot(id, stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.fontRendererObj.drawString(
|
||||
this.getGuiDisplayName(
|
||||
I18n.format(
|
||||
this.bus instanceof PartFluidImportBus ? NameConst.GUI_FLUID_IMPORT
|
||||
: NameConst.GUI_FLUID_EXPORT)),
|
||||
8,
|
||||
6,
|
||||
4210752);
|
||||
this.fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
|
||||
|
||||
if (this.redstoneMode != null) {
|
||||
this.redstoneMode.set(this.cvb.getRedStoneMode());
|
||||
}
|
||||
|
||||
if (this.fuzzyMode != null) {
|
||||
this.fuzzyMode.set(this.cvb.getFuzzyMode());
|
||||
}
|
||||
|
||||
if (this.craftMode != null) {
|
||||
this.craftMode.set(this.cvb.getCraftingMode());
|
||||
}
|
||||
|
||||
if (this.schedulingMode != null) {
|
||||
this.schedulingMode.set(this.cvb.getSchedulingMode());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleButtonVisibility() {
|
||||
super.handleButtonVisibility();
|
||||
if (this.schedulingMode != null) {
|
||||
this.schedulingMode.setVisibility(
|
||||
this.bc.getInstalledUpgrades(Upgrades.CAPACITY) > 0 && this.bc instanceof PartFluidExportBus);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidInterface;
|
||||
import com.glodblock.github.common.parts.PartFluidInterface;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import com.glodblock.github.inventory.IDualHost;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.gui.MouseRegionManager;
|
||||
import com.glodblock.github.inventory.gui.TankMouseHandler;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.glodblock.github.util.RenderUtil;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class GuiFluidInterface extends AEBaseGui {
|
||||
|
||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/interface_fluid.png");
|
||||
private static final int TANK_X = 35, TANK_X_OFF = 18, TANK_Y = 53;
|
||||
private static final int TANK_WIDTH = 16, TANK_HEIGHT = 68;
|
||||
private final ContainerFluidInterface cont;
|
||||
|
||||
private GuiTabButton switcher;
|
||||
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
|
||||
|
||||
public GuiFluidInterface(InventoryPlayer ipl, IDualHost tile) {
|
||||
super(new ContainerFluidInterface(ipl, tile));
|
||||
this.cont = (ContainerFluidInterface) inventorySlots;
|
||||
this.ySize = 231;
|
||||
this.addMouseRegin();
|
||||
}
|
||||
|
||||
private void addMouseRegin() {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
mouseRegions.addRegion(
|
||||
TANK_X + TANK_X_OFF * i,
|
||||
TANK_Y,
|
||||
TANK_WIDTH,
|
||||
TANK_HEIGHT,
|
||||
new TankMouseHandler(cont.getTile().getInternalFluid(), i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_146977_a(final Slot s) {
|
||||
try {
|
||||
GuiContainer.class.getDeclaredMethod("func_146977_a_original", Slot.class).invoke(this, s);
|
||||
} catch (final Exception ignore) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.switcher = new GuiTabButton(
|
||||
this.guiLeft + 154,
|
||||
this.guiTop,
|
||||
isPart() ? ItemAndBlockHolder.FLUID_INTERFACE.stack() : ItemAndBlockHolder.INTERFACE.stack(),
|
||||
StatCollector.translateToLocal("ae2fc.tooltip.switch_fluid_interface"),
|
||||
itemRender);
|
||||
this.buttonList.add(this.switcher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_INTERFACE)), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
|
||||
IAEFluidTank fluidInv = cont.getTile().getInternalFluid();
|
||||
mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
for (int i = 0; i < 6; i++) {
|
||||
if (!isPart()) {
|
||||
fontRendererObj.drawString(dirName(i), TANK_X + i * TANK_X_OFF + 5, 22, 0x404040);
|
||||
}
|
||||
RenderUtil.renderFluidIntoGui(
|
||||
this,
|
||||
TANK_X + i * TANK_X_OFF,
|
||||
TANK_Y,
|
||||
TANK_WIDTH,
|
||||
TANK_HEIGHT,
|
||||
fluidInv.getFluidInSlot(i),
|
||||
fluidInv.getTankInfo(ForgeDirection.UNKNOWN)[i].capacity);
|
||||
}
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
mouseRegions.render(mouseX, mouseY);
|
||||
}
|
||||
|
||||
public String dirName(int face) {
|
||||
return I18n.format(NameConst.GUI_FLUID_INTERFACE + "." + face);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
mc.getTextureManager().bindTexture(TEX_BG);
|
||||
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
if (btn == this.switcher) {
|
||||
InventoryHandler.switchGui(GuiType.DUAL_INTERFACE);
|
||||
}
|
||||
}
|
||||
|
||||
public void update(int id, IAEFluidStack stack) {
|
||||
if (id >= 100) {
|
||||
cont.getTile().setConfig(id - 100, stack);
|
||||
} else {
|
||||
cont.getTile().setFluidInv(id, stack);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isPart() {
|
||||
return this.cont.getTile() instanceof PartFluidInterface;
|
||||
}
|
||||
}
|
||||
@@ -1,229 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidLevelEmitter;
|
||||
import com.glodblock.github.common.parts.PartFluidLevelEmitter;
|
||||
import com.glodblock.github.network.CPacketValueConfig;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.client.gui.implementations.GuiUpgradeable;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.MEGuiTextField;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.localization.GuiColors;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.util.calculators.ArithHelper;
|
||||
import appeng.util.calculators.Calculator;
|
||||
|
||||
public class GuiFluidLevelEmitter extends GuiUpgradeable {
|
||||
|
||||
private MEGuiTextField amountTextField;
|
||||
|
||||
private GuiButton plus1;
|
||||
private GuiButton plus10;
|
||||
private GuiButton plus100;
|
||||
private GuiButton plus1000;
|
||||
private GuiButton minus1;
|
||||
private GuiButton minus10;
|
||||
private GuiButton minus100;
|
||||
private GuiButton minus1000;
|
||||
|
||||
private GuiButton setButton;
|
||||
|
||||
private boolean isMul = false;
|
||||
|
||||
public GuiFluidLevelEmitter(final InventoryPlayer inventoryPlayer, final PartFluidLevelEmitter te) {
|
||||
super(new ContainerFluidLevelEmitter(inventoryPlayer, te));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
this.amountTextField = new MEGuiTextField(90, 12);
|
||||
this.amountTextField.x = this.guiLeft + 39;
|
||||
this.amountTextField.y = this.guiTop + 44;
|
||||
this.amountTextField.setFocused(true);
|
||||
((ContainerFluidLevelEmitter) this.inventorySlots).setTextField(this.amountTextField);
|
||||
this.validateText();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addButtons() {
|
||||
this.redstoneMode = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.guiTop + 8,
|
||||
Settings.REDSTONE_EMITTER,
|
||||
RedstoneMode.LOW_SIGNAL);
|
||||
|
||||
final int a = AEConfig.instance.levelByStackAmounts(0);
|
||||
final int b = AEConfig.instance.levelByStackAmounts(1);
|
||||
final int c = AEConfig.instance.levelByStackAmounts(2);
|
||||
final int d = AEConfig.instance.levelByStackAmounts(3);
|
||||
|
||||
this.buttonList.add(this.plus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 17, 22, 20, "+" + a));
|
||||
this.buttonList.add(this.plus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 17, 28, 20, "+" + b));
|
||||
this.buttonList.add(this.plus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 17, 32, 20, "+" + c));
|
||||
this.buttonList.add(this.plus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 17, 38, 20, "+" + d));
|
||||
|
||||
this.buttonList.add(this.minus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 63, 22, 20, "-" + a));
|
||||
this.buttonList.add(this.minus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 63, 28, 20, "-" + b));
|
||||
this.buttonList.add(this.minus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 63, 32, 20, "-" + c));
|
||||
this.buttonList.add(this.minus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 63, 38, 20, "-" + d));
|
||||
|
||||
this.buttonList.add(
|
||||
this.setButton = new GuiButton(
|
||||
0,
|
||||
this.guiLeft + 134,
|
||||
this.guiTop + 40,
|
||||
28,
|
||||
20,
|
||||
GuiText.Set.getLocal()));
|
||||
|
||||
this.buttonList.add(this.redstoneMode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.fontRendererObj.drawString(
|
||||
getGuiDisplayName(NameConst.i18n(NameConst.GUI_FLUID_LEVEL_EMITTER)),
|
||||
8,
|
||||
6,
|
||||
GuiColors.UpgradableTitle.getColor());
|
||||
this.fontRendererObj.drawString(
|
||||
GuiText.inventory.getLocal(),
|
||||
8,
|
||||
this.ySize - 96 + 3,
|
||||
GuiColors.UpgradableInventory.getColor());
|
||||
this.redstoneMode.set(this.cvb.getRedStoneMode());
|
||||
|
||||
if (isShiftKeyDown() && !isMul) {
|
||||
for (GuiButton btn : this.buttonList) {
|
||||
if (btn instanceof GuiButton) {
|
||||
btn.displayString += "000";
|
||||
}
|
||||
}
|
||||
isMul = true;
|
||||
} else if (!isShiftKeyDown() && isMul) {
|
||||
for (GuiButton btn : this.buttonList) {
|
||||
if (btn instanceof GuiButton) {
|
||||
btn.displayString = btn.displayString.substring(0, btn.displayString.lastIndexOf("000"));
|
||||
}
|
||||
}
|
||||
isMul = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
super.drawBG(offsetX, offsetY, mouseX, mouseY);
|
||||
this.amountTextField.drawTextBox();
|
||||
|
||||
// Without these two lines, the liquid slot will not draw properly.
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.bindTexture(this.getBackground());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleButtonVisibility() {}
|
||||
|
||||
@Override
|
||||
protected String getBackground() {
|
||||
return "guis/lvlemitter.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
|
||||
if (btn == this.setButton && this.setButton.enabled) {
|
||||
final long amount = this.getAmountLong();
|
||||
this.amountTextField.setText(Long.toString(amount));
|
||||
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketValueConfig(amount, 0));
|
||||
} else {
|
||||
final boolean isPlus = btn == this.plus1 || btn == this.plus10
|
||||
|| btn == this.plus100
|
||||
|| btn == this.plus1000;
|
||||
final boolean isMinus = btn == this.minus1 || btn == this.minus10
|
||||
|| btn == this.minus100
|
||||
|| btn == this.minus1000;
|
||||
|
||||
if (isPlus || isMinus) {
|
||||
long result = addOrderAmount(this.getQty(btn));
|
||||
this.amountTextField.setText(Long.toString(result));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private long addOrderAmount(final int i) {
|
||||
long resultL = getAmountLong();
|
||||
|
||||
if (resultL == 1 && i > 1) {
|
||||
resultL = 0;
|
||||
}
|
||||
|
||||
resultL += i;
|
||||
if (resultL < 1) {
|
||||
resultL = 1;
|
||||
}
|
||||
return resultL;
|
||||
}
|
||||
|
||||
private long getAmountLong() {
|
||||
String out = this.amountTextField.getText();
|
||||
double resultD = Calculator.conversion(out);
|
||||
|
||||
if (resultD <= 0 || Double.isNaN(resultD)) {
|
||||
return 0;
|
||||
} else {
|
||||
return (long) ArithHelper.round(resultD, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateText() {
|
||||
String text = this.amountTextField.getText();
|
||||
double resultD = Calculator.conversion(text);
|
||||
this.setButton.enabled = !Double.isNaN(resultD);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int xCoord, int yCoord, int btn) {
|
||||
this.amountTextField.mouseClicked(xCoord, yCoord, btn);
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(final char character, final int key) {
|
||||
if (!this.checkHotbarKeys(key)) {
|
||||
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
|
||||
this.actionPerformed(this.setButton);
|
||||
} else {
|
||||
boolean typedTextbox = this.amountTextField.textboxKeyTyped(character, key);
|
||||
if (typedTextbox) {
|
||||
this.validateText();
|
||||
} else {
|
||||
super.keyTyped(character, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean drawUpgrades() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void update(Integer key, IAEFluidStack value) {
|
||||
((ContainerFluidLevelEmitter) this.cvb).getBus().setFluidInSlot(key, value);
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.glodblock.github.client.gui.base.FCGuiMonitor;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidMonitor;
|
||||
import com.glodblock.github.client.me.FluidRepo;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
public class GuiFluidMonitor extends FCGuiMonitor<IAEFluidStack> {
|
||||
|
||||
public GuiFluidMonitor(final InventoryPlayer inventoryPlayer, final ITerminalHost te,
|
||||
final ContainerFluidMonitor c) {
|
||||
super(inventoryPlayer, te, c);
|
||||
this.repo = new FluidRepo(getScrollBar(), this);
|
||||
this.setScrollBar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postUpdate(final List<IAEFluidStack> list, boolean resort) {
|
||||
for (final IAEFluidStack is : list) {
|
||||
IAEItemStack stack = AEItemStack.create(ItemFluidDrop.newDisplayStack(is.getFluidStack()));
|
||||
stack.setStackSize(is.getStackSize());
|
||||
this.repo.postUpdate(stack);
|
||||
}
|
||||
if (resort) {
|
||||
this.repo.updateView();
|
||||
}
|
||||
this.setScrollBar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.fontRendererObj.drawString(this.getGuiDisplayName(GuiText.Terminal.getLocal()), 8, 6, 4210752);
|
||||
this.fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IAEItemStack transformItem(IAEItemStack stack) {
|
||||
if (stack.getItem() instanceof ItemFluidDrop) {
|
||||
return ItemFluidDrop.newAeStack(ItemFluidDrop.getAeFluidStack(stack));
|
||||
}
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTextFieldValue(String displayName, int mousex, int mousey, ItemStack stack) {
|
||||
final FluidStack fluid = Util.getFluidFromItem(stack);
|
||||
if (fluid != null) {
|
||||
setSearchString(fluid.getLocalizedName(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.container.slot.SlotDisabled;
|
||||
|
||||
public class GuiFluidPatternExWireless extends GuiFluidPatternTerminalEx {
|
||||
|
||||
public GuiFluidPatternExWireless(InventoryPlayer inventoryPlayer, IWirelessTerminal te) {
|
||||
super(inventoryPlayer, te);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void repositionSlot(final AppEngSlot s) {
|
||||
if (s instanceof SlotDisabled || s.isPlayerSide()) {
|
||||
s.yDisplayPosition = s.getY() + this.ySize - 78 - 5;
|
||||
} else {
|
||||
s.yDisplayPosition = s.getY() + this.ySize - 78 - 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,180 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.base.FCGuiEncodeTerminal;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminal;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidPatternWireless;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.network.CPacketInventoryAction;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.ItemSubstitution;
|
||||
import appeng.api.config.PatternBeSubstitution;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.container.slot.OptionalSlotFake;
|
||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||
import appeng.container.slot.SlotPatternTerm;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.helpers.InventoryAction;
|
||||
|
||||
public class GuiFluidPatternTerminal extends FCGuiEncodeTerminal {
|
||||
|
||||
public GuiFluidPatternTerminal(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||
super(inventoryPlayer, te, new ContainerFluidPatternTerminal(inventoryPlayer, te));
|
||||
}
|
||||
|
||||
public GuiFluidPatternTerminal(final InventoryPlayer inventoryPlayer, final IWirelessTerminal te) {
|
||||
super(inventoryPlayer, te, new ContainerFluidPatternWireless(inventoryPlayer, te));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.tabCraftButton = new GuiTabButton(
|
||||
this.guiLeft + 173,
|
||||
this.guiTop + this.ySize - 177,
|
||||
new ItemStack(Blocks.crafting_table),
|
||||
GuiText.CraftingPattern.getLocal(),
|
||||
itemRender);
|
||||
this.buttonList.add(this.tabCraftButton);
|
||||
|
||||
this.tabProcessButton = new GuiTabButton(
|
||||
this.guiLeft + 173,
|
||||
this.guiTop + this.ySize - 177,
|
||||
new ItemStack(Blocks.furnace),
|
||||
GuiText.ProcessingPattern.getLocal(),
|
||||
itemRender);
|
||||
this.buttonList.add(this.tabProcessButton);
|
||||
|
||||
this.substitutionsEnabledBtn = new GuiImgButton(
|
||||
this.guiLeft + 84,
|
||||
this.guiTop + this.ySize - 163,
|
||||
Settings.ACTIONS,
|
||||
ItemSubstitution.ENABLED);
|
||||
this.substitutionsEnabledBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.substitutionsEnabledBtn);
|
||||
|
||||
this.substitutionsDisabledBtn = new GuiImgButton(
|
||||
this.guiLeft + 84,
|
||||
this.guiTop + this.ySize - 163,
|
||||
Settings.ACTIONS,
|
||||
ItemSubstitution.DISABLED);
|
||||
this.substitutionsDisabledBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.substitutionsDisabledBtn);
|
||||
|
||||
this.clearBtn = new GuiImgButton(
|
||||
this.guiLeft + 74,
|
||||
this.guiTop + this.ySize - 163,
|
||||
Settings.ACTIONS,
|
||||
ActionItems.CLOSE);
|
||||
this.clearBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.clearBtn);
|
||||
|
||||
this.encodeBtn = new GuiImgButton(
|
||||
this.guiLeft + 147,
|
||||
this.guiTop + this.ySize - 142,
|
||||
Settings.ACTIONS,
|
||||
ActionItems.ENCODE);
|
||||
this.buttonList.add(this.encodeBtn);
|
||||
|
||||
int combineLeft = 74;
|
||||
int combineTop = 153;
|
||||
if (ModAndClassUtil.isDoubleButton) {
|
||||
this.doubleBtn = new GuiImgButton(
|
||||
this.guiLeft + 74,
|
||||
this.guiTop + this.ySize - 153,
|
||||
Settings.ACTIONS,
|
||||
ActionItems.DOUBLE);
|
||||
this.doubleBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.doubleBtn);
|
||||
combineLeft = 84;
|
||||
}
|
||||
if (ModAndClassUtil.isBeSubstitutionsButton) {
|
||||
combineLeft = 74;
|
||||
combineTop -= 11;
|
||||
this.beSubstitutionsEnabledBtn = new GuiImgButton(
|
||||
this.guiLeft + 84,
|
||||
this.guiTop + this.ySize - 153,
|
||||
Settings.ACTIONS,
|
||||
PatternBeSubstitution.ENABLED);
|
||||
this.beSubstitutionsEnabledBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.beSubstitutionsEnabledBtn);
|
||||
|
||||
this.beSubstitutionsDisabledBtn = new GuiImgButton(
|
||||
this.guiLeft + 84,
|
||||
this.guiTop + this.ySize - 153,
|
||||
Settings.ACTIONS,
|
||||
PatternBeSubstitution.DISABLED);
|
||||
this.beSubstitutionsDisabledBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.beSubstitutionsDisabledBtn);
|
||||
}
|
||||
this.combineEnableBtn = new GuiFCImgButton(
|
||||
this.guiLeft + combineLeft,
|
||||
this.guiTop + this.ySize - combineTop,
|
||||
"FORCE_COMBINE",
|
||||
"DO_COMBINE");
|
||||
this.combineEnableBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.combineEnableBtn);
|
||||
|
||||
this.combineDisableBtn = new GuiFCImgButton(
|
||||
this.guiLeft + combineLeft,
|
||||
this.guiTop + this.ySize - combineTop,
|
||||
"NOT_COMBINE",
|
||||
"DONT_COMBINE");
|
||||
this.combineDisableBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.combineDisableBtn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
super.drawFG(offsetX, offsetY, mouseX, mouseY);
|
||||
this.fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal(NameConst.GUI_FLUID_PATTERN_TERMINAL),
|
||||
8,
|
||||
this.ySize - 96 + 2 - getReservedSpace(),
|
||||
4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void 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) {
|
||||
if (this.container.isCraftingMode()
|
||||
&& (slot instanceof OptionalSlotFake || slot instanceof SlotFakeCraftingMatrix
|
||||
|| slot instanceof SlotPatternTerm)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBackground() {
|
||||
if (this.container.isCraftingMode()) {
|
||||
return "gui/pattern.png";
|
||||
}
|
||||
return "gui/pattern2.png";
|
||||
}
|
||||
}
|
||||
@@ -1,232 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.base.FCGuiEncodeTerminal;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidPatternExWireless;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminalEx;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
|
||||
import com.glodblock.github.network.CPacketInventoryAction;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.ItemSubstitution;
|
||||
import appeng.api.config.PatternBeSubstitution;
|
||||
import appeng.api.config.PatternSlotConfig;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.helpers.InventoryAction;
|
||||
|
||||
public class GuiFluidPatternTerminalEx extends FCGuiEncodeTerminal {
|
||||
|
||||
public GuiFluidPatternTerminalEx(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||
super(inventoryPlayer, te, new ContainerFluidPatternTerminalEx(inventoryPlayer, te));
|
||||
processingScrollBar.setHeight(70).setWidth(7).setLeft(6).setRange(0, 1, 1);
|
||||
processingScrollBar.setTexture(FluidCraft.MODID, "gui/pattern3.png", 242, 0);
|
||||
}
|
||||
|
||||
public GuiFluidPatternTerminalEx(final InventoryPlayer inventoryPlayer, final IWirelessTerminal te) {
|
||||
super(inventoryPlayer, te, new ContainerFluidPatternExWireless(inventoryPlayer, te));
|
||||
processingScrollBar.setHeight(70).setWidth(7).setLeft(6).setRange(0, 1, 1);
|
||||
processingScrollBar.setTexture(FluidCraft.MODID, "gui/pattern3.png", 242, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
this.substitutionsEnabledBtn = new GuiImgButton(
|
||||
this.guiLeft + 97,
|
||||
this.guiTop + this.ySize - 163,
|
||||
Settings.ACTIONS,
|
||||
ItemSubstitution.ENABLED);
|
||||
this.substitutionsEnabledBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.substitutionsEnabledBtn);
|
||||
|
||||
this.substitutionsDisabledBtn = new GuiImgButton(
|
||||
this.guiLeft + 97,
|
||||
this.guiTop + this.ySize - 163,
|
||||
Settings.ACTIONS,
|
||||
ItemSubstitution.DISABLED);
|
||||
this.substitutionsDisabledBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.substitutionsDisabledBtn);
|
||||
|
||||
this.fluidPrioritizedEnabledBtn = new GuiFCImgButton(
|
||||
this.guiLeft + 97,
|
||||
this.guiTop + this.ySize - 114,
|
||||
"FORCE_PRIO",
|
||||
"DO_PRIO");
|
||||
this.fluidPrioritizedEnabledBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.fluidPrioritizedEnabledBtn);
|
||||
|
||||
this.fluidPrioritizedDisabledBtn = new GuiFCImgButton(
|
||||
this.guiLeft + 97,
|
||||
this.guiTop + this.ySize - 114,
|
||||
"NOT_PRIO",
|
||||
"DONT_PRIO");
|
||||
this.fluidPrioritizedDisabledBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.fluidPrioritizedDisabledBtn);
|
||||
|
||||
invertBtn = new GuiImgButton(
|
||||
this.guiLeft + 87,
|
||||
this.guiTop + this.ySize - 153,
|
||||
Settings.ACTIONS,
|
||||
container.inverted ? PatternSlotConfig.C_4_16 : PatternSlotConfig.C_16_4);
|
||||
invertBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.invertBtn);
|
||||
|
||||
this.clearBtn = new GuiImgButton(
|
||||
this.guiLeft + 87,
|
||||
this.guiTop + this.ySize - 163,
|
||||
Settings.ACTIONS,
|
||||
ActionItems.CLOSE);
|
||||
this.clearBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.clearBtn);
|
||||
|
||||
this.encodeBtn = new GuiImgButton(
|
||||
this.guiLeft + 147,
|
||||
this.guiTop + this.ySize - 142,
|
||||
Settings.ACTIONS,
|
||||
ActionItems.ENCODE);
|
||||
this.buttonList.add(this.encodeBtn);
|
||||
|
||||
if (ModAndClassUtil.isDoubleButton) {
|
||||
this.doubleBtn = new GuiImgButton(
|
||||
this.guiLeft + 97,
|
||||
this.guiTop + this.ySize - 153,
|
||||
Settings.ACTIONS,
|
||||
ActionItems.DOUBLE);
|
||||
this.doubleBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.doubleBtn);
|
||||
}
|
||||
|
||||
this.combineEnableBtn = new GuiFCImgButton(
|
||||
this.guiLeft + 87,
|
||||
this.guiTop + this.ySize - 114,
|
||||
"FORCE_COMBINE",
|
||||
"DO_COMBINE");
|
||||
this.combineEnableBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.combineEnableBtn);
|
||||
|
||||
this.combineDisableBtn = new GuiFCImgButton(
|
||||
this.guiLeft + 87,
|
||||
this.guiTop + this.ySize - 114,
|
||||
"NOT_COMBINE",
|
||||
"DONT_COMBINE");
|
||||
this.combineDisableBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.combineDisableBtn);
|
||||
if (ModAndClassUtil.isBeSubstitutionsButton) {
|
||||
this.beSubstitutionsEnabledBtn = new GuiImgButton(
|
||||
this.guiLeft + 87,
|
||||
this.guiTop + this.ySize - 103,
|
||||
Settings.ACTIONS,
|
||||
PatternBeSubstitution.ENABLED);
|
||||
this.beSubstitutionsEnabledBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.beSubstitutionsEnabledBtn);
|
||||
|
||||
this.beSubstitutionsDisabledBtn = new GuiImgButton(
|
||||
this.guiLeft + 87,
|
||||
this.guiTop + this.ySize - 103,
|
||||
Settings.ACTIONS,
|
||||
PatternBeSubstitution.DISABLED);
|
||||
this.beSubstitutionsDisabledBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.beSubstitutionsDisabledBtn);
|
||||
}
|
||||
processingScrollBar.setTop(this.ySize - 164);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
super.drawFG(offsetX, offsetY, mouseX, mouseY);
|
||||
this.fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal(NameConst.GUI_FLUID_PATTERN_TERMINAL_EX),
|
||||
8,
|
||||
this.ySize - 96 + 2 - getReservedSpace(),
|
||||
4210752);
|
||||
this.processingScrollBar.draw(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBackground() {
|
||||
return container.inverted ? "gui/pattern4.png" : "gui/pattern3.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(final int mouseX, final int mouseY, final float btn) {
|
||||
final int offset = container.inverted ? 18 * -3 : 0;
|
||||
substitutionsEnabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
substitutionsDisabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
beSubstitutionsEnabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
beSubstitutionsDisabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
fluidPrioritizedEnabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
fluidPrioritizedDisabledBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
doubleBtn.xPosition = this.guiLeft + 97 + offset;
|
||||
clearBtn.xPosition = this.guiLeft + 87 + offset;
|
||||
invertBtn.xPosition = this.guiLeft + 87 + offset;
|
||||
combineEnableBtn.xPosition = this.guiLeft + 87 + offset;
|
||||
combineDisableBtn.xPosition = this.guiLeft + 87 + offset;
|
||||
processingScrollBar.setCurrentScroll(container.activePage);
|
||||
super.drawScreen(mouseX, mouseY, btn);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
|
||||
final int currentScroll = this.processingScrollBar.getCurrentScroll();
|
||||
this.processingScrollBar.click(this, xCoord - this.guiLeft, yCoord - this.guiTop);
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClickMove(final int x, final int y, final int c, final long d) {
|
||||
final int currentScroll = this.processingScrollBar.getCurrentScroll();
|
||||
this.processingScrollBar.click(this, x - this.guiLeft, y - this.guiTop);
|
||||
super.mouseClickMove(x, y, c, d);
|
||||
|
||||
if (currentScroll != this.processingScrollBar.getCurrentScroll()) {
|
||||
changeActivePage();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMouseInput() {
|
||||
super.handleMouseInput();
|
||||
final int wheel = Mouse.getEventDWheel();
|
||||
|
||||
if (wheel != 0) {
|
||||
final int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
|
||||
final int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight;
|
||||
|
||||
if (this.processingScrollBar.contains(x - this.guiLeft, y - this.guiTop)) {
|
||||
final int currentScroll = this.processingScrollBar.getCurrentScroll();
|
||||
this.processingScrollBar.wheel(wheel);
|
||||
|
||||
if (currentScroll != this.processingScrollBar.getCurrentScroll()) {
|
||||
changeActivePage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void changeActivePage() {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns(
|
||||
"PatternTerminal.ActivePage",
|
||||
String.valueOf(this.processingScrollBar.getCurrentScroll())));
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.container.slot.SlotDisabled;
|
||||
|
||||
public class GuiFluidPatternWireless extends GuiFluidPatternTerminal {
|
||||
|
||||
public GuiFluidPatternWireless(InventoryPlayer inventoryPlayer, IWirelessTerminal te) {
|
||||
super(inventoryPlayer, te);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void repositionSlot(final AppEngSlot s) {
|
||||
if (s instanceof SlotDisabled || s.isPlayerSide()) {
|
||||
s.yDisplayPosition = s.getY() + this.ySize - 78 - 5;
|
||||
} else {
|
||||
s.yDisplayPosition = s.getY() + this.ySize - 78 - 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidPortableCell;
|
||||
import com.glodblock.github.inventory.item.IFluidPortableCell;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
|
||||
public class GuiFluidPortableCell extends GuiFluidTerminal {
|
||||
|
||||
public GuiFluidPortableCell(final InventoryPlayer inventoryPlayer, final IFluidPortableCell te) {
|
||||
super(inventoryPlayer, te, new ContainerFluidPortableCell(inventoryPlayer, te));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void repositionSlot(final AppEngSlot s) {
|
||||
s.yDisplayPosition = s.getY() + this.ySize - 78 - 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getMaxRows() {
|
||||
if (this.container.getHost() instanceof IWirelessTerminal) {
|
||||
return super.getMaxRows();
|
||||
} else {
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidStorageBus;
|
||||
import com.glodblock.github.common.parts.PartFluidStorageBus;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.client.gui.implementations.GuiUpgradeable;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.core.localization.GuiColors;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketConfigButton;
|
||||
|
||||
public class GuiFluidStorageBus extends GuiUpgradeable {
|
||||
|
||||
private GuiImgButton rwMode;
|
||||
private GuiTabButton priority;
|
||||
private GuiImgButton partition;
|
||||
private GuiImgButton clear;
|
||||
|
||||
public GuiFluidStorageBus(InventoryPlayer inventoryPlayer, PartFluidStorageBus te) {
|
||||
super(new ContainerFluidStorageBus(inventoryPlayer, te));
|
||||
this.ySize = 251;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addButtons() {
|
||||
this.clear = new GuiImgButton(this.guiLeft - 18, this.guiTop + 8, Settings.ACTIONS, ActionItems.CLOSE);
|
||||
this.partition = new GuiImgButton(this.guiLeft - 18, this.guiTop + 28, Settings.ACTIONS, ActionItems.WRENCH);
|
||||
this.rwMode = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.guiTop + 48,
|
||||
Settings.ACCESS,
|
||||
AccessRestriction.READ_WRITE);
|
||||
this.priority = new GuiTabButton(
|
||||
this.guiLeft + 154,
|
||||
this.guiTop,
|
||||
2 + 4 * 16,
|
||||
GuiText.Priority.getLocal(),
|
||||
itemRender);
|
||||
|
||||
this.buttonList.add(this.priority);
|
||||
this.buttonList.add(this.rwMode);
|
||||
this.buttonList.add(this.partition);
|
||||
this.buttonList.add(this.clear);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.fontRendererObj.drawString(
|
||||
this.getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_STORAGE_BUS)),
|
||||
8,
|
||||
6,
|
||||
GuiColors.StorageBusTitle.getColor());
|
||||
this.fontRendererObj.drawString(
|
||||
GuiText.inventory.getLocal(),
|
||||
8,
|
||||
this.ySize - 96 + 3,
|
||||
GuiColors.StorageBusInventory.getColor());
|
||||
|
||||
if (this.rwMode != null) {
|
||||
this.rwMode.set(((ContainerFluidStorageBus) this.cvb).getReadWriteMode());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBackground() {
|
||||
return "guis/storagebus.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
final boolean backwards = Mouse.isButtonDown(1);
|
||||
if (btn == this.partition) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("StorageBus.Action", "Partition"));
|
||||
} else if (btn == this.clear) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("StorageBus.Action", "Clear"));
|
||||
} else if (btn == this.priority) {
|
||||
InventoryHandler.switchGui(GuiType.PRIORITY);
|
||||
} else if (btn == this.rwMode) {
|
||||
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.rwMode.getSetting(), backwards));
|
||||
}
|
||||
}
|
||||
|
||||
public void update(int id, IAEFluidStack stack) {
|
||||
((ContainerFluidStorageBus) this.cvb).bus.setFluidInSlot(id, stack);
|
||||
}
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidMonitor;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.network.CPacketFluidUpdate;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.Util;
|
||||
import com.mitchej123.hodgepodge.textures.IPatchedTextureAtlasSprite;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.me.SlotME;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
|
||||
public class GuiFluidTerminal extends GuiFluidMonitor {
|
||||
|
||||
protected EntityPlayer player;
|
||||
public ContainerFluidMonitor container;
|
||||
|
||||
public GuiFluidTerminal(InventoryPlayer inventoryPlayer, ITerminalHost te) {
|
||||
super(inventoryPlayer, te, new ContainerFluidMonitor(inventoryPlayer, te));
|
||||
this.container = new ContainerFluidMonitor(inventoryPlayer, te);
|
||||
this.player = inventoryPlayer.player;
|
||||
this.showViewBtn = false;
|
||||
}
|
||||
|
||||
public GuiFluidTerminal(final InventoryPlayer inventoryPlayer, final ITerminalHost te,
|
||||
final ContainerFluidMonitor c) {
|
||||
super(inventoryPlayer, te, c);
|
||||
this.container = c;
|
||||
this.player = inventoryPlayer.player;
|
||||
this.showViewBtn = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void repositionSlot(final AppEngSlot s) {
|
||||
if (s.isPlayerSide()) {
|
||||
s.yDisplayPosition = s.getY() + this.ySize - 78 - 5;
|
||||
} else {
|
||||
s.yDisplayPosition = s.getY() + this.ySize - 78 - 3;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (btn == craftingStatusBtn) {
|
||||
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
|
||||
} else {
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_146977_a(final Slot s) {
|
||||
if (drawSlot0(s)) super.func_146977_a(s);
|
||||
}
|
||||
|
||||
public boolean drawSlot0(Slot slot) {
|
||||
if (slot instanceof SlotME) {
|
||||
IAEItemStack stack = ((SlotME) slot).getAEStack();
|
||||
if (stack == null) return true;
|
||||
FluidStack fluidStack = ItemFluidDrop.getFluidStack(slot.getStack());
|
||||
this.drawWidget(slot.xDisplayPosition, slot.yDisplayPosition, fluidStack.getFluid());
|
||||
aeRenderItem.setAeStack(stack);
|
||||
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
|
||||
aeRenderItem.renderItemOverlayIntoGUI(
|
||||
fontRendererObj,
|
||||
mc.getTextureManager(),
|
||||
stack.getItemStack(),
|
||||
slot.xDisplayPosition,
|
||||
slot.yDisplayPosition);
|
||||
GL11.glTranslatef(0.0f, 0.0f, -200.0f);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void drawWidget(int posX, int posY, Fluid fluid) {
|
||||
if (fluid == null) return;
|
||||
IIcon icon = fluid.getIcon();
|
||||
if (icon == null) return;
|
||||
|
||||
if (ModAndClassUtil.HODGEPODGE && icon instanceof IPatchedTextureAtlasSprite) {
|
||||
((IPatchedTextureAtlasSprite) icon).markNeedsAnimationUpdate();
|
||||
}
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glColor3f(
|
||||
(fluid.getColor() >> 16 & 0xFF) / 255.0F,
|
||||
(fluid.getColor() >> 8 & 0xFF) / 255.0F,
|
||||
(fluid.getColor() & 0xFF) / 255.0F);
|
||||
drawTexturedModelRectFromIcon(posX, posY, fluid.getIcon(), 16, 16);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glColor3f(1, 1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
|
||||
if (slot instanceof SlotME && Util.FluidUtil.isFluidContainer(player.inventory.getItemStack())) {
|
||||
IAEFluidStack fluid = ItemFluidDrop.getAeFluidStack(((SlotME) slot).getAEStack());
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(fluid, isShiftKeyDown()));
|
||||
}
|
||||
if (mouseButton == 3 && slot instanceof SlotME) {
|
||||
return;
|
||||
}
|
||||
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
|
||||
}
|
||||
|
||||
public void update(ItemStack itemStack) {
|
||||
this.player.inventory.setItemStack(itemStack);
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerIngredientBuffer;
|
||||
import com.glodblock.github.common.tile.TileIngredientBuffer;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import com.glodblock.github.inventory.gui.ButtonMouseHandler;
|
||||
import com.glodblock.github.inventory.gui.MouseRegionManager;
|
||||
import com.glodblock.github.inventory.gui.TankMouseHandler;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.glodblock.github.util.RenderUtil;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class GuiIngredientBuffer extends AEBaseGui {
|
||||
|
||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/ingredient_buffer.png");
|
||||
private static final int TANK_X = 47, TANK_X_OFF = 22, TANK_Y = 18;
|
||||
private static final int TANK_WIDTH = 16, TANK_HEIGHT = 74;
|
||||
|
||||
private final ContainerIngredientBuffer cont;
|
||||
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
|
||||
|
||||
public GuiIngredientBuffer(InventoryPlayer ipl, TileIngredientBuffer tile) {
|
||||
super(new ContainerIngredientBuffer(ipl, tile));
|
||||
this.cont = (ContainerIngredientBuffer) inventorySlots;
|
||||
this.ySize = 222;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
mouseRegions.addRegion(
|
||||
TANK_X + TANK_X_OFF * i,
|
||||
TANK_Y,
|
||||
TANK_WIDTH,
|
||||
TANK_HEIGHT,
|
||||
new TankMouseHandler(cont.getTile().getInternalFluid(), i));
|
||||
mouseRegions.addRegion(
|
||||
TANK_X + 10 + 22 * i,
|
||||
TANK_Y + TANK_HEIGHT + 2,
|
||||
7,
|
||||
7,
|
||||
ButtonMouseHandler.dumpTank(cont, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int xCoord, int yCoord, int btn) {
|
||||
if (mouseRegions.onClick(xCoord, yCoord, btn)) {
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
mc.getTextureManager().bindTexture(TEX_BG);
|
||||
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_INGREDIENT_BUFFER)), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
|
||||
IAEFluidTank fluidInv = cont.getTile().getInternalFluid();
|
||||
mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
RenderUtil.renderFluidIntoGui(
|
||||
this,
|
||||
TANK_X + i * TANK_X_OFF,
|
||||
TANK_Y,
|
||||
TANK_WIDTH,
|
||||
TANK_HEIGHT,
|
||||
fluidInv.getFluidInSlot(i),
|
||||
fluidInv.getTankInfo(ForgeDirection.UNKNOWN)[i].capacity);
|
||||
}
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
mouseRegions.render(mouseX, mouseY);
|
||||
}
|
||||
|
||||
public void update(int slot, IAEFluidStack aeFluidStack) {
|
||||
cont.getTile().getInternalFluid().setFluidInSlot(slot, aeFluidStack);
|
||||
}
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.client.gui.container.ContainerInterfaceWireless;
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
import appeng.client.gui.implementations.GuiInterfaceTerminal;
|
||||
|
||||
public class GuiInterfaceWireless extends GuiInterfaceTerminal {
|
||||
|
||||
protected GuiFCImgButton FluidTerminal;
|
||||
protected GuiFCImgButton CraftingTerminal;
|
||||
protected GuiFCImgButton PatternTerminal;
|
||||
protected GuiFCImgButton EssentiaTerminal;
|
||||
protected GuiFCImgButton InterfaceTerminal;
|
||||
protected GuiFCImgButton LevelTerminal;
|
||||
protected GuiFCImgButton PatternTerminalEx;
|
||||
|
||||
public GuiInterfaceWireless(final InventoryPlayer inventoryPlayer, final IWirelessTerminal te) {
|
||||
super(new ContainerInterfaceWireless(inventoryPlayer, te));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
drawSwitchGuiBtns();
|
||||
}
|
||||
|
||||
protected void drawSwitchGuiBtns() {
|
||||
this.buttonList.add(this.CraftingTerminal = new GuiFCImgButton(this.guiLeft - 18, offsetY, "CRAFT_TEM", "YES"));
|
||||
offsetY += 20;
|
||||
|
||||
this.buttonList
|
||||
.add(this.PatternTerminal = new GuiFCImgButton(this.guiLeft - 18, offsetY, "PATTERN_TEM", "YES"));
|
||||
offsetY += 20;
|
||||
|
||||
this.buttonList
|
||||
.add(this.PatternTerminalEx = new GuiFCImgButton(this.guiLeft - 18, offsetY, "PATTERN_EX_TEM", "YES"));
|
||||
offsetY += 20;
|
||||
|
||||
this.buttonList.add(this.FluidTerminal = new GuiFCImgButton(this.guiLeft - 18, offsetY, "FLUID_TEM", "YES"));
|
||||
offsetY += 20;
|
||||
|
||||
this.buttonList.add(this.LevelTerminal = new GuiFCImgButton(this.guiLeft - 18, offsetY, "LEVEL_TEM", "YES"));
|
||||
offsetY += 20;
|
||||
|
||||
if (ModAndClassUtil.ThE) {
|
||||
this.buttonList
|
||||
.add(this.EssentiaTerminal = new GuiFCImgButton(this.guiLeft - 18, offsetY, "ESSENTIA_TEM", "YES"));
|
||||
offsetY += 20;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean scheduleGuiResize;
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int xCoord, int yCoord, int btn) {
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
if (scheduleGuiResize) {
|
||||
// in the GuiScreen class, the implementation of super.mouseClicked
|
||||
// ends up looping on the button list and execute the action for any
|
||||
// button below the mouse.
|
||||
// Therefore, if we initGui() the terminal in the actionPerformed method below
|
||||
// it will run the actionPerformed a second time for the new button
|
||||
// that will end up being below the mouse (if any) after the initGui()
|
||||
buttonList.clear();
|
||||
initGui();
|
||||
scheduleGuiResize = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected final void scheduleGuiResize() {
|
||||
scheduleGuiResize = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (btn instanceof GuiFCImgButton) {
|
||||
if (btn == this.FluidTerminal) {
|
||||
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_FLUID_TERMINAL);
|
||||
} else if (btn == this.CraftingTerminal) {
|
||||
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_CRAFTING_TERMINAL);
|
||||
} else if (btn == this.EssentiaTerminal) {
|
||||
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_ESSENTIA_TERMINAL);
|
||||
} else if (btn == this.PatternTerminal) {
|
||||
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_FLUID_PATTERN_TERMINAL);
|
||||
} else if (btn == this.InterfaceTerminal) {
|
||||
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_INTERFACE_TERMINAL);
|
||||
} else if (btn == this.LevelTerminal) {
|
||||
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_LEVEL_TERMINAL);
|
||||
} else if (btn == this.PatternTerminalEx) {
|
||||
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_FLUID_PATTERN_TERMINAL_EX);
|
||||
}
|
||||
}
|
||||
|
||||
super.actionPerformed(btn);
|
||||
|
||||
if (btn == this.terminalStyleBox) {
|
||||
scheduleGuiResize();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.glodblock.github.client.gui.base.FCGuiMonitor;
|
||||
import com.glodblock.github.client.gui.container.ContainerItemMonitor;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.me.ItemRepo;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class GuiItemMonitor extends FCGuiMonitor<IAEItemStack> {
|
||||
|
||||
public GuiItemMonitor(final InventoryPlayer inventoryPlayer, final ITerminalHost te, final ContainerItemMonitor c) {
|
||||
super(inventoryPlayer, te, c);
|
||||
this.repo = new ItemRepo(getScrollBar(), this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postUpdate(final List<IAEItemStack> list, boolean resort) {
|
||||
for (final IAEItemStack is : list) {
|
||||
this.repo.postUpdate(is);
|
||||
}
|
||||
if (resort) {
|
||||
this.repo.updateView();
|
||||
}
|
||||
this.setScrollBar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.fontRendererObj.drawString(this.getGuiDisplayName(GuiText.Terminal.getLocal()), 8, 6, 4210752);
|
||||
this.fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(final int mouseX, final int mouseY, final float btn) {
|
||||
super.drawScreen(mouseX, mouseY, btn);
|
||||
if (ModAndClassUtil.isSearchBar && AEConfig.instance.preserveSearchBar && searchField != null)
|
||||
handleTooltip(mouseX, mouseY, searchField.new TooltipProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTextFieldValue(String displayName, int mousex, int mousey, ItemStack stack) {
|
||||
setSearchString(displayName, true);
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerLargeIngredientBuffer;
|
||||
import com.glodblock.github.common.tile.TileLargeIngredientBuffer;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import com.glodblock.github.inventory.gui.ButtonMouseHandler;
|
||||
import com.glodblock.github.inventory.gui.MouseRegionManager;
|
||||
import com.glodblock.github.inventory.gui.TankMouseHandler;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.glodblock.github.util.RenderUtil;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class GuiLargeIngredientBuffer extends AEBaseGui {
|
||||
|
||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/large_ingredient_buffer.png");
|
||||
private static final int TANK_X = 13, TANK_X_OFF = 22, TANK_Y = 18;
|
||||
private static final int TANK_WIDTH = 16, TANK_HEIGHT = 37;
|
||||
|
||||
private final ContainerLargeIngredientBuffer cont;
|
||||
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
|
||||
|
||||
public GuiLargeIngredientBuffer(InventoryPlayer ipl, TileLargeIngredientBuffer tile) {
|
||||
super(new ContainerLargeIngredientBuffer(ipl, tile));
|
||||
this.cont = (ContainerLargeIngredientBuffer) inventorySlots;
|
||||
this.ySize = 222;
|
||||
for (int i = 0; i < 7; i++) {
|
||||
mouseRegions.addRegion(
|
||||
TANK_X + TANK_X_OFF * i,
|
||||
TANK_Y,
|
||||
TANK_WIDTH,
|
||||
TANK_HEIGHT,
|
||||
new TankMouseHandler(cont.getTile().getInternalFluid(), i));
|
||||
mouseRegions.addRegion(
|
||||
TANK_X + 10 + 22 * i,
|
||||
TANK_Y + TANK_HEIGHT + 2,
|
||||
7,
|
||||
7,
|
||||
ButtonMouseHandler.dumpTank(cont, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int xCoord, int yCoord, int btn) {
|
||||
if (mouseRegions.onClick(xCoord, yCoord, btn)) {
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
mc.getTextureManager().bindTexture(TEX_BG);
|
||||
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj
|
||||
.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_LARGE_INGREDIENT_BUFFER)), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
|
||||
IAEFluidTank fluidInv = cont.getTile().getInternalFluid();
|
||||
mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
for (int i = 0; i < 7; i++) {
|
||||
RenderUtil.renderFluidIntoGui(
|
||||
this,
|
||||
TANK_X + i * TANK_X_OFF,
|
||||
TANK_Y,
|
||||
TANK_WIDTH,
|
||||
TANK_HEIGHT,
|
||||
fluidInv.getFluidInSlot(i),
|
||||
fluidInv.getTankInfo(ForgeDirection.UNKNOWN)[i].capacity);
|
||||
}
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
mouseRegions.render(mouseX, mouseY);
|
||||
}
|
||||
|
||||
public void update(int slot, IAEFluidStack aeFluidStack) {
|
||||
cont.getTile().getInternalFluid().setFluidInSlot(slot, aeFluidStack);
|
||||
}
|
||||
}
|
||||
@@ -1,602 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import static com.glodblock.github.client.gui.container.ContainerLevelMaintainer.createLevelValues;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerLevelMaintainer;
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
import com.glodblock.github.common.parts.PartLevelTerminal;
|
||||
import com.glodblock.github.common.tile.TileLevelMaintainer;
|
||||
import com.glodblock.github.common.tile.TileLevelMaintainer.State;
|
||||
import com.glodblock.github.common.tile.TileLevelMaintainer.TLMTags;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.gui.MouseRegionManager;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
|
||||
import com.glodblock.github.inventory.slot.SlotFluidConvertingFake;
|
||||
import com.glodblock.github.inventory.slot.SlotSingleItem;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.network.CPacketLevelMaintainer;
|
||||
import com.glodblock.github.network.CPacketLevelMaintainer.Action;
|
||||
import com.glodblock.github.network.CPacketLevelTerminalCommands;
|
||||
import com.glodblock.github.util.FCGuiColors;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotFake;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketNEIDragClick;
|
||||
import appeng.util.calculators.ArithHelper;
|
||||
import appeng.util.calculators.Calculator;
|
||||
import codechicken.nei.VisiblityData;
|
||||
import codechicken.nei.api.INEIGuiHandler;
|
||||
import codechicken.nei.api.TaggedInventoryArea;
|
||||
import cofh.core.render.CoFHFontRenderer;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
@Optional.Interface(modid = "NotEnoughItems", iface = "codechicken.nei.api.INEIGuiHandler")
|
||||
public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
|
||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/level_maintainer.png");
|
||||
private final ContainerLevelMaintainer cont;
|
||||
private final Component[] component = new Component[TileLevelMaintainer.REQ_COUNT];
|
||||
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
|
||||
private Widget focusedWidget;
|
||||
private int lastWorkingTick;
|
||||
private int refreshTick;
|
||||
private final CoFHFontRenderer render;
|
||||
protected ItemStack icon = null;
|
||||
|
||||
protected GuiType originalGui;
|
||||
protected Util.DimensionalCoordSide originalBlockPos;
|
||||
protected GuiTabButton originalGuiBtn;
|
||||
|
||||
public GuiLevelMaintainer(InventoryPlayer ipl, TileLevelMaintainer tile) {
|
||||
super(new ContainerLevelMaintainer(ipl, tile));
|
||||
this.cont = (ContainerLevelMaintainer) inventorySlots;
|
||||
this.xSize = 195;
|
||||
this.ySize = 214;
|
||||
this.render = new CoFHFontRenderer(
|
||||
Minecraft.getMinecraft().gameSettings,
|
||||
TEX_BG,
|
||||
Minecraft.getMinecraft().getTextureManager(),
|
||||
true);
|
||||
this.refreshTick = 0;
|
||||
if (ipl.player.openContainer instanceof AEBaseContainer container) {
|
||||
var target = container.getTarget();
|
||||
if (target instanceof PartLevelTerminal terminal) {
|
||||
icon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
|
||||
originalGui = GuiType.LEVEL_TERMINAL;
|
||||
DimensionalCoord blockPos = new DimensionalCoord(terminal.getTile());
|
||||
originalBlockPos = new Util.DimensionalCoordSide(
|
||||
blockPos.x,
|
||||
blockPos.y,
|
||||
blockPos.z,
|
||||
blockPos.getDimension(),
|
||||
terminal.getSide(),
|
||||
"");
|
||||
} else if (target instanceof IWirelessTerminal terminal && terminal.isUniversal(target)) {
|
||||
icon = ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack();
|
||||
originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
|
||||
originalBlockPos = new Util.DimensionalCoordSide(
|
||||
terminal.getInventorySlot(),
|
||||
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
|
||||
0,
|
||||
ipl.player.worldObj.provider.dimensionId,
|
||||
ForgeDirection.UNKNOWN,
|
||||
"");
|
||||
} else if (target instanceof WirelessLevelTerminalInventory terminal) {
|
||||
icon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
|
||||
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
|
||||
originalBlockPos = new Util.DimensionalCoordSide(
|
||||
terminal.getInventorySlot(),
|
||||
Util.GuiHelper.encodeType(0, Util.GuiHelper.GuiType.ITEM),
|
||||
0,
|
||||
ipl.player.worldObj.provider.dimensionId,
|
||||
ForgeDirection.UNKNOWN,
|
||||
"");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void postUpdate(List<IAEItemStack> list) {
|
||||
for (Slot slot : this.cont.getRequestSlots()) {
|
||||
if (!slot.getHasStack()) {
|
||||
component[slot.getSlotIndex()].setState(State.None);
|
||||
}
|
||||
}
|
||||
for (IAEItemStack is : list) {
|
||||
NBTTagCompound data = is.getItemStack().getTagCompound();
|
||||
if (data == null) {
|
||||
if (AEConfig.instance.isFeatureEnabled(AEFeature.PacketLogging)) {
|
||||
AELog.info("Received empty configuration: ", is);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
long batch = data.getLong(TLMTags.Batch.tagName);
|
||||
long quantity = data.getLong(TLMTags.Quantity.tagName);
|
||||
int idx = data.getInteger(TLMTags.Index.tagName);
|
||||
boolean isEnable = data.getBoolean(TLMTags.Enable.tagName);
|
||||
State state = State.values()[data.getInteger(TLMTags.State.tagName)];
|
||||
component[idx].getQty().textField.setText(String.valueOf(quantity));
|
||||
component[idx].getBatch().textField.setText(String.valueOf(batch));
|
||||
component[idx].getQty().validate();
|
||||
component[idx].getBatch().validate();
|
||||
component[idx].setEnable(isEnable);
|
||||
component[idx].setState(state);
|
||||
}
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.lastWorkingTick = this.refreshTick;
|
||||
for (int i = 0; i < TileLevelMaintainer.REQ_COUNT; i++) {
|
||||
component[i] = new Component(
|
||||
new Widget(
|
||||
new FCGuiTextField(this.fontRendererObj, guiLeft + 46, guiTop + 19 + 19 * i, 52, 14),
|
||||
NameConst.TT_LEVEL_MAINTAINER_REQUEST_SIZE,
|
||||
i,
|
||||
Action.Quantity),
|
||||
new Widget(
|
||||
new FCGuiTextField(this.fontRendererObj, guiLeft + 100, guiTop + 19 + 19 * i, 52, 14),
|
||||
NameConst.TT_LEVEL_MAINTAINER_BATCH_SIZE,
|
||||
i,
|
||||
Action.Batch),
|
||||
new GuiFCImgButton(guiLeft + 105 + 47, guiTop + 17 + 19 * i, "SUBMIT", "SUBMIT", false),
|
||||
new GuiFCImgButton(guiLeft + 9, guiTop + 20 + 19 * i, "ENABLE", "ENABLE", false),
|
||||
new GuiFCImgButton(guiLeft + 9, guiTop + 20 + 19 * i, "DISABLE", "DISABLE", false),
|
||||
new FCGuiLineField(fontRendererObj, guiLeft + 47, guiTop + 33 + 19 * i, 125),
|
||||
this.buttonList);
|
||||
}
|
||||
if (this.icon != null) {
|
||||
this.originalGuiBtn = new GuiTabButton(
|
||||
this.guiLeft + 151,
|
||||
this.guiTop - 4,
|
||||
this.icon,
|
||||
this.icon.getDisplayName(),
|
||||
itemRender);
|
||||
this.originalGuiBtn.setHideEdge(13);
|
||||
this.buttonList.add(originalGuiBtn);
|
||||
}
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.Refresh));
|
||||
}
|
||||
|
||||
public void drawScreen(final int mouseX, final int mouseY, final float btn) {
|
||||
this.refreshTick++;
|
||||
super.drawScreen(mouseX, mouseY, btn);
|
||||
for (Component com : this.component) {
|
||||
com.getQty().textField.handleTooltip(mouseX, mouseY, this);
|
||||
com.getBatch().textField.handleTooltip(mouseX, mouseY, this);
|
||||
com.getLine().handleTooltip(mouseX, mouseY, this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
mc.getTextureManager().bindTexture(TEX_BG);
|
||||
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
|
||||
int tick = this.refreshTick;
|
||||
int interval = 20;
|
||||
if (tick > lastWorkingTick + interval && this.focusedWidget == null) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.Refresh));
|
||||
lastWorkingTick = this.refreshTick;
|
||||
}
|
||||
for (int i = 0; i < TileLevelMaintainer.REQ_COUNT; i++) {
|
||||
this.component[i].draw();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(getGuiDisplayName(NameConst.i18n(NameConst.GUI_LEVEL_MAINTAINER)), 8, 6, 0x404040);
|
||||
mouseRegions.render(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_146977_a(final Slot s) {
|
||||
if (drawSlot0(s)) super.func_146977_a(s);
|
||||
}
|
||||
|
||||
public boolean drawSlot0(Slot slot) {
|
||||
if (slot instanceof SlotFake) {
|
||||
IAEItemStack stack = ((SlotFluidConvertingFake) slot).getAeStack();
|
||||
super.func_146977_a(new SlotSingleItem(slot));
|
||||
if (stack == null) return true;
|
||||
IAEItemStack fake = stack.copy();
|
||||
|
||||
Widget qty = this.component[slot.getSlotIndex()].getQty();
|
||||
qty.validate();
|
||||
fake.setStackSize(qty.getAmount() != null ? qty.getAmount() : 0);
|
||||
|
||||
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
|
||||
aeRenderItem.setAeStack(fake);
|
||||
aeRenderItem.renderItemOverlayIntoGUI(
|
||||
fontRendererObj,
|
||||
mc.getTextureManager(),
|
||||
fake.getItemStack(),
|
||||
slot.xDisplayPosition,
|
||||
slot.yDisplayPosition);
|
||||
GL11.glTranslatef(0.0f, 0.0f, -200.0f);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
|
||||
if (btn == 0) {
|
||||
if (focusedWidget != null) {
|
||||
focusedWidget.textField.setFocused(false);
|
||||
}
|
||||
for (Component com : this.component) {
|
||||
Widget textField = com.isMouseIn(xCoord, yCoord);
|
||||
if (textField != null) {
|
||||
textField.textField.setFocused(true);
|
||||
this.focusedWidget = textField;
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.focusedWidget = null;
|
||||
}
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(final char character, final int key) {
|
||||
if (this.focusedWidget == null) {
|
||||
super.keyTyped(character, key);
|
||||
return;
|
||||
}
|
||||
if (!this.checkHotbarKeys(key)) {
|
||||
if (!((character == ' ') && this.focusedWidget.textField.getText().isEmpty())) {
|
||||
this.focusedWidget.textField.textboxKeyTyped(character, key);
|
||||
}
|
||||
super.keyTyped(character, key);
|
||||
|
||||
this.focusedWidget.validate();
|
||||
|
||||
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
|
||||
this.component[this.focusedWidget.componentIndex].submit();
|
||||
this.focusedWidget.textField.setFocused(false);
|
||||
this.focusedWidget = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
|
||||
if (slot instanceof SlotFluidConvertingFake && this.cont.getPlayerInv().getItemStack() != null) {
|
||||
this.component[slot.getSlotIndex()].getQty().textField
|
||||
.setText(String.valueOf(this.cont.getPlayerInv().getItemStack().stackSize));
|
||||
return;
|
||||
}
|
||||
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
|
||||
}
|
||||
|
||||
public void updateAmount(int idx, int stackSize) {
|
||||
this.component[idx].getQty().textField.setText(String.valueOf(stackSize));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (btn == originalGuiBtn) {
|
||||
switchGui();
|
||||
} else {
|
||||
super.actionPerformed(btn);
|
||||
for (Component com : this.component) {
|
||||
if (com.sendToServer(btn)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void switchGui() {
|
||||
CPacketLevelTerminalCommands message = new CPacketLevelTerminalCommands(
|
||||
CPacketLevelTerminalCommands.Action.BACK,
|
||||
originalBlockPos.x,
|
||||
originalBlockPos.y,
|
||||
originalBlockPos.z,
|
||||
originalBlockPos.getDimension(),
|
||||
originalBlockPos.getSide());
|
||||
if (originalGui != null) {
|
||||
message.setOriginalGui(originalGui.ordinal());
|
||||
}
|
||||
FluidCraft.proxy.netHandler.sendToServer(message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VisiblityData modifyVisiblity(GuiContainer gui, VisiblityData currentVisibility) {
|
||||
return currentVisibility;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Integer> getItemSpawnSlots(GuiContainer gui, ItemStack item) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TaggedInventoryArea> getInventoryAreas(GuiContainer gui) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleDragNDrop(GuiContainer gui, int mouseX, int mouseY, ItemStack draggedStack, int button) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private class Component {
|
||||
|
||||
public boolean isEnable = true;
|
||||
private final Widget qty;
|
||||
private final Widget batch;
|
||||
private final GuiFCImgButton disable;
|
||||
private final GuiFCImgButton enable;
|
||||
private final GuiFCImgButton submit;
|
||||
private final FCGuiLineField line;
|
||||
private State state;
|
||||
|
||||
public Component(Widget qtyInput, Widget batchInput, GuiFCImgButton submitBtn, GuiFCImgButton enableBtn,
|
||||
GuiFCImgButton disableBtn, FCGuiLineField line, List<GuiButton> buttonList) {
|
||||
this.qty = qtyInput;
|
||||
this.batch = batchInput;
|
||||
this.enable = enableBtn;
|
||||
this.disable = disableBtn;
|
||||
this.submit = submitBtn;
|
||||
this.line = line;
|
||||
this.state = State.None;
|
||||
buttonList.add(this.submit);
|
||||
buttonList.add(this.enable);
|
||||
buttonList.add(this.disable);
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return this.qty.componentIndex;
|
||||
}
|
||||
|
||||
public void setEnable(boolean enable) {
|
||||
this.isEnable = enable;
|
||||
}
|
||||
|
||||
private void send(Widget widget) {
|
||||
if (cont.inventorySlots.get(widget.componentIndex).getHasStack() && widget.getAmount() != null) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketLevelMaintainer(widget.action, widget.componentIndex, widget.getAmount()));
|
||||
}
|
||||
}
|
||||
|
||||
public void submit() {
|
||||
this.sendToServer(this.submit);
|
||||
}
|
||||
|
||||
protected boolean sendToServer(GuiButton btn) {
|
||||
boolean didSomething = false;
|
||||
if (this.submit == btn) {
|
||||
final Widget qty = this.getQty();
|
||||
final Widget batch = this.getBatch();
|
||||
qty.validate();
|
||||
batch.validate();
|
||||
if (qty.getAmount() != null) {
|
||||
this.send(qty);
|
||||
}
|
||||
if (batch.getAmount() != null) {
|
||||
this.send(batch);
|
||||
}
|
||||
|
||||
didSomething = true;
|
||||
} else if (this.enable == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.Enable, this.getIndex()));
|
||||
didSomething = true;
|
||||
} else if (this.disable == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.Disable, this.getIndex()));
|
||||
didSomething = true;
|
||||
}
|
||||
return didSomething;
|
||||
}
|
||||
|
||||
public Widget isMouseIn(final int xCoord, final int yCoord) {
|
||||
if (this.qty.textField.isMouseIn(xCoord, yCoord)) return this.getQty();
|
||||
if (this.batch.textField.isMouseIn(xCoord, yCoord)) return this.getBatch();
|
||||
return null;
|
||||
}
|
||||
|
||||
public Widget getQty() {
|
||||
return this.qty;
|
||||
}
|
||||
|
||||
public Widget getBatch() {
|
||||
return this.batch;
|
||||
}
|
||||
|
||||
public FCGuiLineField getLine() {
|
||||
return this.line;
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
this.qty.draw();
|
||||
this.batch.draw();
|
||||
ArrayList<String> message = new ArrayList<>();
|
||||
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_TITLE) + "\n");
|
||||
switch (this.state) {
|
||||
case Idle -> {
|
||||
this.line.setColor(FCGuiColors.StateIdle.getColor());
|
||||
message.add(
|
||||
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_IDLE));
|
||||
}
|
||||
case Craft -> {
|
||||
this.line.setColor(FCGuiColors.StateCraft.getColor());
|
||||
message.add(
|
||||
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_LINK));
|
||||
}
|
||||
case Export -> {
|
||||
this.line.setColor(FCGuiColors.StateExport.getColor());
|
||||
message.add(
|
||||
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_EXPORT));
|
||||
}
|
||||
case Error -> {
|
||||
this.line.setColor(FCGuiColors.StateError.getColor());
|
||||
message.add(
|
||||
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_ERROR));
|
||||
}
|
||||
default -> {
|
||||
this.line.setColor(FCGuiColors.StateNone.getColor());
|
||||
message.add(
|
||||
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_NONE));
|
||||
}
|
||||
}
|
||||
message.add("");
|
||||
if (isShiftKeyDown()) {
|
||||
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_IDLE));
|
||||
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_IDLE_DESC) + "\n");
|
||||
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_LINK));
|
||||
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_LINK_DESC) + "\n");
|
||||
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_EXPORT));
|
||||
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_EXPORT_DESC) + "\n");
|
||||
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_ERROR));
|
||||
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_ERROR_DESC));
|
||||
} else {
|
||||
message.add(NameConst.i18n(NameConst.TT_SHIFT_FOR_MORE));
|
||||
}
|
||||
this.line.setMessage(
|
||||
render.wrapFormattedStringToWidth(String.join("\n", message), (int) Math.floor(xSize * 0.8)));
|
||||
this.line.drawTextBox();
|
||||
if (this.isEnable) {
|
||||
this.enable.visible = true;
|
||||
this.disable.visible = false;
|
||||
} else {
|
||||
this.enable.visible = false;
|
||||
this.disable.visible = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void setState(State state) {
|
||||
this.state = state;
|
||||
}
|
||||
}
|
||||
|
||||
private class Widget {
|
||||
|
||||
public final int componentIndex;
|
||||
public final Action action;
|
||||
public final FCGuiTextField textField;
|
||||
private final String tooltip;
|
||||
private Long amount;
|
||||
|
||||
public Widget(FCGuiTextField textField, String tooltip, int componentIndex, Action action) {
|
||||
this.textField = textField;
|
||||
this.textField.setEnableBackgroundDrawing(false);
|
||||
this.textField.setText("0");
|
||||
this.textField.setMaxStringLength(16); // this length is enough to be useful
|
||||
this.componentIndex = componentIndex;
|
||||
this.action = action;
|
||||
this.tooltip = tooltip;
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
String current = amount != null
|
||||
? StatCollector.translateToLocal(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||
+ NumberFormat.getNumberInstance().format(amount)
|
||||
+ "\n"
|
||||
: "";
|
||||
if (isShiftKeyDown()) {
|
||||
this.setTooltip(
|
||||
render.wrapFormattedStringToWidth(
|
||||
StatCollector.translateToLocal(this.tooltip) + "\n"
|
||||
+ current
|
||||
+ "\n"
|
||||
+ StatCollector.translateToLocal(this.tooltip + ".hint"),
|
||||
xSize / 2));
|
||||
} else {
|
||||
this.setTooltip(
|
||||
render.wrapFormattedStringToWidth(
|
||||
NameConst.i18n(this.tooltip, "\n", false) + "\n"
|
||||
+ current
|
||||
+ NameConst.i18n(NameConst.TT_SHIFT_FOR_MORE),
|
||||
(int) Math.floor(xSize * 0.8)));
|
||||
}
|
||||
this.textField.drawTextBox();
|
||||
}
|
||||
|
||||
public void setTooltip(String message) {
|
||||
this.textField.setMessage(message);
|
||||
}
|
||||
|
||||
public void validate() {
|
||||
final double result = Calculator.conversion(this.textField.getText());
|
||||
if (Double.isNaN(result)) {
|
||||
this.amount = null;
|
||||
this.textField.setTextColor(0xFF0000);
|
||||
} else {
|
||||
this.amount = (long) ArithHelper.round(result, 0);
|
||||
this.textField.setTextColor(0xFFFFFF);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Long getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,24 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.client.gui.container.ContainerLevelWireless;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
|
||||
public class GuiLevelWireless extends GuiLevelTerminal {
|
||||
|
||||
public GuiLevelWireless(final InventoryPlayer inventoryPlayer, final IWirelessTerminal te) {
|
||||
super(inventoryPlayer, new ContainerLevelWireless(inventoryPlayer, te));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void repositionSlots() {
|
||||
for (final Object obj : this.inventorySlots.inventorySlots) {
|
||||
if (obj instanceof final AppEngSlot slot) {
|
||||
slot.yDisplayPosition = this.ySize + slot.getY() - 78 - 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerOCPatternEditor;
|
||||
import com.glodblock.github.common.tile.TileOCPatternEditor;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class GuiOCPatternEditor extends AEBaseGui {
|
||||
|
||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/oc_pattern_editor.png");
|
||||
|
||||
public GuiOCPatternEditor(InventoryPlayer ipl, TileOCPatternEditor tile) {
|
||||
super(new ContainerOCPatternEditor(ipl, tile));
|
||||
this.ySize = 186;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
mc.getTextureManager().bindTexture(TEX_BG);
|
||||
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_OC_PATTERN_EDITOR)), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
|
||||
import com.glodblock.github.common.parts.PartFluidTerminal;
|
||||
import com.glodblock.github.common.parts.PartLevelTerminal;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
|
||||
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
|
||||
import com.glodblock.github.network.SPacketPatternItemRenamer;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
|
||||
public class GuiPatternItemRenamer extends appeng.client.gui.implementations.GuiPatternItemRenamer {
|
||||
|
||||
private GuiType originalGui;
|
||||
|
||||
public GuiPatternItemRenamer(InventoryPlayer ip, ITerminalHost p) {
|
||||
super(ip, p);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setOriginGUI(Object target) {
|
||||
if (target instanceof PartFluidPatternTerminal) {
|
||||
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
|
||||
} else if (target instanceof PartFluidPatternTerminalEx) {
|
||||
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
|
||||
} else if (target instanceof PartFluidTerminal) {
|
||||
this.originalGui = GuiType.FLUID_TERMINAL;
|
||||
} else if (target instanceof PartLevelTerminal) {
|
||||
originalGui = GuiType.LEVEL_TERMINAL;
|
||||
} else if (target instanceof IWirelessTerminal terminal && terminal.isUniversal(target)) {
|
||||
this.originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
|
||||
} else if (target instanceof WirelessPatternTerminalInventory) {
|
||||
this.originalGui = GuiType.FLUID_TERMINAL;
|
||||
} else if (target instanceof WirelessLevelTerminalInventory) {
|
||||
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(final char character, final int key) {
|
||||
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
|
||||
FluidCraft.proxy.netHandler
|
||||
.sendToServer(new SPacketPatternItemRenamer(originalGui, getText(), getValueIndex()));
|
||||
} else super.keyTyped(character, key);
|
||||
}
|
||||
}
|
||||
@@ -1,154 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
|
||||
import com.glodblock.github.common.parts.PartFluidTerminal;
|
||||
import com.glodblock.github.common.parts.PartLevelTerminal;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
|
||||
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.network.CPacketPatternMultiSet;
|
||||
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.implementations.GuiAmount;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.container.implementations.ContainerPatternMulti;
|
||||
import appeng.core.localization.GuiColors;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.util.calculators.ArithHelper;
|
||||
import appeng.util.calculators.Calculator;
|
||||
|
||||
public class GuiPatternMulti extends GuiAmount {
|
||||
|
||||
private static final int DEFAULT_VALUE = 0;
|
||||
private GuiImgButton symbolSwitch;
|
||||
protected GuiType originalGui;
|
||||
|
||||
@Reflected
|
||||
public GuiPatternMulti(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||
super(new ContainerPatternMulti(inventoryPlayer, te));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
this.buttonList.add(
|
||||
this.symbolSwitch = new GuiImgButton(
|
||||
this.guiLeft + 22,
|
||||
this.guiTop + 53,
|
||||
Settings.ACTIONS,
|
||||
ActionItems.MULTIPLY));
|
||||
|
||||
this.amountTextField.x = this.guiLeft + 48;
|
||||
this.amountTextField.w = 73;
|
||||
this.amountTextField.setText(String.valueOf(DEFAULT_VALUE));
|
||||
this.amountTextField.setCursorPositionEnd();
|
||||
this.amountTextField.setSelectionPos(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.fontRendererObj
|
||||
.drawString(GuiText.SelectAmount.getLocal(), 8, 6, GuiColors.CraftAmountSelectAmount.getColor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
super.drawBG(offsetX, offsetY, mouseX, mouseY);
|
||||
this.nextBtn.displayString = GuiText.Set.getLocal();
|
||||
|
||||
try {
|
||||
int resultI = getAmount();
|
||||
|
||||
this.symbolSwitch.set(resultI >= 0 ? ActionItems.MULTIPLY : ActionItems.DIVIDE);
|
||||
this.nextBtn.enabled = resultI < -1 || resultI > 1;
|
||||
} catch (final NumberFormatException e) {
|
||||
this.nextBtn.enabled = false;
|
||||
}
|
||||
|
||||
this.amountTextField.drawTextBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
|
||||
try {
|
||||
|
||||
if (btn == this.nextBtn && btn.enabled) {
|
||||
int resultI = getAmount();
|
||||
if (resultI > 1 || resultI < -1)
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketPatternMultiSet(this.originalGui, resultI));
|
||||
}
|
||||
} catch (final NumberFormatException e) {
|
||||
// nope..
|
||||
this.amountTextField.setText(String.valueOf(DEFAULT_VALUE));
|
||||
}
|
||||
|
||||
if (btn == this.symbolSwitch) {
|
||||
int resultI = -getAmount();
|
||||
this.amountTextField.setText(Integer.toString(resultI));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getAmount() {
|
||||
String out = this.amountTextField.getText();
|
||||
|
||||
double resultD = Calculator.conversion(out);
|
||||
|
||||
if (Double.isNaN(resultD)) {
|
||||
return DEFAULT_VALUE;
|
||||
} else {
|
||||
return (int) ArithHelper.round(resultD, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected long addOrderAmount(final int i) {
|
||||
return i + getAmount();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBackground() {
|
||||
return "guis/patternMulti.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setOriginGUI(Object target) {
|
||||
if (target instanceof PartFluidPatternTerminal) {
|
||||
this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL.stack();
|
||||
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
|
||||
} else if (target instanceof PartFluidPatternTerminalEx) {
|
||||
this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL_EX.stack();
|
||||
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
|
||||
} else if (target instanceof PartFluidTerminal) {
|
||||
this.myIcon = ItemAndBlockHolder.FLUID_TERM.stack();
|
||||
this.originalGui = GuiType.FLUID_TERMINAL;
|
||||
} else if (target instanceof PartLevelTerminal) {
|
||||
myIcon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
|
||||
originalGui = GuiType.LEVEL_TERMINAL;
|
||||
} else if (target instanceof IWirelessTerminal terminal && terminal.isUniversal(target)) {
|
||||
this.myIcon = ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack();
|
||||
this.originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
|
||||
} else if (target instanceof WirelessPatternTerminalInventory) {
|
||||
this.myIcon = ItemAndBlockHolder.WIRELESS_PATTERN_TERM.stack();
|
||||
this.originalGui = GuiType.FLUID_TERMINAL;
|
||||
} else if (target instanceof WirelessLevelTerminalInventory) {
|
||||
myIcon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
|
||||
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,92 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.base.FCGuiAmount;
|
||||
import com.glodblock.github.client.gui.container.ContainerPatternValueAmount;
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.network.CPacketPatternValueSet;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class GuiPatternValueAmount extends FCGuiAmount {
|
||||
|
||||
public GuiPatternValueAmount(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||
super(new ContainerPatternValueAmount(inventoryPlayer, te));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.submit.displayString = GuiText.Set.getLocal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.fontRendererObj.drawString(GuiText.SelectAmount.getLocal(), 8, 6, 0x404040);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
super.drawBG(offsetX, offsetY, mouseX, mouseY);
|
||||
try {
|
||||
int result = getAmount();
|
||||
this.submit.enabled = result > 0;
|
||||
} catch (final NumberFormatException e) {
|
||||
this.submit.enabled = false;
|
||||
}
|
||||
this.amountBox.drawTextBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
try {
|
||||
if (btn == this.submit && btn.enabled) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketPatternValueSet(
|
||||
originalGui.ordinal(),
|
||||
getAmount(),
|
||||
((ContainerPatternValueAmount) this.inventorySlots).getValueIndex()));
|
||||
}
|
||||
} catch (final NumberFormatException e) {
|
||||
this.amountBox.setText("1");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setOriginGUI(Object target) {
|
||||
if (target instanceof PartFluidPatternTerminal) {
|
||||
this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL.stack();
|
||||
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
|
||||
} else if (target instanceof PartFluidPatternTerminalEx) {
|
||||
this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL_EX.stack();
|
||||
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
|
||||
} else if (target instanceof IWirelessTerminal terminal && terminal.isUniversal(target)) {
|
||||
this.myIcon = ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack();
|
||||
this.originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
|
||||
} else if (target instanceof WirelessPatternTerminalInventory) {
|
||||
this.myIcon = ItemAndBlockHolder.WIRELESS_PATTERN_TERM.stack();
|
||||
this.originalGui = GuiType.WIRELESS_FLUID_PATTERN_TERMINAL;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBackground() {
|
||||
return "guis/craftAmt.png";
|
||||
}
|
||||
|
||||
public void setAmount(int amount) {
|
||||
this.amountBox.setText(String.valueOf(amount));
|
||||
this.amountBox.setSelectionPos(0);
|
||||
}
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerRenamer;
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
import com.glodblock.github.common.parts.PartLevelTerminal;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.inventory.item.WirelessInterfaceTerminalInventory;
|
||||
import com.glodblock.github.inventory.item.WirelessLevelTerminalInventory;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.network.CPacketRenamer;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.client.gui.widgets.IDropToFillTextField;
|
||||
import appeng.client.gui.widgets.MEGuiTextField;
|
||||
import appeng.core.localization.GuiColors;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class GuiRenamer extends AEBaseGui implements IDropToFillTextField {
|
||||
|
||||
protected final MEGuiTextField textField;
|
||||
|
||||
protected final ITerminalHost host;
|
||||
protected GuiTabButton originalGuiBtn;
|
||||
|
||||
protected ItemStack icon = null;
|
||||
|
||||
protected GuiType originalGui;
|
||||
|
||||
public GuiRenamer(InventoryPlayer ip, ITerminalHost monitorable) {
|
||||
super(new ContainerRenamer(ip, monitorable));
|
||||
this.host = monitorable;
|
||||
this.xSize = 256;
|
||||
|
||||
this.textField = new MEGuiTextField(230, 12);
|
||||
this.textField.setMaxStringLength(32);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketRenamer(CPacketRenamer.Action.GET_TEXT));
|
||||
if (host instanceof PartLevelTerminal) {
|
||||
icon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
|
||||
originalGui = GuiType.LEVEL_TERMINAL;
|
||||
} else if (host instanceof IWirelessTerminal terminal && terminal.isUniversal(host)) {
|
||||
icon = ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack();
|
||||
originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
|
||||
} else if (host instanceof WirelessLevelTerminalInventory) {
|
||||
icon = ItemAndBlockHolder.WIRELESS_LEVEL_TERM.stack();
|
||||
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
|
||||
} else if (host instanceof WirelessInterfaceTerminalInventory) {
|
||||
icon = ItemAndBlockHolder.WIRELESS_INTERFACE_TERM.stack();
|
||||
originalGui = GuiType.WIRELESS_INTERFACE_TERMINAL;
|
||||
}
|
||||
if (this.icon != null) {
|
||||
this.buttonList.add(
|
||||
this.originalGuiBtn = new GuiTabButton(
|
||||
this.guiLeft + 231,
|
||||
this.guiTop - 4,
|
||||
this.icon,
|
||||
this.icon.getDisplayName(),
|
||||
itemRender));
|
||||
this.originalGuiBtn.setHideEdge(13);
|
||||
}
|
||||
this.textField.x = this.guiLeft + 12;
|
||||
this.textField.y = this.guiTop + 35;
|
||||
this.textField.setFocused(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
this.fontRendererObj.drawString(GuiText.Renamer.getLocal(), 12, 8, GuiColors.RenamerTitle.getColor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
this.bindTexture("guis/renamer.png");
|
||||
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
|
||||
this.textField.drawTextBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
|
||||
this.textField.mouseClicked(xCoord, yCoord, btn);
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(final char character, final int key) {
|
||||
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketRenamer(this.textField.getText()));
|
||||
} else if (!this.textField.textboxKeyTyped(character, key)) {
|
||||
super.keyTyped(character, key);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isOverTextField(final int mousex, final int mousey) {
|
||||
return textField.isMouseIn(mousex, mousey);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
if (button == originalGuiBtn) {
|
||||
switchGui();
|
||||
} else {
|
||||
super.actionPerformed(button);
|
||||
}
|
||||
}
|
||||
|
||||
public void switchGui() {
|
||||
if (originalGui != null) {
|
||||
InventoryHandler.switchGui(originalGui);
|
||||
}
|
||||
}
|
||||
|
||||
public void setTextFieldValue(final String displayName, final int mousex, final int mousey, final ItemStack stack) {
|
||||
textField.setText(displayName);
|
||||
}
|
||||
|
||||
public void postUpdate(String text) {
|
||||
this.textField.setText(text);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
public interface ITankDump {
|
||||
|
||||
boolean canDumpTank(int index);
|
||||
|
||||
void dumpTank(int index);
|
||||
}
|
||||
@@ -1,178 +0,0 @@
|
||||
package com.glodblock.github.client.gui.base;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
|
||||
import com.glodblock.github.client.gui.GuiEssentiaTerminal;
|
||||
import com.glodblock.github.client.gui.GuiFCImgButton;
|
||||
import com.glodblock.github.client.gui.GuiFluidCraftingWireless;
|
||||
import com.glodblock.github.client.gui.GuiFluidPatternExWireless;
|
||||
import com.glodblock.github.client.gui.GuiFluidPatternWireless;
|
||||
import com.glodblock.github.client.gui.GuiFluidPortableCell;
|
||||
import com.glodblock.github.client.gui.GuiLevelWireless;
|
||||
import com.glodblock.github.client.gui.container.base.FCBaseContainer;
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
import appeng.client.gui.AEBaseMEGui;
|
||||
|
||||
public abstract class FCBaseMEGui extends AEBaseMEGui {
|
||||
|
||||
protected GuiFCImgButton FluidTerminal;
|
||||
protected GuiFCImgButton CraftingTerminal;
|
||||
protected GuiFCImgButton PatternTerminal;
|
||||
protected GuiFCImgButton EssentiaTerminal;
|
||||
protected GuiFCImgButton InterfaceTerminal;
|
||||
protected GuiFCImgButton LevelTerminal;
|
||||
protected GuiFCImgButton PatternTerminalEx;
|
||||
protected List<GuiFCImgButton> termBtns = new ArrayList<>();
|
||||
protected boolean drawSwitchGuiBtn;
|
||||
|
||||
public FCBaseMEGui(final InventoryPlayer inventoryPlayer, Container container) {
|
||||
super(container);
|
||||
if (container instanceof FCBaseContainer) {
|
||||
Object target = ((FCBaseContainer) container).getTarget();
|
||||
if (target instanceof IWirelessTerminal
|
||||
&& ((IWirelessTerminal) target).getItemStack().getItem() instanceof ItemWirelessUltraTerminal) {
|
||||
this.drawSwitchGuiBtn = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuiClosed() {
|
||||
super.onGuiClosed();
|
||||
}
|
||||
|
||||
protected void initGuiDone() {
|
||||
if (drawSwitchGuiBtn) {
|
||||
drawSwitchGuiBtns();
|
||||
}
|
||||
}
|
||||
|
||||
public abstract int getOffsetY();
|
||||
|
||||
public abstract void setOffsetY(int y);
|
||||
|
||||
protected void drawSwitchGuiBtns() {
|
||||
if (!drawSwitchGuiBtn) return;
|
||||
if (!termBtns.isEmpty()) {
|
||||
this.termBtns.clear();
|
||||
}
|
||||
if (!(this instanceof GuiFluidCraftingWireless)) {
|
||||
this.buttonList.add(
|
||||
this.CraftingTerminal = new GuiFCImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.getOffsetY(),
|
||||
"CRAFT_TEM",
|
||||
"YES"));
|
||||
this.setOffsetY(this.getOffsetY() + 20);
|
||||
termBtns.add(this.CraftingTerminal);
|
||||
}
|
||||
if (!(this instanceof GuiFluidPatternWireless)) {
|
||||
this.buttonList.add(
|
||||
this.PatternTerminal = new GuiFCImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.getOffsetY(),
|
||||
"PATTERN_TEM",
|
||||
"YES"));
|
||||
this.setOffsetY(this.getOffsetY() + 20);
|
||||
termBtns.add(this.PatternTerminal);
|
||||
}
|
||||
if (!(this instanceof GuiFluidPatternExWireless)) {
|
||||
this.buttonList.add(
|
||||
this.PatternTerminalEx = new GuiFCImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.getOffsetY(),
|
||||
"PATTERN_EX_TEM",
|
||||
"YES"));
|
||||
this.setOffsetY(this.getOffsetY() + 20);
|
||||
termBtns.add(this.PatternTerminalEx);
|
||||
}
|
||||
if (!(this instanceof GuiFluidPortableCell)) {
|
||||
this.buttonList.add(
|
||||
this.FluidTerminal = new GuiFCImgButton(this.guiLeft - 18, this.getOffsetY(), "FLUID_TEM", "YES"));
|
||||
this.setOffsetY(this.getOffsetY() + 20);
|
||||
termBtns.add(this.FluidTerminal);
|
||||
}
|
||||
this.buttonList.add(
|
||||
this.InterfaceTerminal = new GuiFCImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.getOffsetY(),
|
||||
"INTERFACE_TEM",
|
||||
"YES"));
|
||||
this.setOffsetY(this.getOffsetY() + 20);
|
||||
termBtns.add(this.InterfaceTerminal);
|
||||
if (!(this instanceof GuiLevelWireless)) {
|
||||
this.buttonList.add(
|
||||
this.LevelTerminal = new GuiFCImgButton(this.guiLeft - 18, this.getOffsetY(), "LEVEL_TEM", "YES"));
|
||||
this.setOffsetY(this.getOffsetY() + 20);
|
||||
termBtns.add(this.LevelTerminal);
|
||||
}
|
||||
if (ModAndClassUtil.ThE && !(this instanceof GuiEssentiaTerminal)) {
|
||||
this.buttonList.add(
|
||||
this.EssentiaTerminal = new GuiFCImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.getOffsetY(),
|
||||
"ESSENTIA_TEM",
|
||||
"YES"));
|
||||
this.setOffsetY(this.getOffsetY() + 20);
|
||||
termBtns.add(this.EssentiaTerminal);
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
if (btn == this.FluidTerminal) {
|
||||
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_FLUID_TERMINAL);
|
||||
} else if (btn == this.CraftingTerminal) {
|
||||
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_CRAFTING_TERMINAL);
|
||||
} else if (btn == this.EssentiaTerminal) {
|
||||
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_ESSENTIA_TERMINAL);
|
||||
} else if (btn == this.PatternTerminal) {
|
||||
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_FLUID_PATTERN_TERMINAL);
|
||||
} else if (btn == this.InterfaceTerminal) {
|
||||
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_INTERFACE_TERMINAL);
|
||||
} else if (btn == this.LevelTerminal) {
|
||||
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_LEVEL_TERMINAL);
|
||||
} else if (btn == this.PatternTerminalEx) {
|
||||
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_FLUID_PATTERN_TERMINAL_EX);
|
||||
}
|
||||
}
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
}
|
||||
@@ -1,157 +0,0 @@
|
||||
package com.glodblock.github.client.gui.base;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.util.calculators.ArithHelper;
|
||||
import appeng.util.calculators.Calculator;
|
||||
|
||||
public abstract class FCGuiAmount extends AEBaseGui {
|
||||
|
||||
protected GuiTextField amountBox;
|
||||
protected GuiTabButton originalGuiBtn;
|
||||
protected GuiButton submit;
|
||||
protected GuiButton plus1;
|
||||
protected GuiButton plus10;
|
||||
protected GuiButton plus100;
|
||||
protected GuiButton plus1000;
|
||||
protected GuiButton minus1;
|
||||
protected GuiButton minus10;
|
||||
protected GuiButton minus100;
|
||||
protected GuiButton minus1000;
|
||||
protected GuiType originalGui;
|
||||
protected ItemStack myIcon;
|
||||
|
||||
public FCGuiAmount(Container container) {
|
||||
super(container);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
final int a = getIncrementQuantity(0);
|
||||
final int b = getIncrementQuantity(1);
|
||||
final int c = getIncrementQuantity(2);
|
||||
final int d = getIncrementQuantity(3);
|
||||
|
||||
this.buttonList.add(this.plus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 26, 22, 20, "+" + a));
|
||||
this.buttonList.add(this.plus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 26, 28, 20, "+" + b));
|
||||
this.buttonList.add(this.plus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 26, 32, 20, "+" + c));
|
||||
this.buttonList.add(this.plus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 26, 38, 20, "+" + d));
|
||||
|
||||
this.buttonList.add(this.minus1 = new GuiButton(0, this.guiLeft + 20, this.guiTop + 75, 22, 20, "-" + a));
|
||||
this.buttonList.add(this.minus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 75, 28, 20, "-" + b));
|
||||
this.buttonList.add(this.minus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 75, 32, 20, "-" + c));
|
||||
this.buttonList.add(this.minus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 75, 38, 20, "-" + d));
|
||||
|
||||
this.buttonList.add(
|
||||
this.submit = new GuiButton(0, this.guiLeft + 128, this.guiTop + 51, 38, 20, GuiText.Next.getLocal()));
|
||||
|
||||
setOriginGUI(((AEBaseContainer) this.inventorySlots).getTarget());
|
||||
if (this.originalGui != null && this.myIcon != null) {
|
||||
this.buttonList.add(
|
||||
this.originalGuiBtn = new GuiTabButton(
|
||||
this.guiLeft + 151,
|
||||
this.guiTop - 4,
|
||||
this.myIcon,
|
||||
this.myIcon.getDisplayName(),
|
||||
itemRender));
|
||||
this.originalGuiBtn.setHideEdge(13);
|
||||
}
|
||||
|
||||
this.amountBox = new GuiTextField(
|
||||
this.fontRendererObj,
|
||||
this.guiLeft + 62,
|
||||
this.guiTop + 57,
|
||||
59,
|
||||
this.fontRendererObj.FONT_HEIGHT);
|
||||
this.amountBox.setEnableBackgroundDrawing(false);
|
||||
this.amountBox.setMaxStringLength(16);
|
||||
this.amountBox.setTextColor(0xFFFFFF);
|
||||
this.amountBox.setVisible(true);
|
||||
this.amountBox.setFocused(true);
|
||||
}
|
||||
|
||||
protected int getIncrementQuantity(int i) {
|
||||
return AEConfig.instance.craftItemsByStackAmounts(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.bindTexture(getBackground());
|
||||
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(final char character, final int key) {
|
||||
if (!this.checkHotbarKeys(key)) {
|
||||
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
|
||||
this.actionPerformed(this.submit);
|
||||
}
|
||||
this.amountBox.textboxKeyTyped(character, key);
|
||||
super.keyTyped(character, key);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
if (btn == this.originalGuiBtn) {
|
||||
InventoryHandler.switchGui(originalGui);
|
||||
}
|
||||
final boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
|
||||
final boolean isMinus = btn == this.minus1 || btn == this.minus10
|
||||
|| btn == this.minus100
|
||||
|| btn == this.minus1000;
|
||||
|
||||
if (isPlus || isMinus) {
|
||||
this.addQty(this.getQty(btn));
|
||||
}
|
||||
}
|
||||
|
||||
protected void addQty(final int i) {
|
||||
try {
|
||||
long resultI = getAmount();
|
||||
if (resultI == 1 && i > 1) {
|
||||
resultI = 0;
|
||||
}
|
||||
resultI += i;
|
||||
if (resultI < 1) {
|
||||
resultI = 1;
|
||||
}
|
||||
String out = Long.toString(resultI);
|
||||
this.amountBox.setText(out);
|
||||
} catch (final NumberFormatException ignore) {}
|
||||
}
|
||||
|
||||
protected abstract void setOriginGUI(Object target);
|
||||
|
||||
protected abstract String getBackground();
|
||||
|
||||
protected int getAmount() {
|
||||
try {
|
||||
String out = this.amountBox.getText();
|
||||
double result = Calculator.conversion(out);
|
||||
if (result <= 0 || Double.isNaN(result)) {
|
||||
return 0;
|
||||
} else {
|
||||
return (int) ArithHelper.round(result, 0);
|
||||
}
|
||||
} catch (final NumberFormatException e) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,199 +0,0 @@
|
||||
package com.glodblock.github.client.gui.base;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.GuiFCImgButton;
|
||||
import com.glodblock.github.client.gui.GuiItemMonitor;
|
||||
import com.glodblock.github.client.gui.container.base.FCContainerEncodeTerminal;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.slot.SlotSingleItem;
|
||||
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.container.slot.SlotFake;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
public abstract class FCGuiEncodeTerminal extends GuiItemMonitor {
|
||||
|
||||
private static final String SUBSTITUTION_DISABLE = "0";
|
||||
private static final String SUBSTITUTION_ENABLE = "1";
|
||||
private static final String PRIORITY_DISABLE = "0";
|
||||
private static final String PRIORITY_ENABLE = "1";
|
||||
private static final String MODE_CRAFTING = "1";
|
||||
private static final String MODE_PROCESSING = "0";
|
||||
public FCContainerEncodeTerminal container;
|
||||
protected GuiTabButton tabCraftButton;
|
||||
protected GuiTabButton tabProcessButton;
|
||||
protected GuiImgButton substitutionsEnabledBtn;
|
||||
protected GuiImgButton substitutionsDisabledBtn;
|
||||
protected GuiFCImgButton fluidPrioritizedEnabledBtn;
|
||||
protected GuiFCImgButton fluidPrioritizedDisabledBtn;
|
||||
protected GuiImgButton encodeBtn;
|
||||
protected GuiImgButton invertBtn;
|
||||
protected GuiImgButton clearBtn;
|
||||
protected GuiImgButton doubleBtn;
|
||||
protected GuiImgButton beSubstitutionsEnabledBtn;
|
||||
protected GuiImgButton beSubstitutionsDisabledBtn;
|
||||
protected GuiFCImgButton combineEnableBtn;
|
||||
protected GuiFCImgButton combineDisableBtn;
|
||||
protected GuiFCImgButton autoFillPatternEnableBtn;
|
||||
protected GuiFCImgButton autoFillPatternDisableBtn;
|
||||
protected final GuiScrollbar processingScrollBar = new GuiScrollbar();
|
||||
|
||||
public FCGuiEncodeTerminal(final InventoryPlayer inventoryPlayer, final ITerminalHost te,
|
||||
final FCContainerEncodeTerminal c) {
|
||||
super(inventoryPlayer, te, c);
|
||||
this.container = (FCContainerEncodeTerminal) this.inventorySlots;
|
||||
c.setGui(this);
|
||||
setReservedSpace(81);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.buttonList.add(
|
||||
this.autoFillPatternEnableBtn = new GuiFCImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.offsetY,
|
||||
"FILL_PATTERN",
|
||||
"DO_FILL"));
|
||||
this.buttonList.add(
|
||||
this.autoFillPatternDisableBtn = new GuiFCImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.offsetY,
|
||||
"NOT_FILL_PATTERN",
|
||||
"DONT_FILL"));
|
||||
this.offsetY += 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
if (btn == craftingStatusBtn) {
|
||||
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
|
||||
} else if (this.tabCraftButton == btn || this.tabProcessButton == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns(
|
||||
"PatternTerminal.CraftMode",
|
||||
this.tabProcessButton == btn ? MODE_CRAFTING : MODE_PROCESSING));
|
||||
} else if (this.encodeBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns(
|
||||
"PatternTerminal.Encode",
|
||||
(isCtrlKeyDown() ? 1 : 0) << 1 | (isShiftKeyDown() ? 1 : 0)));
|
||||
} else if (this.clearBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.Clear", "1"));
|
||||
} else if (this.substitutionsEnabledBtn == btn || this.substitutionsDisabledBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns(
|
||||
"PatternTerminal.Substitute",
|
||||
this.substitutionsEnabledBtn == btn ? SUBSTITUTION_DISABLE : SUBSTITUTION_ENABLE));
|
||||
} else if (this.fluidPrioritizedEnabledBtn == btn || this.fluidPrioritizedDisabledBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns(
|
||||
"PatternTerminal.Prioritize",
|
||||
isShiftKeyDown() ? "2" : (container.prioritize ? PRIORITY_DISABLE : PRIORITY_ENABLE)));
|
||||
} else if (this.invertBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns("PatternTerminal.Invert", container.inverted ? "0" : "1"));
|
||||
} else if (this.combineDisableBtn == btn || this.combineEnableBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns(
|
||||
"PatternTerminal.Combine",
|
||||
this.combineDisableBtn == btn ? "1" : "0"));
|
||||
} else if (ModAndClassUtil.isDoubleButton && doubleBtn == btn) {
|
||||
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"));
|
||||
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsEnabledBtn == btn) {
|
||||
FluidCraft.proxy.netHandler
|
||||
.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "0"));
|
||||
} else if (this.autoFillPatternDisableBtn == btn || this.autoFillPatternEnableBtn == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns(
|
||||
"PatternTerminal.AutoFillerPattern",
|
||||
this.autoFillPatternDisableBtn == btn ? "1" : "0"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
updateButton(this.tabCraftButton, this.container.isCraftingMode());
|
||||
updateButton(this.tabProcessButton, !this.container.isCraftingMode());
|
||||
updateButton(this.doubleBtn, !this.container.isCraftingMode());
|
||||
updateButton(this.substitutionsEnabledBtn, this.container.substitute);
|
||||
updateButton(this.substitutionsDisabledBtn, !this.container.substitute);
|
||||
updateButton(this.combineEnableBtn, !this.container.isCraftingMode() && this.container.combine);
|
||||
updateButton(this.combineDisableBtn, !this.container.isCraftingMode() && !this.container.combine);
|
||||
updateButton(this.beSubstitutionsEnabledBtn, this.container.beSubstitute);
|
||||
updateButton(this.beSubstitutionsDisabledBtn, !this.container.beSubstitute);
|
||||
updateButton(this.fluidPrioritizedEnabledBtn, this.container.prioritize);
|
||||
updateButton(this.fluidPrioritizedDisabledBtn, !this.container.prioritize);
|
||||
updateButton(this.autoFillPatternEnableBtn, this.container.autoFillPattern);
|
||||
updateButton(this.autoFillPatternDisableBtn, !this.container.autoFillPattern);
|
||||
super.drawFG(offsetX, offsetY, mouseX, mouseY);
|
||||
}
|
||||
|
||||
protected void updateButton(GuiButton button, boolean vis) {
|
||||
if (button != null) {
|
||||
button.visible = vis;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void repositionSlot(final AppEngSlot s) {
|
||||
if (s.isPlayerSide()) {
|
||||
s.yDisplayPosition = s.getY() + this.ySize - 78 - 5;
|
||||
} else {
|
||||
s.yDisplayPosition = s.getY() + this.ySize - 78 - 3;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_146977_a(final Slot s) {
|
||||
if (drawSlot0(s)) super.func_146977_a(s);
|
||||
}
|
||||
|
||||
public boolean drawSlot0(Slot slot) {
|
||||
if (slot instanceof SlotFake && !this.container.isCraftingMode()) {
|
||||
AEItemStack stack = AEItemStack.create(slot.getStack());
|
||||
super.func_146977_a(new SlotSingleItem(slot));
|
||||
if (stack == null) return true;
|
||||
IAEItemStack fake = stack.copy();
|
||||
if (fake.getItemStack().getItem() instanceof ItemFluidPacket) {
|
||||
if (ItemFluidPacket.getFluidStack(stack) != null && ItemFluidPacket.getFluidStack(stack).amount > 0)
|
||||
fake.setStackSize(ItemFluidPacket.getFluidStack(stack).amount);
|
||||
} else return true;
|
||||
aeRenderItem.setAeStack(fake);
|
||||
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
|
||||
aeRenderItem.renderItemOverlayIntoGUI(
|
||||
fontRendererObj,
|
||||
mc.getTextureManager(),
|
||||
stack.getItemStack(),
|
||||
slot.xDisplayPosition,
|
||||
slot.yDisplayPosition);
|
||||
GL11.glTranslatef(0.0f, 0.0f, -200.0f);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,789 +0,0 @@
|
||||
package com.glodblock.github.client.gui.base;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.FCGuiTextField;
|
||||
import com.glodblock.github.client.gui.GuiItemMonitor;
|
||||
import com.glodblock.github.client.gui.container.base.FCContainerMonitor;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.network.CPacketInventoryAction;
|
||||
import com.glodblock.github.util.Ae2ReflectClient;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
import appeng.api.config.CraftingStatus;
|
||||
import appeng.api.config.SearchBoxMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.TerminalStyle;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.implementations.tiles.IViewCellStorage;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IDisplayRepo;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigurableObject;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.client.gui.widgets.IDropToFillTextField;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.client.me.InternalSlotME;
|
||||
import appeng.client.me.SlotDisconnected;
|
||||
import appeng.client.me.SlotME;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.container.slot.OptionalSlotFake;
|
||||
import appeng.container.slot.SlotCraftingMatrix;
|
||||
import appeng.container.slot.SlotCraftingTerm;
|
||||
import appeng.container.slot.SlotDisabled;
|
||||
import appeng.container.slot.SlotFake;
|
||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||
import appeng.container.slot.SlotPatternTerm;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketInventoryAction;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import codechicken.nei.LayoutManager;
|
||||
import codechicken.nei.util.TextHistory;
|
||||
|
||||
// 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 {
|
||||
|
||||
public static int craftingGridOffsetX;
|
||||
public static int craftingGridOffsetY;
|
||||
protected static String memoryText = "";
|
||||
protected final int offsetX = 9;
|
||||
protected final int lowerTextureOffset = 0;
|
||||
public IConfigManager configSrc;
|
||||
protected final boolean viewCell;
|
||||
protected final ItemStack[] myCurrentViewCells = new ItemStack[5];
|
||||
public FCContainerMonitor<T> monitorableContainer;
|
||||
public GuiTabButton craftingStatusBtn;
|
||||
protected IDisplayRepo repo;
|
||||
protected GuiImgButton craftingStatusImgBtn;
|
||||
protected FCGuiTextField searchField;
|
||||
protected int perRow = 9;
|
||||
protected int reservedSpace = 0;
|
||||
protected boolean customSortOrder = true;
|
||||
protected boolean showViewBtn = true;
|
||||
protected int rows = 0;
|
||||
protected int maxRows = Integer.MAX_VALUE;
|
||||
protected int standardSize;
|
||||
protected int offsetY;
|
||||
protected GuiImgButton ViewBox;
|
||||
protected GuiImgButton SortByBox;
|
||||
protected GuiImgButton SortDirBox;
|
||||
protected GuiImgButton searchBoxSettings;
|
||||
protected GuiImgButton terminalStyleBox;
|
||||
protected GuiImgButton searchStringSave;
|
||||
protected GuiImgButton typeFilter;
|
||||
protected boolean hasShiftKeyDown = false;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public FCGuiMonitor(final InventoryPlayer inventoryPlayer, final ITerminalHost te, final FCContainerMonitor<T> c) {
|
||||
super(inventoryPlayer, c);
|
||||
final GuiScrollbar scrollbar = new GuiScrollbar();
|
||||
this.setScrollBar(scrollbar);
|
||||
this.xSize = 195;
|
||||
this.ySize = 204;
|
||||
this.standardSize = this.xSize;
|
||||
this.configSrc = ((IConfigurableObject) this.inventorySlots).getConfigManager();
|
||||
(this.monitorableContainer = (FCContainerMonitor<T>) this.inventorySlots).setGui(this);
|
||||
this.viewCell = te instanceof IViewCellStorage;
|
||||
}
|
||||
|
||||
public int getOffsetY() {
|
||||
return offsetY;
|
||||
}
|
||||
|
||||
public void setOffsetY(int y) {
|
||||
offsetY = y;
|
||||
}
|
||||
|
||||
public abstract void postUpdate(final List<T> list, boolean resort);
|
||||
|
||||
protected void setScrollBar() {
|
||||
this.getScrollBar().setTop(18).setLeft(175).setHeight(this.rows * 18 - 2);
|
||||
this.getScrollBar().setRange(
|
||||
0,
|
||||
(this.repo.size() + this.perRow - 1) / this.perRow - this.rows,
|
||||
Math.max(1, this.rows / 6));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (btn == this.craftingStatusBtn || btn == this.craftingStatusImgBtn) {
|
||||
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
|
||||
}
|
||||
if (btn instanceof final GuiImgButton iBtn) {
|
||||
final boolean backwards = Mouse.isButtonDown(1);
|
||||
if (iBtn.getSetting() != Settings.ACTIONS) {
|
||||
final Enum<?> cv = iBtn.getCurrentValue();
|
||||
final Enum<?> next = Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
|
||||
if (btn == this.terminalStyleBox) {
|
||||
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
|
||||
} else if (btn == this.searchBoxSettings) {
|
||||
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
|
||||
} else if (ModAndClassUtil.isSaveText && btn == this.searchStringSave) {
|
||||
AEConfig.instance.preserveSearchBar = next == YesNo.YES;
|
||||
} else {
|
||||
try {
|
||||
NetworkHandler.instance
|
||||
.sendToServer(new PacketValueConfig(iBtn.getSetting().name(), next.name()));
|
||||
} catch (final IOException e) {
|
||||
AELog.debug(e);
|
||||
}
|
||||
}
|
||||
iBtn.set(next);
|
||||
if (next.getClass() == SearchBoxMode.class || next.getClass() == TerminalStyle.class) {
|
||||
memoryText = this.searchField.getText();
|
||||
super.scheduleGuiResize();
|
||||
}
|
||||
}
|
||||
}
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
|
||||
this.maxRows = this.getMaxRows();
|
||||
this.perRow = AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) != TerminalStyle.FULL ? 9
|
||||
: 9 + ((this.width - this.standardSize) / 18);
|
||||
|
||||
final boolean hasNEI = IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.NEI);
|
||||
|
||||
final int NEI = hasNEI ? 1 : 0;
|
||||
int top = hasNEI ? 22 : 0;
|
||||
|
||||
final int magicNumber = 114 + 1;
|
||||
final int extraSpace = this.height - magicNumber - NEI - top - this.reservedSpace;
|
||||
|
||||
this.rows = (int) Math.floor(extraSpace / 18.0);
|
||||
if (this.rows > this.maxRows) {
|
||||
this.rows = this.maxRows;
|
||||
}
|
||||
|
||||
if (hasNEI) {
|
||||
this.rows--;
|
||||
}
|
||||
|
||||
if (this.rows < 3) {
|
||||
this.rows = 3;
|
||||
}
|
||||
|
||||
this.getMeSlots().clear();
|
||||
for (int y = 0; y < this.rows; y++) {
|
||||
for (int x = 0; x < this.perRow; x++) {
|
||||
this.getMeSlots()
|
||||
.add(new InternalSlotME(this.repo, x + y * this.perRow, this.offsetX + x * 18, 18 + y * 18));
|
||||
}
|
||||
}
|
||||
|
||||
if (AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) != TerminalStyle.FULL) {
|
||||
this.xSize = this.standardSize + ((this.perRow - 9) * 18);
|
||||
} else {
|
||||
this.xSize = this.standardSize;
|
||||
}
|
||||
|
||||
super.initGui();
|
||||
this.setScrollBar();
|
||||
// full size : 204
|
||||
// extra slots : 72
|
||||
// slot 18
|
||||
|
||||
this.ySize = magicNumber + this.rows * 18 + this.reservedSpace;
|
||||
final int unusedSpace = this.height - this.ySize;
|
||||
this.guiTop = (int) Math.floor(unusedSpace / (unusedSpace < 0 ? 3.8f : 2.0f));
|
||||
|
||||
this.offsetY = this.guiTop + 8;
|
||||
|
||||
if (this.customSortOrder) {
|
||||
this.buttonList.add(
|
||||
this.SortByBox = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.offsetY,
|
||||
Settings.SORT_BY,
|
||||
this.configSrc.getSetting(Settings.SORT_BY)));
|
||||
this.offsetY += 20;
|
||||
}
|
||||
if (this.showViewBtn) {
|
||||
this.buttonList.add(
|
||||
this.ViewBox = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.offsetY,
|
||||
Settings.VIEW_MODE,
|
||||
this.configSrc.getSetting(Settings.VIEW_MODE)));
|
||||
this.offsetY += 20;
|
||||
}
|
||||
if (ModAndClassUtil.isTypeFilter && this instanceof GuiItemMonitor) {
|
||||
this.buttonList.add(
|
||||
this.typeFilter = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.offsetY,
|
||||
Settings.TYPE_FILTER,
|
||||
this.configSrc.getSetting(Settings.TYPE_FILTER)));
|
||||
this.offsetY += 20;
|
||||
}
|
||||
|
||||
this.buttonList.add(
|
||||
this.SortDirBox = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.offsetY,
|
||||
Settings.SORT_DIRECTION,
|
||||
this.configSrc.getSetting(Settings.SORT_DIRECTION)));
|
||||
this.offsetY += 20;
|
||||
|
||||
this.buttonList.add(
|
||||
this.searchBoxSettings = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.offsetY,
|
||||
Settings.SEARCH_MODE,
|
||||
AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE)));
|
||||
this.offsetY += 20;
|
||||
|
||||
if (ModAndClassUtil.isSaveText) {
|
||||
this.buttonList.add(
|
||||
this.searchStringSave = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.offsetY,
|
||||
Settings.SAVE_SEARCH,
|
||||
AEConfig.instance.preserveSearchBar ? YesNo.YES : YesNo.NO));
|
||||
this.offsetY += 20;
|
||||
}
|
||||
|
||||
this.buttonList.add(
|
||||
this.terminalStyleBox = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.offsetY,
|
||||
Settings.TERMINAL_STYLE,
|
||||
AEConfig.instance.settings.getSetting(Settings.TERMINAL_STYLE)));
|
||||
this.offsetY += 20;
|
||||
|
||||
// Right now 80 > offsetX, but that can be changed later.
|
||||
// noinspection DataFlowIssue
|
||||
this.searchField = new FCGuiTextField(
|
||||
this.fontRendererObj,
|
||||
this.guiLeft + Math.max(80, this.offsetX),
|
||||
this.guiTop + 4,
|
||||
90,
|
||||
12);
|
||||
this.searchField.setEnableBackgroundDrawing(false);
|
||||
this.searchField.setMaxStringLength(25);
|
||||
this.searchField.setTextColor(0xFFFFFF);
|
||||
this.searchField.setVisible(true);
|
||||
if (ModAndClassUtil.isSearchStringTooltip)
|
||||
searchField.setMessage(ButtonToolTips.SearchStringTooltip.getLocal());
|
||||
|
||||
if (this.viewCell) {
|
||||
if (ModAndClassUtil.isCraftStatus && AEConfig.instance.getConfigManager()
|
||||
.getSetting(Settings.CRAFTING_STATUS).equals(CraftingStatus.BUTTON)) {
|
||||
this.buttonList.add(
|
||||
this.craftingStatusImgBtn = new GuiImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.offsetY,
|
||||
Settings.CRAFTING_STATUS,
|
||||
AEConfig.instance.settings.getSetting(Settings.CRAFTING_STATUS)));
|
||||
this.offsetY += 20;
|
||||
} else {
|
||||
this.buttonList.add(
|
||||
this.craftingStatusBtn = new GuiTabButton(
|
||||
this.guiLeft + 170,
|
||||
this.guiTop - 4,
|
||||
2 + 11 * 16,
|
||||
GuiText.CraftingStatus.getLocal(),
|
||||
itemRender));
|
||||
this.craftingStatusBtn.setHideEdge(13); // GuiTabButton implementation //
|
||||
}
|
||||
}
|
||||
|
||||
final Enum<?> setting = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
|
||||
this.searchField.setFocused(SearchBoxMode.AUTOSEARCH == setting || SearchBoxMode.NEI_AUTOSEARCH == setting);
|
||||
|
||||
if (ModAndClassUtil.isSearchBar && (AEConfig.instance.preserveSearchBar || this.isSubGui())) {
|
||||
setSearchString(memoryText, false);
|
||||
}
|
||||
if (this.isSubGui()) {
|
||||
this.repo.updateView();
|
||||
this.setScrollBar();
|
||||
}
|
||||
|
||||
craftingGridOffsetX = Integer.MAX_VALUE;
|
||||
craftingGridOffsetY = Integer.MAX_VALUE;
|
||||
|
||||
for (final Object s : this.inventorySlots.inventorySlots) {
|
||||
if (s instanceof AppEngSlot) {
|
||||
if (((Slot) s).xDisplayPosition < 195 || s instanceof SlotDisabled) {
|
||||
this.repositionSlot((AppEngSlot) s);
|
||||
}
|
||||
}
|
||||
|
||||
if (s instanceof SlotCraftingMatrix || s instanceof SlotFakeCraftingMatrix) {
|
||||
final Slot g = (Slot) s;
|
||||
if (g.xDisplayPosition > 0 && g.yDisplayPosition > 0) {
|
||||
craftingGridOffsetX = Math.min(craftingGridOffsetX, g.xDisplayPosition);
|
||||
craftingGridOffsetY = Math.min(craftingGridOffsetY, g.yDisplayPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
craftingGridOffsetX -= 25;
|
||||
craftingGridOffsetY -= 6;
|
||||
initGuiDone();
|
||||
}
|
||||
|
||||
public void setSearchString(String memoryText, boolean updateView) {
|
||||
this.searchField.setText(memoryText);
|
||||
this.repo.setSearchString(memoryText);
|
||||
if (updateView) {
|
||||
this.repo.updateView();
|
||||
this.setScrollBar();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
|
||||
final Enum<?> searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
|
||||
if (searchMode != SearchBoxMode.AUTOSEARCH && searchMode != SearchBoxMode.NEI_AUTOSEARCH) {
|
||||
this.searchField.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
if (btn == 1 && this.searchField.isMouseIn(xCoord, yCoord)) {
|
||||
setSearchString("", true);
|
||||
}
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleMouseInput() {
|
||||
final int wheel = Mouse.getEventDWheel();
|
||||
final int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
|
||||
final int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight;
|
||||
|
||||
if (wheel != 0 && this.searchField.isMouseIn(x, y) && isCtrlKeyDown()) {
|
||||
final Enum<?> searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
|
||||
if (searchMode == SearchBoxMode.NEI_MANUAL_SEARCH || searchMode == SearchBoxMode.NEI_AUTOSEARCH) {
|
||||
try {
|
||||
Field cls = LayoutManager.searchField.getClass().getDeclaredField("history");
|
||||
cls.setAccessible(true);
|
||||
TextHistory history = ((TextHistory) cls.get("get"));
|
||||
TextHistory.Direction direction;
|
||||
if (wheel > 0) {
|
||||
direction = TextHistory.Direction.PREVIOUS;
|
||||
} else {
|
||||
direction = TextHistory.Direction.NEXT;
|
||||
}
|
||||
history.get(direction, this.searchField.getText()).map(newText -> {
|
||||
setSearchString(newText, true);
|
||||
return true;
|
||||
}).orElse(false);
|
||||
return;
|
||||
} catch (NoSuchFieldException | IllegalAccessException ignore) {}
|
||||
}
|
||||
}
|
||||
super.handleMouseInput();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
|
||||
final EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
if (mouseButton == 3) {
|
||||
if (slot instanceof OptionalSlotFake || slot instanceof SlotFakeCraftingMatrix) {
|
||||
if (slot.getHasStack()) {
|
||||
InventoryAction action = InventoryAction.SET_PATTERN_VALUE;
|
||||
if (isCtrlKeyDown()) {
|
||||
action = InventoryAction.RENAME_PATTERN_ITEM;
|
||||
}
|
||||
IAEItemStack stack = AEItemStack.create(slot.getStack());
|
||||
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
|
||||
for (int i = 0; i < this.inventorySlots.inventorySlots.size(); i++) {
|
||||
if (slot.equals(this.inventorySlots.inventorySlots.get(i))) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketInventoryAction(action, i, 0, stack));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (slot instanceof SlotFake) {
|
||||
InventoryAction action = ctrlDown == 1 ? InventoryAction.SPLIT_OR_PLACE_SINGLE
|
||||
: InventoryAction.PICKUP_OR_SET_DOWN;
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_LMENU) || Keyboard.isKeyDown(Keyboard.KEY_RMENU)) {
|
||||
if (action == InventoryAction.SPLIT_OR_PLACE_SINGLE) {
|
||||
action = InventoryAction.MOVE_REGION;
|
||||
} else {
|
||||
action = InventoryAction.PICKUP_SINGLE;
|
||||
}
|
||||
}
|
||||
if (Ae2ReflectClient.getDragClick(this).size() > 1) {
|
||||
return;
|
||||
}
|
||||
final PacketInventoryAction p = new PacketInventoryAction(action, slotIdx, 0);
|
||||
NetworkHandler.instance.sendToServer(p);
|
||||
return;
|
||||
}
|
||||
|
||||
if (slot instanceof SlotPatternTerm) {
|
||||
if (mouseButton == 6) {
|
||||
return; // prevents weird double clicks
|
||||
}
|
||||
try {
|
||||
NetworkHandler.instance.sendToServer(((SlotPatternTerm) slot).getRequest(isShiftKeyDown()));
|
||||
} catch (final IOException e) {
|
||||
AELog.debug(e);
|
||||
}
|
||||
} else if (slot instanceof SlotCraftingTerm) {
|
||||
if (mouseButton == 6) {
|
||||
return; // prevents weird double clicks
|
||||
}
|
||||
InventoryAction action;
|
||||
if (isShiftKeyDown()) {
|
||||
action = InventoryAction.CRAFT_SHIFT;
|
||||
} else {
|
||||
// Craft a stack on right-click, craft a single one on left-click
|
||||
action = (mouseButton == 1) ? InventoryAction.CRAFT_STACK : InventoryAction.CRAFT_ITEM;
|
||||
}
|
||||
final PacketInventoryAction p = new PacketInventoryAction(action, slotIdx, 0);
|
||||
NetworkHandler.instance.sendToServer(p);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {
|
||||
if (this.enableSpaceClicking() && !(slot instanceof SlotPatternTerm)) {
|
||||
IAEItemStack stack = null;
|
||||
if (slot instanceof SlotME) {
|
||||
stack = ((SlotME) slot).getAEStack();
|
||||
}
|
||||
int slotNum = Ae2ReflectClient.getInventorySlots(this).size();
|
||||
if (!(slot instanceof SlotME) && slot != null) {
|
||||
slotNum = slot.slotNumber;
|
||||
}
|
||||
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
|
||||
final PacketInventoryAction p = new PacketInventoryAction(InventoryAction.MOVE_REGION, slotNum, 0);
|
||||
NetworkHandler.instance.sendToServer(p);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (slot instanceof SlotDisconnected) {
|
||||
if (Ae2ReflectClient.getDragClick(this).size() > 1) {
|
||||
return;
|
||||
}
|
||||
InventoryAction action = null;
|
||||
switch (mouseButton) {
|
||||
case 0: // pickup / set-down.
|
||||
{
|
||||
ItemStack heldStack = player.inventory.getItemStack();
|
||||
if (slot.getStack() == null && heldStack != null) action = InventoryAction.SPLIT_OR_PLACE_SINGLE;
|
||||
else if (slot.getStack() != null && (heldStack == null || heldStack.stackSize <= 1))
|
||||
action = InventoryAction.PICKUP_OR_SET_DOWN;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
action = ctrlDown == 1 ? InventoryAction.PICKUP_SINGLE : InventoryAction.SHIFT_CLICK;
|
||||
break;
|
||||
case 3: // creative dupe:
|
||||
if (player.capabilities.isCreativeMode) {
|
||||
action = InventoryAction.CREATIVE_DUPLICATE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
case 4: // drop item:
|
||||
case 6:
|
||||
}
|
||||
if (action != null) {
|
||||
final PacketInventoryAction p = new PacketInventoryAction(
|
||||
action,
|
||||
slot.getSlotIndex(),
|
||||
((SlotDisconnected) slot).getSlot().getId());
|
||||
NetworkHandler.instance.sendToServer(p);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (slot instanceof SlotME) {
|
||||
InventoryAction action = null;
|
||||
IAEItemStack stack = null;
|
||||
switch (mouseButton) {
|
||||
case 0: // pickup / set-down.
|
||||
action = ctrlDown == 1 ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
|
||||
stack = ((SlotME) slot).getAEStack();
|
||||
if (stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN
|
||||
&& stack.getStackSize() == 0
|
||||
&& player.inventory.getItemStack() == null) {
|
||||
action = InventoryAction.AUTO_CRAFT;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
action = ctrlDown == 1 ? InventoryAction.PICKUP_SINGLE : InventoryAction.SHIFT_CLICK;
|
||||
stack = ((SlotME) slot).getAEStack();
|
||||
break;
|
||||
case 3: // creative dupe:
|
||||
stack = ((SlotME) slot).getAEStack();
|
||||
stack = transformItem(stack); // for fluid terminal
|
||||
if (stack != null && stack.isCraftable()) {
|
||||
action = InventoryAction.AUTO_CRAFT;
|
||||
} else if (player.capabilities.isCreativeMode) {
|
||||
final IAEItemStack slotItem = ((SlotME) slot).getAEStack();
|
||||
if (slotItem != null) {
|
||||
action = InventoryAction.CREATIVE_DUPLICATE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
case 4: // drop item:
|
||||
case 6:
|
||||
}
|
||||
if (action == InventoryAction.AUTO_CRAFT) {
|
||||
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketInventoryAction(action, Ae2ReflectClient.getInventorySlots(this).size(), 0, stack));
|
||||
} else if (action != null) {
|
||||
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
|
||||
final PacketInventoryAction p = new PacketInventoryAction(
|
||||
action,
|
||||
Ae2ReflectClient.getInventorySlots(this).size(),
|
||||
0);
|
||||
NetworkHandler.instance.sendToServer(p);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
|
||||
}
|
||||
|
||||
protected IAEItemStack transformItem(IAEItemStack stack) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuiClosed() {
|
||||
super.onGuiClosed();
|
||||
Keyboard.enableRepeatEvents(false);
|
||||
memoryText = this.searchField.getText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleKeyboardInput() {
|
||||
super.handleKeyboardInput();
|
||||
|
||||
// Pause the terminal when holding shift
|
||||
this.repo.setPaused(hasShiftDown());
|
||||
}
|
||||
|
||||
private boolean hasShiftDown() {
|
||||
return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
|
||||
}
|
||||
|
||||
public void bindTextureBack(final String file) {
|
||||
final ResourceLocation loc = new ResourceLocation(FluidCraft.MODID, "textures/" + file);
|
||||
this.mc.getTextureManager().bindTexture(loc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.bindTextureBack(this.getBackground());
|
||||
final int x_width = 195;
|
||||
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, x_width, 18);
|
||||
if (this.viewCell) {
|
||||
this.drawTexturedModalRect(offsetX + x_width, offsetY, x_width, 0, 46, 128);
|
||||
}
|
||||
for (int x = 0; x < this.rows; x++) {
|
||||
this.drawTexturedModalRect(offsetX, offsetY + 18 + x * 18, 0, 18, x_width, 18);
|
||||
}
|
||||
this.drawTexturedModalRect(
|
||||
offsetX,
|
||||
offsetY + 16 + this.rows * 18 + this.lowerTextureOffset,
|
||||
0,
|
||||
106 - 18 - 18,
|
||||
x_width,
|
||||
99 + this.reservedSpace - this.lowerTextureOffset);
|
||||
if (this.viewCell) {
|
||||
boolean update = false;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (this.myCurrentViewCells[i] != this.monitorableContainer.getCellViewSlot(i).getStack()) {
|
||||
update = true;
|
||||
this.myCurrentViewCells[i] = this.monitorableContainer.getCellViewSlot(i).getStack();
|
||||
}
|
||||
}
|
||||
if (update) {
|
||||
this.repo.setViewCell(this.myCurrentViewCells);
|
||||
}
|
||||
}
|
||||
if (this.searchField != null) {
|
||||
this.searchField.drawTextBox();
|
||||
}
|
||||
}
|
||||
|
||||
protected String getBackground() {
|
||||
return "gui/terminal.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isPowered() {
|
||||
return this.repo.hasPower();
|
||||
}
|
||||
|
||||
protected int getMaxRows() {
|
||||
return AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) == TerminalStyle.SMALL ? 6
|
||||
: Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
protected void repositionSlot(final AppEngSlot s) {
|
||||
s.yDisplayPosition = s.getY() + this.ySize - 78 - 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(final char character, final int key) {
|
||||
if (!this.checkHotbarKeys(key)) {
|
||||
if (character == ' ' && this.searchField.getText().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.searchField.textboxKeyTyped(character, key)) {
|
||||
this.repo.setSearchString(this.searchField.getText());
|
||||
this.repo.updateView();
|
||||
this.setScrollBar();
|
||||
} else {
|
||||
super.keyTyped(character, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateScreen() {
|
||||
this.repo.setPowered(this.monitorableContainer.isPowered());
|
||||
super.updateScreen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<?> getSortBy() {
|
||||
return this.configSrc.getSetting(Settings.SORT_BY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<?> getSortDir() {
|
||||
return this.configSrc.getSetting(Settings.SORT_DIRECTION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<?> getSortDisplay() {
|
||||
return this.configSrc.getSetting(Settings.VIEW_MODE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Enum<?> getTypeFilter() {
|
||||
return this.configSrc.getSetting(Settings.TYPE_FILTER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSetting(final IConfigManager manager, @SuppressWarnings("rawtypes") final Enum settingName,
|
||||
@SuppressWarnings("rawtypes") final Enum newValue) {
|
||||
if (this.SortByBox != null) {
|
||||
this.SortByBox.set(this.configSrc.getSetting(Settings.SORT_BY));
|
||||
}
|
||||
|
||||
if (this.SortDirBox != null) {
|
||||
this.SortDirBox.set(this.configSrc.getSetting(Settings.SORT_DIRECTION));
|
||||
}
|
||||
|
||||
if (this.ViewBox != null) {
|
||||
this.ViewBox.set(this.configSrc.getSetting(Settings.VIEW_MODE));
|
||||
}
|
||||
if (this.typeFilter != null) {
|
||||
this.typeFilter.set(this.configSrc.getSetting(Settings.TYPE_FILTER));
|
||||
}
|
||||
|
||||
this.repo.updateView();
|
||||
}
|
||||
|
||||
public int getReservedSpace() {
|
||||
return this.reservedSpace;
|
||||
}
|
||||
|
||||
public void setReservedSpace(final int reservedSpace) {
|
||||
this.reservedSpace = reservedSpace;
|
||||
}
|
||||
|
||||
public boolean isCustomSortOrder() {
|
||||
return this.customSortOrder;
|
||||
}
|
||||
|
||||
public void setCustomSortOrder(final boolean customSortOrder) {
|
||||
this.customSortOrder = customSortOrder;
|
||||
}
|
||||
|
||||
public int getStandardSize() {
|
||||
return this.standardSize;
|
||||
}
|
||||
|
||||
public void setStandardSize(final int standardSize) {
|
||||
this.standardSize = standardSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(final int mouseX, final int mouseY, final float btn) {
|
||||
super.drawScreen(mouseX, mouseY, btn);
|
||||
if (ModAndClassUtil.isSearchBar && AEConfig.instance.preserveSearchBar && searchField != null)
|
||||
handleTooltip(mouseX, mouseY, searchField.new TooltipProvider());
|
||||
}
|
||||
|
||||
public boolean isOverSearchField(int x, int y) {
|
||||
return searchField.isMouseIn(x, y);
|
||||
}
|
||||
|
||||
public boolean hideItemPanelSlot(int tx, int ty, int tw, int th) {
|
||||
if (this.viewCell) {
|
||||
int rw = 33;
|
||||
int rh = 14 + myCurrentViewCells.length * 18;
|
||||
|
||||
if (tw <= 0 || th <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int rx = this.guiLeft + this.xSize;
|
||||
int ry = this.guiTop;
|
||||
|
||||
rw += rx;
|
||||
rh += ry;
|
||||
tw += tx;
|
||||
th += ty;
|
||||
|
||||
// overflow || intersect
|
||||
return (rw < rx || rw > tx) && (rh < ry || rh > ty) && (tw < tx || tw > rx) && (th < ty || th > ry);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOverTextField(int mousex, int mousey) {
|
||||
return searchField.isMouseIn(mousex, mousey);
|
||||
}
|
||||
}
|
||||
-109
@@ -1,109 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
|
||||
import com.glodblock.github.inventory.ItemBiggerAppEngInventory;
|
||||
import com.glodblock.github.inventory.item.IWirelessCraftTerminal;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
|
||||
import appeng.container.ContainerNull;
|
||||
import appeng.container.slot.SlotCraftingMatrix;
|
||||
import appeng.container.slot.SlotCraftingTerm;
|
||||
import appeng.helpers.IContainerCraftingPacket;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.tile.inventory.IAEAppEngInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
|
||||
public class ContainerCraftingWireless extends ContainerItemMonitor
|
||||
implements IAEAppEngInventory, IContainerCraftingPacket {
|
||||
|
||||
private final IWirelessCraftTerminal it;
|
||||
private final SlotCraftingMatrix[] craftingSlots = new SlotCraftingMatrix[9];
|
||||
private final SlotCraftingTerm outputSlot;
|
||||
|
||||
public ContainerCraftingWireless(final InventoryPlayer ip, final IWirelessTerminal monitorable) {
|
||||
super(ip, monitorable, false);
|
||||
this.it = (IWirelessCraftTerminal) monitorable;
|
||||
final IInventory crafting = this.it.getInventoryByName("crafting");
|
||||
for (int y = 0; y < 3; y++) {
|
||||
for (int x = 0; x < 3; x++) {
|
||||
this.addSlotToContainer(
|
||||
this.craftingSlots[x + y * 3] = new SlotCraftingMatrix(
|
||||
this,
|
||||
crafting,
|
||||
x + y * 3,
|
||||
37 + x * 18,
|
||||
-72 + y * 18) {
|
||||
|
||||
@Override
|
||||
public void onSlotChanged() {
|
||||
if (this.inventory instanceof ItemBiggerAppEngInventory i) {
|
||||
i.markDirty();
|
||||
}
|
||||
super.onSlotChanged();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
AppEngInternalInventory output = new AppEngInternalInventory(this, 1);
|
||||
this.addSlotToContainer(
|
||||
this.outputSlot = new SlotCraftingTerm(
|
||||
this.getPlayerInv().player,
|
||||
this.getActionSource(),
|
||||
this.getPowerSource(),
|
||||
monitorable,
|
||||
crafting,
|
||||
crafting,
|
||||
output,
|
||||
131,
|
||||
-72 + 18,
|
||||
this));
|
||||
this.bindPlayerInventory(ip, 0, 0);
|
||||
this.onCraftMatrixChanged(crafting);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isWirelessTerminal() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCraftMatrixChanged(final IInventory par1IInventory) {
|
||||
final ContainerNull cn = new ContainerNull();
|
||||
final InventoryCrafting ic = new InventoryCrafting(cn, 3, 3);
|
||||
for (int x = 0; x < 9; x++) {
|
||||
ic.setInventorySlotContents(x, this.craftingSlots[x].getStack());
|
||||
}
|
||||
this.outputSlot
|
||||
.putStack(CraftingManager.getInstance().findMatchingRecipe(ic, this.getPlayerInv().player.worldObj));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveChanges() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final IInventory inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removedStack, final ItemStack newStack) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName(final String name) {
|
||||
if (name.equals("player")) {
|
||||
return this.getInventoryPlayer();
|
||||
}
|
||||
return this.it.getInventoryByName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useRealItems() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.common.tile.TileFluidInterface;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SidelessMode;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.implementations.ContainerInterface;
|
||||
import appeng.helpers.IInterfaceHost;
|
||||
|
||||
public class ContainerDualInterface extends ContainerInterface {
|
||||
|
||||
@GuiSync(11)
|
||||
public SidelessMode sidelessMode;
|
||||
|
||||
private final boolean isTile;
|
||||
|
||||
public ContainerDualInterface(InventoryPlayer ip, IInterfaceHost te) {
|
||||
super(ip, te);
|
||||
this.sidelessMode = SidelessMode.SIDELESS;
|
||||
this.isTile = te instanceof TileFluidInterface;
|
||||
}
|
||||
|
||||
public SidelessMode getSidelessMode() {
|
||||
return this.sidelessMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettingsFromHost(IConfigManager cm) {
|
||||
super.loadSettingsFromHost(cm);
|
||||
this.sidelessMode = this.isTile ? (SidelessMode) cm.getSetting(Settings.SIDELESS_MODE) : SidelessMode.SIDELESS;
|
||||
}
|
||||
}
|
||||
-159
@@ -1,159 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.apache.commons.lang3.tuple.MutablePair;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.crossmod.thaumcraft.AspectUtil;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.network.CPacketFluidUpdate;
|
||||
import com.glodblock.github.network.SPacketFluidUpdate;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.container.slot.SlotPlayerHotBar;
|
||||
import appeng.container.slot.SlotPlayerInv;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ContainerEssentiaMonitor extends ContainerFluidPortableCell {
|
||||
|
||||
public ContainerEssentiaMonitor(InventoryPlayer ip, IWirelessTerminal monitorable) {
|
||||
super(ip, monitorable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(final EntityPlayer p, final int idx) {
|
||||
if (Platform.isClient()) {
|
||||
Slot clickSlot = (Slot) this.inventorySlots.get(idx);
|
||||
if ((clickSlot instanceof SlotPlayerInv || clickSlot instanceof SlotPlayerHotBar) && clickSlot.getHasStack()
|
||||
&& AspectUtil.isEssentiaContainer(clickSlot.getStack())) {
|
||||
int index = Util.findItemInPlayerInvSlot(p, clickSlot.getStack());
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(index));
|
||||
}
|
||||
}
|
||||
return super.transferStackInSlot(p, idx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postChange(IAEFluidStack clientSelectedFluid, EntityPlayer player, int slotIndex, boolean shift) {
|
||||
ItemStack targetStack;
|
||||
if (slotIndex == -1) {
|
||||
targetStack = player.inventory.getItemStack();
|
||||
} else {
|
||||
targetStack = player.inventory.getStackInSlot(slotIndex);
|
||||
}
|
||||
final int containersRequested = shift ? targetStack.stackSize : 1;
|
||||
|
||||
IAEFluidStack storedFluid = this.monitor.getStorageList().findPrecise(clientSelectedFluid);
|
||||
ItemStack out = targetStack.copy();
|
||||
out.stackSize = 1;
|
||||
if (AspectUtil.isEmptyEssentiaContainer(targetStack) && AspectUtil.isEssentiaGas(storedFluid)) {
|
||||
// add essentia to jars
|
||||
if (storedFluid.getStackSize() / AspectUtil.R <= 0) {
|
||||
return;
|
||||
}
|
||||
final IAEFluidStack toExtract = storedFluid.copy();
|
||||
MutablePair<Integer, ItemStack> fillStack = AspectUtil.fillEssentiaFromGas(out, toExtract.getFluidStack());
|
||||
if (fillStack == null || fillStack.right == null || fillStack.left <= 0) {
|
||||
return;
|
||||
}
|
||||
toExtract.setStackSize((long) fillStack.left * containersRequested);
|
||||
IAEFluidStack tmp = this.host.getFluidInventory()
|
||||
.extractItems(toExtract, Actionable.SIMULATE, this.getActionSource());
|
||||
if (tmp == null) {
|
||||
return;
|
||||
}
|
||||
fillStack.right.stackSize = (int) (tmp.getStackSize() / fillStack.left);
|
||||
this.dropItem(fillStack.right);
|
||||
out.stackSize = fillStack.right.stackSize;
|
||||
if (AspectUtil.isEssentiaContainer(fillStack.right)) {
|
||||
this.host.getFluidInventory().extractItems(toExtract, Actionable.MODULATE, this.getActionSource());
|
||||
if ((int) (tmp.getStackSize() % fillStack.left) / AspectUtil.R > 0) {
|
||||
this.dropItem(
|
||||
AspectUtil.setAspectAmount(
|
||||
fillStack.right,
|
||||
(int) (tmp.getStackSize() % fillStack.left) / AspectUtil.R,
|
||||
AspectUtil.getAspectFromGas(toExtract)),
|
||||
1);
|
||||
out.stackSize++;
|
||||
}
|
||||
}
|
||||
} else if (!AspectUtil.isEmptyEssentiaContainer(targetStack)) {
|
||||
// add essentia to ae network
|
||||
ItemStack containerStack = targetStack.copy();
|
||||
containerStack.stackSize = containersRequested;
|
||||
IAEFluidStack fluidStack = AspectUtil.getAEGasFromContainer(containerStack);
|
||||
if (fluidStack == null) {
|
||||
return;
|
||||
}
|
||||
final IAEFluidStack aeFluidStack = fluidStack.copy();
|
||||
// simulate result is incorrect. so I'm using other solution and ec2 both mod have same issues
|
||||
final IAEFluidStack notInserted = this.host.getFluidInventory()
|
||||
.injectItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
|
||||
MutablePair<Integer, ItemStack> drainStack = AspectUtil
|
||||
.drainEssentiaFromGas(out.copy(), aeFluidStack.getFluidStack());
|
||||
if (notInserted != null && notInserted.getStackSize() > 0 && drainStack != null) {
|
||||
if (fluidStack.getStackSize() == notInserted.getStackSize()) {
|
||||
return;
|
||||
}
|
||||
aeFluidStack.decStackSize(notInserted.getStackSize());
|
||||
|
||||
if (drainStack.left > aeFluidStack.getStackSize() && AspectUtil.isEssentiaContainer(drainStack.right)) {
|
||||
aeFluidStack.setStackSize(drainStack.left - aeFluidStack.getStackSize());
|
||||
this.host.getFluidInventory()
|
||||
.extractItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
|
||||
return;
|
||||
}
|
||||
|
||||
// drop empty item
|
||||
this.dropItem(drainStack.right, (int) (aeFluidStack.getStackSize() / drainStack.left));
|
||||
out.stackSize = (int) (notInserted.getStackSize() / drainStack.left);
|
||||
if (AspectUtil.isEssentiaContainer(drainStack.right)) {
|
||||
if (notInserted.getStackSize() % drainStack.left > 0) {
|
||||
fluidStack.setStackSize((notInserted.getStackSize() % drainStack.left));
|
||||
AspectUtil.fillEssentiaFromGas(drainStack.right, fluidStack.getFluidStack());
|
||||
this.dropItem(drainStack.right, 1);
|
||||
}
|
||||
}
|
||||
if (slotIndex == -1) out.stackSize = targetStack.stackSize - out.stackSize;
|
||||
} else if (drainStack != null) {
|
||||
if (slotIndex == -1) {
|
||||
out.stackSize = targetStack.stackSize;
|
||||
} else {
|
||||
out.stackSize = (int) (targetStack.stackSize - (aeFluidStack.getStackSize() / drainStack.left));
|
||||
}
|
||||
this.dropItem(drainStack.right, targetStack.stackSize); // drop empty item
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if (slotIndex == -1) {
|
||||
player.inventory.getItemStack().stackSize = player.inventory.getItemStack().stackSize - out.stackSize;
|
||||
if (player.inventory.getItemStack().stackSize > 0) {
|
||||
FluidCraft.proxy.netHandler.sendTo(
|
||||
new SPacketFluidUpdate(new HashMap<>(), player.inventory.getItemStack()),
|
||||
(EntityPlayerMP) player);
|
||||
} else {
|
||||
player.inventory.setItemStack(null);
|
||||
FluidCraft.proxy.netHandler.sendTo(new SPacketFluidUpdate(new HashMap<>()), (EntityPlayerMP) player);
|
||||
}
|
||||
} else {
|
||||
player.inventory.setInventorySlotContents(slotIndex, out.stackSize > 0 ? out : null);
|
||||
}
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isEssentiaMode() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.apache.commons.lang3.tuple.MutablePair;
|
||||
|
||||
import com.glodblock.github.common.tile.TileFluidAutoFiller;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotFake;
|
||||
|
||||
public class ContainerFluidAutoFiller extends AEBaseContainer {
|
||||
|
||||
public static class FakeSlot extends SlotFake {
|
||||
|
||||
public FakeSlot(IInventory inv, int idx, int x, int y) {
|
||||
super(inv, idx, x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStack(ItemStack is) {
|
||||
MutablePair<Boolean, ItemStack> result = ContainerFluidAutoFiller.isItemValid(is);
|
||||
if (result.left) {
|
||||
if (super.getHasStack()) super.clearStack();
|
||||
hasChange = true;
|
||||
super.putStack(result.right);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final TileFluidAutoFiller tile;
|
||||
private static boolean hasChange;
|
||||
|
||||
public ContainerFluidAutoFiller(InventoryPlayer ipl, TileFluidAutoFiller tile) {
|
||||
super(ipl, tile);
|
||||
this.tile = tile;
|
||||
addSlotToContainer(new FakeSlot(tile.getInventory(), 0, 80, 35));
|
||||
bindPlayerInventory(ipl, 0, 84);
|
||||
}
|
||||
|
||||
public static MutablePair<Boolean, ItemStack> isItemValid(ItemStack itemStack) {
|
||||
boolean result = Util.FluidUtil.isFluidContainer(itemStack);
|
||||
if (!result) return new MutablePair<>(false, null);
|
||||
ItemStack tank = itemStack.copy();
|
||||
tank.stackSize = 1;
|
||||
if (Util.FluidUtil.isFilled(tank)) {
|
||||
return new MutablePair<>(true, Util.FluidUtil.clearFluid(tank));
|
||||
} else {
|
||||
return new MutablePair<>(true, tank);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
if (hasChange) {
|
||||
tile.updatePattern();
|
||||
hasChange = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
-100
@@ -1,100 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.glodblock.github.common.item.ItemBaseWirelessTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
|
||||
import com.glodblock.github.common.parts.PartLevelTerminal;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.util.Ae2Reflect;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.crafting.ICraftingJob;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.container.implementations.ContainerCraftConfirm;
|
||||
import appeng.container.implementations.ContainerOptimizePatterns;
|
||||
import appeng.crafting.v2.CraftingJobV2;
|
||||
import appeng.tile.misc.TilePatternOptimizationMatrix;
|
||||
|
||||
public class ContainerFluidCraftConfirm extends ContainerCraftConfirm {
|
||||
|
||||
public ContainerFluidCraftConfirm(final InventoryPlayer ip, final ITerminalHost te) {
|
||||
super(ip, te);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void switchToOriginalGUI() {
|
||||
GuiType originalGui = null;
|
||||
|
||||
final IActionHost ah = this.getActionHost();
|
||||
if (ah instanceof PartFluidPatternTerminal) {
|
||||
originalGui = GuiType.FLUID_PATTERN_TERMINAL;
|
||||
}
|
||||
if (ah instanceof PartFluidPatternTerminalEx) {
|
||||
originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
|
||||
}
|
||||
if (ah instanceof PartLevelTerminal) {
|
||||
originalGui = GuiType.LEVEL_TERMINAL;
|
||||
}
|
||||
if (ah instanceof IWirelessTerminal) {
|
||||
ItemStack terminal = ((IWirelessTerminal) ah).getItemStack();
|
||||
if (terminal.getItem() instanceof ItemBaseWirelessTerminal) {
|
||||
originalGui = ((ItemBaseWirelessTerminal) terminal.getItem()).guiGuiType(terminal);
|
||||
}
|
||||
}
|
||||
if (ah instanceof IWirelessTerminal) {
|
||||
InventoryHandler.openGui(
|
||||
this.getInventoryPlayer().player,
|
||||
getWorld(),
|
||||
new BlockPos(((IWirelessTerminal) ah).getInventorySlot(), 0, 0),
|
||||
ForgeDirection.UNKNOWN,
|
||||
originalGui);
|
||||
} else if (this.getOpenContext() != null) {
|
||||
InventoryHandler.openGui(
|
||||
this.getInventoryPlayer().player,
|
||||
getWorld(),
|
||||
new BlockPos(this.getOpenContext().getTile()),
|
||||
Objects.requireNonNull(this.getOpenContext().getSide()),
|
||||
originalGui);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void optimizePatterns() {
|
||||
// only V2 supported
|
||||
IGrid grid = Ae2Reflect.getGrid(this);
|
||||
ICraftingJob result = Ae2Reflect.getResult(this);
|
||||
if (result instanceof CraftingJobV2 && !this.isSimulation()
|
||||
&& grid != null
|
||||
&& !grid.getMachines(TilePatternOptimizationMatrix.class).isEmpty()) {
|
||||
final IActionHost ah = this.getActionHost();
|
||||
if (ah instanceof IWirelessTerminal) {
|
||||
InventoryHandler.openGui(
|
||||
this.getInventoryPlayer().player,
|
||||
getWorld(),
|
||||
new BlockPos(((IWirelessTerminal) ah).getInventorySlot(), 0, 0),
|
||||
ForgeDirection.UNKNOWN,
|
||||
GuiType.FLUID_OPTIMIZE_PATTERNS_ITEM);
|
||||
} else if (this.getOpenContext() != null) {
|
||||
InventoryHandler.openGui(
|
||||
this.getInventoryPlayer().player,
|
||||
getWorld(),
|
||||
new BlockPos(this.getOpenContext().getTile()),
|
||||
Objects.requireNonNull(this.getOpenContext().getSide()),
|
||||
GuiType.FLUID_OPTIMIZE_PATTERNS);
|
||||
}
|
||||
if (this.getPlayerInv().player.openContainer instanceof ContainerOptimizePatterns cop) {
|
||||
cop.setResult(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.client.gui.container.base.FCContainerFluidConfigurable;
|
||||
import com.glodblock.github.common.parts.PartFluidExportBus;
|
||||
import com.glodblock.github.common.parts.base.FCSharedFluidBus;
|
||||
import com.glodblock.github.util.Ae2Reflect;
|
||||
|
||||
import appeng.api.config.SchedulingMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
|
||||
public class ContainerFluidIO extends FCContainerFluidConfigurable {
|
||||
|
||||
private final FCSharedFluidBus bus;
|
||||
|
||||
public ContainerFluidIO(InventoryPlayer ip, FCSharedFluidBus te) {
|
||||
super(ip, te);
|
||||
this.bus = te;
|
||||
}
|
||||
|
||||
public FCSharedFluidBus getBus() {
|
||||
return this.bus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppEngInternalAEInventory getFakeFluidInv() {
|
||||
return (AppEngInternalAEInventory) this.bus.getInventoryByName("config");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettingsFromHost(IConfigManager cm) {
|
||||
super.loadSettingsFromHost(cm);
|
||||
if (Ae2Reflect.getUpgradeableHost(this) instanceof PartFluidExportBus) {
|
||||
this.setCraftingMode((YesNo) cm.getSetting(Settings.CRAFT_ONLY));
|
||||
this.setSchedulingMode((SchedulingMode) cm.getSetting(Settings.SCHEDULING_MODE));
|
||||
}
|
||||
}
|
||||
|
||||
public void setSchedulingMode(final SchedulingMode schedulingMode) {
|
||||
this.schedulingMode = schedulingMode;
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.inventory.IDualHost;
|
||||
import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
|
||||
import com.glodblock.github.network.SPacketFluidUpdate;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.IOptionalSlotHost;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
|
||||
public class ContainerFluidInterface extends AEBaseContainer implements IOptionalSlotHost {
|
||||
|
||||
private final IDualHost tile;
|
||||
|
||||
public ContainerFluidInterface(InventoryPlayer ipl, IDualHost tile) {
|
||||
super(ipl, tile);
|
||||
this.tile = tile;
|
||||
IInventory inv = tile.getConfig();
|
||||
final int y = 35;
|
||||
final int x = 35;
|
||||
for (int i = 0; i < 6; i++) {
|
||||
addSlotToContainer(
|
||||
new OptionalFluidSlotFakeTypeOnly(inv, tile.getDualityFluid().getConfig(), this, i, x, y, i, 0, 0));
|
||||
}
|
||||
bindPlayerInventory(ipl, 0, 149);
|
||||
}
|
||||
|
||||
public IDualHost getTile() {
|
||||
return tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlotEnabled(int idx) {
|
||||
return idx >= 0 && idx < 6;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
Map<Integer, IAEFluidStack> tmp = new HashMap<>();
|
||||
for (int i = 0; i < tile.getInternalFluid().getSlots(); i++) {
|
||||
tmp.put(i, tile.getInternalFluid().getFluidInSlot(i));
|
||||
}
|
||||
for (int i = 0; i < tile.getConfig().getSizeInventory(); i++) {
|
||||
tmp.put(i + 100, AEFluidStack.create(ItemFluidPacket.getFluidStack(tile.getConfig().getStackInSlot(i))));
|
||||
}
|
||||
for (final Object g : this.crafters) {
|
||||
if (g instanceof EntityPlayer) {
|
||||
FluidCraft.proxy.netHandler.sendTo(new SPacketFluidUpdate(tmp), (EntityPlayerMP) g);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-106
@@ -1,106 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
import com.glodblock.github.client.gui.container.base.FCContainerFluidConfigurable;
|
||||
import com.glodblock.github.common.parts.PartFluidLevelEmitter;
|
||||
import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
|
||||
import com.glodblock.github.util.Ae2Reflect;
|
||||
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.implementations.IUpgradeableHost;
|
||||
import appeng.client.gui.widgets.MEGuiTextField;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ContainerFluidLevelEmitter extends FCContainerFluidConfigurable {
|
||||
|
||||
private final PartFluidLevelEmitter lvlEmitter;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private MEGuiTextField textField;
|
||||
|
||||
@GuiSync(2)
|
||||
public long EmitterValue = -1;
|
||||
|
||||
public ContainerFluidLevelEmitter(final InventoryPlayer ip, final PartFluidLevelEmitter te) {
|
||||
super(ip, te);
|
||||
this.lvlEmitter = te;
|
||||
}
|
||||
|
||||
public PartFluidLevelEmitter getBus() {
|
||||
return this.lvlEmitter;
|
||||
}
|
||||
|
||||
protected IUpgradeableHost getUpgradeable() {
|
||||
return Ae2Reflect.getUpgradeableHost(this);
|
||||
}
|
||||
|
||||
public AppEngInternalAEInventory getFakeFluidInv() {
|
||||
return (AppEngInternalAEInventory) this.lvlEmitter.getInventoryByName("config");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupConfig() {
|
||||
final IInventory inv = this.getUpgradeable().getInventoryByName("config");
|
||||
this.addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(inv, null, this, 0, 17, 42, 0, 0, 0));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setTextField(final MEGuiTextField level) {
|
||||
this.textField = level;
|
||||
}
|
||||
|
||||
public void setLevel(final long l, final EntityPlayer player) {
|
||||
this.lvlEmitter.setReportingValue(l);
|
||||
this.EmitterValue = l;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean supportCapacity() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int availableUpgrades() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setRedStoneMode(final RedstoneMode rsMode) {
|
||||
this.rsMode = rsMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
this.verifyPermissions(SecurityPermissions.BUILD, false);
|
||||
|
||||
if (Platform.isServer()) {
|
||||
this.EmitterValue = this.lvlEmitter.getReportingValue();
|
||||
this.setRedStoneMode(
|
||||
(RedstoneMode) Ae2Reflect.getUpgradeableHost(this).getConfigManager()
|
||||
.getSetting(Settings.REDSTONE_EMITTER));
|
||||
}
|
||||
|
||||
this.standardDetectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(final String field, final Object oldValue, final Object newValue) {
|
||||
if (field.equals("EmitterValue")) {
|
||||
if (this.textField != null) {
|
||||
this.textField.setText(String.valueOf(this.EmitterValue));
|
||||
|
||||
if (String.valueOf(oldValue).equals("-1")) {
|
||||
this.textField.setCursorPositionEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,560 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.base.FCContainerMonitor;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.network.CPacketFluidUpdate;
|
||||
import com.glodblock.github.network.SPacketFluidUpdate;
|
||||
import com.glodblock.github.network.SPacketMEUpdateBuffer;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.implementations.tiles.IViewCellStorage;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.storage.IBaseMonitor;
|
||||
import appeng.api.networking.storage.IStorageGrid;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.slot.SlotPlayerHotBar;
|
||||
import appeng.container.slot.SlotPlayerInv;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.me.helpers.ChannelPowerSrc;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
|
||||
public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
|
||||
|
||||
protected final IItemList<IAEFluidStack> fluids = AEApi.instance().storage().createFluidList();
|
||||
/**
|
||||
* Index of tuple which indicates remaining tanks that are remaining (not emptied/filled)
|
||||
*/
|
||||
protected static final int REM_IDX = 0;
|
||||
/**
|
||||
* Index of tuple which indicates remaining tanks that are acted upon (emptied/filled)
|
||||
*/
|
||||
protected static final int ACT_IDX = 1;
|
||||
/**
|
||||
* Index of tuple which indicates tanks that are partially emptied/filled
|
||||
*/
|
||||
protected static final int PARTIAL_IDX = 2;
|
||||
|
||||
public ContainerFluidMonitor(final InventoryPlayer ip, final ITerminalHost monitorable) {
|
||||
this(ip, monitorable, true);
|
||||
}
|
||||
|
||||
protected ContainerFluidMonitor(final InventoryPlayer ip, final ITerminalHost monitorable,
|
||||
final boolean bindInventory) {
|
||||
super(ip, monitorable, bindInventory);
|
||||
if (Platform.isServer()) {
|
||||
this.serverCM = monitorable.getConfigManager();
|
||||
if (monitorable instanceof IGridHost) {
|
||||
final IGridNode node = ((IGridHost) monitorable).getGridNode(ForgeDirection.UNKNOWN);
|
||||
if (node != null) {
|
||||
this.networkNode = node;
|
||||
final IGrid g = node.getGrid();
|
||||
if (g != null) {
|
||||
this.setPowerSource(new ChannelPowerSrc(this.networkNode, g.getCache(IEnergyGrid.class)));
|
||||
IStorageGrid storageGrid = g.getCache(IStorageGrid.class);
|
||||
this.monitor = storageGrid.getFluidInventory();
|
||||
if (this.monitor == null) {
|
||||
this.setValidContainer(false);
|
||||
} else {
|
||||
this.monitor.addListener(this, null);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.setValidContainer(false);
|
||||
}
|
||||
} else {
|
||||
this.monitor = monitorable.getFluidInventory();
|
||||
this.monitor.addListener(this, null);
|
||||
this.setPowerSource((IEnergySource) monitorable);
|
||||
}
|
||||
} else {
|
||||
this.monitor = null;
|
||||
}
|
||||
|
||||
this.canAccessViewCells = false;
|
||||
if (monitorable instanceof IViewCellStorage) {
|
||||
for (int y = 0; y < 5; y++) {
|
||||
this.cellView[y] = new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.VIEW_CELL,
|
||||
((IViewCellStorage) monitorable).getViewCellStorage(),
|
||||
y,
|
||||
206,
|
||||
y * 18 + 8,
|
||||
this.getInventoryPlayer());
|
||||
this.cellView[y].setAllowEdit(this.canAccessViewCells);
|
||||
this.addSlotToContainer(this.cellView[y]);
|
||||
}
|
||||
}
|
||||
|
||||
if (bindInventory) {
|
||||
this.bindPlayerInventory(ip, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(final EntityPlayer p, final int idx) {
|
||||
if (Platform.isClient() && !isEssentiaMode()) {
|
||||
Slot clickSlot = (Slot) this.inventorySlots.get(idx);
|
||||
if ((clickSlot instanceof SlotPlayerInv || clickSlot instanceof SlotPlayerHotBar) && clickSlot.getHasStack()
|
||||
&& Util.FluidUtil.isFluidContainer(clickSlot.getStack())) {
|
||||
int index = Util.findItemInPlayerInvSlot(p, clickSlot.getStack());
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidUpdate(index));
|
||||
}
|
||||
}
|
||||
return super.transferStackInSlot(p, idx);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void processItemList() {
|
||||
if (!this.fluids.isEmpty()) {
|
||||
final IItemList<IAEFluidStack> monitorCache = this.monitor.getStorageList();
|
||||
List<IAEFluidStack> toSend = new ArrayList<>();
|
||||
for (final IAEFluidStack is : this.fluids) {
|
||||
final IAEFluidStack send = monitorCache.findPrecise(is);
|
||||
if (send != null) {
|
||||
toSend.add(send);
|
||||
} else {
|
||||
is.setStackSize(0);
|
||||
toSend.add(is);
|
||||
}
|
||||
}
|
||||
for (final Object c : this.crafters) {
|
||||
if (c instanceof EntityPlayerMP) {
|
||||
SPacketMEUpdateBuffer.scheduleFluidUpdate((EntityPlayerMP) c, toSend);
|
||||
}
|
||||
}
|
||||
this.fluids.resetStatus();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void queueInventory(final ICrafting c) {
|
||||
if (Platform.isServer() && c instanceof EntityPlayerMP && this.monitor != null) {
|
||||
final IItemList<IAEFluidStack> monitorCache = this.monitor.getStorageList();
|
||||
List<IAEFluidStack> toSend = new ArrayList<>();
|
||||
for (final IAEFluidStack is : monitorCache) {
|
||||
toSend.add(is);
|
||||
}
|
||||
SPacketMEUpdateBuffer.scheduleFluidUpdate((EntityPlayerMP) c, toSend);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postChange(IBaseMonitor<IAEFluidStack> monitor, Iterable<IAEFluidStack> change,
|
||||
BaseActionSource actionSource) {
|
||||
for (final IAEFluidStack is : change) {
|
||||
this.fluids.add(is);
|
||||
}
|
||||
}
|
||||
|
||||
protected void dropItem(ItemStack is) {
|
||||
if (is == null || is.stackSize <= 0) return;
|
||||
ItemStack itemStack = is.copy();
|
||||
int i = itemStack.getMaxStackSize();
|
||||
while (itemStack.stackSize > 0) {
|
||||
if (i > itemStack.stackSize) {
|
||||
if (!getPlayerInv().addItemStackToInventory(itemStack.copy())) {
|
||||
getPlayerInv().player.entityDropItem(itemStack.copy(), 0);
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
itemStack.stackSize -= i;
|
||||
ItemStack item = itemStack.copy();
|
||||
item.stackSize = i;
|
||||
if (!getPlayerInv().addItemStackToInventory(item)) {
|
||||
getPlayerInv().player.entityDropItem(item, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void dropItem(ItemStack itemStack, int stackSize) {
|
||||
if (itemStack == null || itemStack.stackSize <= 0) return;
|
||||
ItemStack is = itemStack.copy();
|
||||
is.stackSize = stackSize;
|
||||
this.dropItem(is);
|
||||
}
|
||||
|
||||
/**
|
||||
* Two operations, insert and extract.
|
||||
*
|
||||
* @param slotIndex The slot. If index == -1, the cursor held itemstack. Else, slotIndex indicates which slot was
|
||||
* shift clicked on.
|
||||
*/
|
||||
public void postChange(IAEFluidStack fluid, EntityPlayer player, int slotIndex, boolean shift) {
|
||||
ItemStack targetStack;
|
||||
if (slotIndex == -1) {
|
||||
targetStack = player.inventory.getItemStack();
|
||||
} else {
|
||||
targetStack = player.inventory.getStackInSlot(slotIndex);
|
||||
}
|
||||
// The primary output itemstack
|
||||
if (Util.FluidUtil.isEmpty(targetStack) && fluid != null) {
|
||||
// Situation 1.a: Empty fluid container, and nonnull slot
|
||||
extractFluid(fluid, player, slotIndex, shift);
|
||||
} else if (!Util.FluidUtil.isEmpty(targetStack)) {
|
||||
// Situation 2.a: We are holding a non-empty container.
|
||||
insertFluid(player, slotIndex, shift);
|
||||
// End of situation 2.a
|
||||
}
|
||||
// No op (Any other situation)
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
/**
|
||||
* The insert operation. For input, we have a filled container stack. For outputs, we have the following:
|
||||
* <ol>
|
||||
* <li>Leftover filled container stack</li>
|
||||
* <li>Empty containers</li>
|
||||
* <li>Partially filled container x1</li>
|
||||
* </ol>
|
||||
* In order above, the itemstack at `slotIndex` is transformed into the output.
|
||||
*/
|
||||
private void insertFluid(EntityPlayer player, int slotIndex, boolean shift) {
|
||||
final ItemStack targetStack;
|
||||
if (slotIndex == -1) {
|
||||
targetStack = player.inventory.getItemStack();
|
||||
} else {
|
||||
targetStack = player.inventory.getStackInSlot(slotIndex);
|
||||
}
|
||||
final int containersRequestedToInsert = shift ? targetStack.stackSize : 1;
|
||||
|
||||
// Step 1: Determine container characteristics and verify fluid to be extractable
|
||||
final int fluidPerContainer;
|
||||
final FluidStack fluidStackPerContainer;
|
||||
final boolean partialInsertSupported;
|
||||
if (targetStack.getItem() instanceof IFluidContainerItem fcItem) {
|
||||
ItemStack test = targetStack.copy();
|
||||
test.stackSize = 1;
|
||||
fluidStackPerContainer = fcItem.drain(test, Integer.MAX_VALUE, false);
|
||||
if (fluidStackPerContainer == null || fluidStackPerContainer.amount == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
fluidPerContainer = fluidStackPerContainer.amount;
|
||||
partialInsertSupported = true;
|
||||
} else if (FluidContainerRegistry.isContainer(targetStack)) {
|
||||
ItemStack emptyTank = FluidContainerRegistry.drainFluidContainer(targetStack);
|
||||
if (emptyTank == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
fluidStackPerContainer = FluidContainerRegistry.getFluidForFilledItem(targetStack);
|
||||
fluidPerContainer = fluidStackPerContainer.amount;
|
||||
partialInsertSupported = false;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
// Step 2: determine network capacity
|
||||
final IAEFluidStack totalFluid = AEFluidStack.create(fluidStackPerContainer);
|
||||
totalFluid.setStackSize((long) fluidPerContainer * containersRequestedToInsert);
|
||||
|
||||
final IAEFluidStack notInsertable = this.host.getFluidInventory()
|
||||
.injectItems(totalFluid, Actionable.SIMULATE, this.getActionSource());
|
||||
|
||||
final long insertableFluid;
|
||||
if (notInsertable == null || notInsertable.getStackSize() == 0) {
|
||||
insertableFluid = totalFluid.getStackSize();
|
||||
} else {
|
||||
long insertable = totalFluid.getStackSize() - notInsertable.getStackSize();
|
||||
if (partialInsertSupported) {
|
||||
insertableFluid = insertable;
|
||||
} else {
|
||||
// avoid remainder
|
||||
insertableFluid = insertable - (insertable % fluidPerContainer);
|
||||
}
|
||||
}
|
||||
totalFluid.setStackSize(insertableFluid);
|
||||
|
||||
// Step 3: perform insert
|
||||
final long totalInserted;
|
||||
final IAEFluidStack notInserted = this.host.getFluidInventory()
|
||||
.injectItems(totalFluid, Actionable.MODULATE, this.getActionSource());
|
||||
if (notInserted != null && notInserted.getStackSize() > 0) {
|
||||
// User has a setup that causes discrepancy between simulation and modulation. Likely double storage bus.
|
||||
long total = totalFluid.getStackSize() - notInserted.getStackSize();
|
||||
if (partialInsertSupported) {
|
||||
totalInserted = total;
|
||||
} else {
|
||||
// We cant have partially filled containers -> user will receive a fluid packet as last resort
|
||||
long overflowAmount = fluidPerContainer - (total % fluidPerContainer);
|
||||
IAEFluidStack overflow = AEFluidStack.create(fluidStackPerContainer);
|
||||
overflow.setStackSize(overflowAmount);
|
||||
dropItem(ItemFluidPacket.newStack(overflow));
|
||||
totalInserted = total + overflowAmount;
|
||||
}
|
||||
} else {
|
||||
totalInserted = totalFluid.getStackSize();
|
||||
}
|
||||
|
||||
// Step 4: calculate outputs
|
||||
final int emptiedTanks;
|
||||
final int partialDrain;
|
||||
if (fluidPerContainer > 0) {
|
||||
emptiedTanks = (int) (totalInserted / fluidPerContainer);
|
||||
partialDrain = (int) (totalInserted % fluidPerContainer);
|
||||
} else {
|
||||
emptiedTanks = containersRequestedToInsert;
|
||||
partialDrain = 0;
|
||||
}
|
||||
final int partialTanks = partialDrain > 0 && partialInsertSupported ? 1 : 0;
|
||||
final int usedTanks = emptiedTanks + partialTanks;
|
||||
final int untouchedTanks = targetStack.stackSize - usedTanks;
|
||||
|
||||
final ItemStack emptiedTanksStack;
|
||||
final ItemStack partialTanksStack;
|
||||
|
||||
if (targetStack.getItem() instanceof IFluidContainerItem fcItem) {
|
||||
if (emptiedTanks > 0) {
|
||||
final ItemStack testDrainStack = targetStack.copy();
|
||||
testDrainStack.stackSize = 1;
|
||||
fcItem.drain(testDrainStack, fluidPerContainer, true);
|
||||
if (testDrainStack.stackSize == 0) {
|
||||
emptiedTanksStack = null;
|
||||
} else {
|
||||
emptiedTanksStack = testDrainStack.copy();
|
||||
emptiedTanksStack.stackSize = emptiedTanks;
|
||||
}
|
||||
} else {
|
||||
emptiedTanksStack = null;
|
||||
}
|
||||
if (partialTanks > 0) {
|
||||
partialTanksStack = targetStack.copy();
|
||||
partialTanksStack.stackSize = 1;
|
||||
fcItem.drain(partialTanksStack, partialDrain, true);
|
||||
} else {
|
||||
partialTanksStack = null;
|
||||
}
|
||||
} else {
|
||||
if (emptiedTanks > 0) {
|
||||
emptiedTanksStack = FluidContainerRegistry.drainFluidContainer(targetStack);
|
||||
emptiedTanksStack.stackSize = emptiedTanks;
|
||||
} else {
|
||||
emptiedTanksStack = null;
|
||||
}
|
||||
// Not possible > see Step 2 and Step 3
|
||||
partialTanksStack = null;
|
||||
}
|
||||
|
||||
// Done. Put the output in the inventory or ground, and update stack size.
|
||||
boolean shouldSendStack = true;
|
||||
if (slotIndex == -1) {
|
||||
// Item is in mouse hand
|
||||
if (untouchedTanks > 0) {
|
||||
targetStack.stackSize = untouchedTanks;
|
||||
adjustStack(targetStack);
|
||||
dropItem(emptiedTanksStack);
|
||||
dropItem(partialTanksStack);
|
||||
} else if (emptiedTanksStack != null) {
|
||||
adjustStack(emptiedTanksStack);
|
||||
player.inventory.setItemStack(emptiedTanksStack);
|
||||
dropItem(partialTanksStack);
|
||||
} else if (partialTanksStack != null) {
|
||||
player.inventory.setItemStack(partialTanksStack);
|
||||
} else {
|
||||
player.inventory.setItemStack(null);
|
||||
shouldSendStack = false;
|
||||
}
|
||||
} else {
|
||||
// Shift clicked in
|
||||
if (untouchedTanks > 0) {
|
||||
targetStack.stackSize = untouchedTanks;
|
||||
adjustStack(targetStack);
|
||||
dropItem(emptiedTanksStack);
|
||||
dropItem(partialTanksStack);
|
||||
} else if (emptiedTanksStack != null) {
|
||||
adjustStack(emptiedTanksStack);
|
||||
player.inventory.setInventorySlotContents(slotIndex, emptiedTanksStack);
|
||||
dropItem(partialTanksStack);
|
||||
} else if (partialTanksStack != null) {
|
||||
player.inventory.setInventorySlotContents(slotIndex, partialTanksStack);
|
||||
} else {
|
||||
player.inventory.setInventorySlotContents(slotIndex, null);
|
||||
}
|
||||
}
|
||||
if (shouldSendStack) {
|
||||
FluidCraft.proxy.netHandler.sendTo(
|
||||
new SPacketFluidUpdate(new HashMap<>(), player.inventory.getItemStack()),
|
||||
(EntityPlayerMP) player);
|
||||
} else {
|
||||
FluidCraft.proxy.netHandler.sendTo(new SPacketFluidUpdate(new HashMap<>()), (EntityPlayerMP) player);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The extract operation. For input, we have an empty container stack. For outputs, we have the following:
|
||||
* <ol>
|
||||
* <li>Leftover empty container stack</li>
|
||||
* <li>Filled containers (full)</li>
|
||||
* <li>Partially filled container x1</li>
|
||||
* </ol>
|
||||
* In order above, the itemstack at `slotIndex` is transformed into the output.
|
||||
*/
|
||||
private void extractFluid(IAEFluidStack clientRequestedFluid, EntityPlayer player, int slotIndex, boolean shift) {
|
||||
if (slotIndex != -1) {
|
||||
// shift-click from inventory cant fill fluids
|
||||
return;
|
||||
}
|
||||
final ItemStack targetStack = player.inventory.getItemStack();
|
||||
final int containersRequestedToExtract = shift ? targetStack.stackSize : 1;
|
||||
|
||||
final FluidStack clientRequestedFluidStack = clientRequestedFluid.getFluidStack();
|
||||
clientRequestedFluidStack.amount = Integer.MAX_VALUE;
|
||||
|
||||
// Step 1: Determine container characteristics and verify fluid to be insertable
|
||||
final int fluidPerContainer;
|
||||
final boolean partialInsertSupported;
|
||||
if (targetStack.getItem() instanceof IFluidContainerItem fcItem) {
|
||||
ItemStack testStack = targetStack.copy();
|
||||
testStack.stackSize = 1;
|
||||
fluidPerContainer = fcItem.fill(testStack, clientRequestedFluidStack, false);
|
||||
if (fluidPerContainer == 0) {
|
||||
return;
|
||||
}
|
||||
partialInsertSupported = true;
|
||||
} else if (FluidContainerRegistry.isContainer(targetStack)) {
|
||||
fluidPerContainer = FluidContainerRegistry.getContainerCapacity(clientRequestedFluidStack, targetStack);
|
||||
partialInsertSupported = false;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
// Step 2: determine fluid in network
|
||||
final IAEFluidStack totalRequestedFluid = clientRequestedFluid.copy();
|
||||
totalRequestedFluid.setStackSize((long) fluidPerContainer * containersRequestedToExtract);
|
||||
|
||||
final IAEFluidStack availableFluid = this.host.getFluidInventory()
|
||||
.extractItems(totalRequestedFluid, Actionable.SIMULATE, this.getActionSource());
|
||||
if (availableFluid == null || availableFluid.getStackSize() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (availableFluid.getStackSize() != totalRequestedFluid.getStackSize() && !partialInsertSupported) {
|
||||
availableFluid.decStackSize(availableFluid.getStackSize() % fluidPerContainer);
|
||||
}
|
||||
|
||||
// Step 3: perform extract
|
||||
final IAEFluidStack extracted = this.host.getFluidInventory()
|
||||
.extractItems(availableFluid, Actionable.MODULATE, this.getActionSource());
|
||||
final long totalExtracted = extracted != null ? extracted.getStackSize() : 0;
|
||||
|
||||
// Step 4: calculate outputs
|
||||
final int filledTanks = (int) (totalExtracted / fluidPerContainer);
|
||||
final int partialFill = (int) (totalExtracted % fluidPerContainer);
|
||||
final int partialTanks = partialFill > 0 && partialInsertSupported ? 1 : 0;
|
||||
final int usedTanks = filledTanks + partialTanks;
|
||||
final int untouchedTanks = targetStack.stackSize - usedTanks;
|
||||
|
||||
final ItemStack filledTanksStack;
|
||||
final ItemStack partialTanksStack;
|
||||
|
||||
if (targetStack.getItem() instanceof IFluidContainerItem fcItem) {
|
||||
if (filledTanks > 0) {
|
||||
filledTanksStack = targetStack.copy();
|
||||
filledTanksStack.stackSize = 1;
|
||||
FluidStack toInsert = extracted.getFluidStack().copy();
|
||||
toInsert.amount = fluidPerContainer;
|
||||
fcItem.fill(filledTanksStack, toInsert, true);
|
||||
filledTanksStack.stackSize = filledTanks;
|
||||
} else {
|
||||
filledTanksStack = null;
|
||||
}
|
||||
if (partialTanks > 0) {
|
||||
partialTanksStack = targetStack.copy();
|
||||
partialTanksStack.stackSize = 1;
|
||||
FluidStack toInsert = extracted.getFluidStack().copy();
|
||||
toInsert.amount = partialFill;
|
||||
fcItem.fill(partialTanksStack, toInsert, true);
|
||||
} else {
|
||||
partialTanksStack = null;
|
||||
}
|
||||
} else {
|
||||
if (filledTanks > 0) {
|
||||
FluidStack toInsert = extracted.getFluidStack().copy();
|
||||
toInsert.amount = fluidPerContainer;
|
||||
filledTanksStack = FluidContainerRegistry.fillFluidContainer(toInsert, targetStack);
|
||||
filledTanksStack.stackSize = filledTanks;
|
||||
} else {
|
||||
filledTanksStack = null;
|
||||
}
|
||||
if (partialFill > 0) {
|
||||
// User has a setup that causes discrepancy between simulation and modulation. Likely double storage
|
||||
// bus.
|
||||
// We cant have partially filled containers -> user will receive a fluid packet as last resort
|
||||
IAEFluidStack overflow = extracted.copy();
|
||||
overflow.setStackSize(partialFill);
|
||||
dropItem(ItemFluidPacket.newStack(overflow));
|
||||
}
|
||||
partialTanksStack = null;
|
||||
}
|
||||
|
||||
// Done. Put the output in the inventory or ground, and update stack size.
|
||||
// We can assume slotIndex == -1, since we don't actually allow extraction via shift click.
|
||||
boolean shouldSendStack = true;
|
||||
if (untouchedTanks > 0) {
|
||||
ItemStack emptyStack = player.inventory.getItemStack();
|
||||
emptyStack.stackSize = untouchedTanks;
|
||||
adjustStack(emptyStack);
|
||||
dropItem(filledTanksStack);
|
||||
dropItem(partialTanksStack);
|
||||
} else if (filledTanksStack != null) {
|
||||
adjustStack(filledTanksStack);
|
||||
player.inventory.setItemStack(filledTanksStack);
|
||||
dropItem(partialTanksStack);
|
||||
} else if (partialTanksStack != null) {
|
||||
player.inventory.setItemStack(partialTanksStack);
|
||||
} else {
|
||||
player.inventory.setItemStack(null);
|
||||
shouldSendStack = false;
|
||||
}
|
||||
if (shouldSendStack) {
|
||||
FluidCraft.proxy.netHandler.sendTo(
|
||||
new SPacketFluidUpdate(new HashMap<>(), player.inventory.getItemStack()),
|
||||
(EntityPlayerMP) player);
|
||||
} else {
|
||||
FluidCraft.proxy.netHandler.sendTo(new SPacketFluidUpdate(new HashMap<>()), (EntityPlayerMP) player);
|
||||
}
|
||||
}
|
||||
|
||||
void adjustStack(ItemStack stack) {
|
||||
if (stack != null && stack.stackSize > stack.getMaxStackSize()) {
|
||||
dropItem(stack, stack.stackSize - stack.getMaxStackSize());
|
||||
stack.stackSize = stack.getMaxStackSize();
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isEssentiaMode() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isWirelessTerminal() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
-69
@@ -1,69 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
|
||||
public class ContainerFluidPatternExWireless extends ContainerFluidPatternTerminalEx {
|
||||
|
||||
public ContainerFluidPatternExWireless(InventoryPlayer ip, IWirelessTerminal monitorable) {
|
||||
super(ip, monitorable);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isWirelessTerminal() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
-161
@@ -1,161 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
|
||||
import com.glodblock.github.client.gui.container.base.FCContainerEncodeTerminal;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.container.slot.OptionalSlotFake;
|
||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||
import appeng.container.slot.SlotPatternOutputs;
|
||||
import appeng.container.slot.SlotPatternTerm;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ContainerFluidPatternTerminal extends FCContainerEncodeTerminal {
|
||||
|
||||
public ContainerFluidPatternTerminal(final InventoryPlayer ip, final ITerminalHost monitorable) {
|
||||
super(ip, monitorable);
|
||||
final IInventory output = this.patternTerminal.getInventoryByName("output");
|
||||
final IInventory patternInv = this.patternTerminal.getInventoryByName("pattern");
|
||||
this.craftingSlots = new SlotFakeCraftingMatrix[9];
|
||||
this.outputSlots = new OptionalSlotFake[3];
|
||||
for (int y = 0; y < 3; y++) {
|
||||
for (int x = 0; x < 3; x++) {
|
||||
this.addSlotToContainer(
|
||||
this.craftingSlots[x + y * 3] = new SlotFakeCraftingMatrix(
|
||||
this.crafting,
|
||||
x + y * 3,
|
||||
18 + x * 18,
|
||||
-76 + y * 18));
|
||||
}
|
||||
}
|
||||
|
||||
this.addSlotToContainer(
|
||||
this.craftSlot = new SlotPatternTerm(
|
||||
ip.player,
|
||||
this.getActionSource(),
|
||||
this.getPowerSource(),
|
||||
monitorable,
|
||||
this.crafting,
|
||||
patternInv,
|
||||
this.cOut,
|
||||
110,
|
||||
-76 + 18,
|
||||
this,
|
||||
2,
|
||||
this));
|
||||
this.craftSlot.setIIcon(-1);
|
||||
|
||||
for (int y = 0; y < 3; y++) {
|
||||
this.addSlotToContainer(
|
||||
this.outputSlots[y] = new SlotPatternOutputs(output, this, y, 110, -76 + y * 18, 0, 0, 1));
|
||||
this.outputSlots[y].setRenderDisabled(false);
|
||||
}
|
||||
this.updateOrderOfOutputSlots();
|
||||
}
|
||||
|
||||
private void updateOrderOfOutputSlots() {
|
||||
if (!this.isCraftingMode()) {
|
||||
this.craftSlot.xDisplayPosition = -9000;
|
||||
for (int y = 0; y < 3; y++) {
|
||||
this.outputSlots[y].xDisplayPosition = this.outputSlots[y].getX();
|
||||
}
|
||||
} else {
|
||||
this.craftSlot.xDisplayPosition = this.craftSlot.getX();
|
||||
for (int y = 0; y < 3; y++) {
|
||||
this.outputSlots[y].xDisplayPosition = -9000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean validPatternSlot(Slot slot) {
|
||||
return slot instanceof SlotFakeCraftingMatrix || slot instanceof SlotPatternOutputs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStackInSlot(final int par1, final ItemStack par2ItemStack) {
|
||||
super.putStackInSlot(par1, par2ItemStack);
|
||||
this.getAndUpdateOutput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStacksInSlots(final ItemStack[] par1ArrayOfItemStack) {
|
||||
super.putStacksInSlots(par1ArrayOfItemStack);
|
||||
this.getAndUpdateOutput();
|
||||
}
|
||||
|
||||
private ItemStack getAndUpdateOutput() {
|
||||
final InventoryCrafting ic = new InventoryCrafting(this, 3, 3);
|
||||
|
||||
for (int x = 0; x < ic.getSizeInventory(); x++) {
|
||||
ic.setInventorySlotContents(x, this.crafting.getStackInSlot(x));
|
||||
}
|
||||
|
||||
final ItemStack is = CraftingManager.getInstance().findMatchingRecipe(ic, this.getPlayerInv().player.worldObj);
|
||||
this.cOut.setInventorySlotContents(0, is);
|
||||
return is;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ItemStack[] getOutputs() {
|
||||
if (this.isCraftingMode()) {
|
||||
final ItemStack out = this.getAndUpdateOutput();
|
||||
if (out != null && out.stackSize > 0) {
|
||||
return new ItemStack[] { out };
|
||||
}
|
||||
}
|
||||
return super.getOutputs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlotEnabled(final int idx) {
|
||||
if (idx == 1) {
|
||||
return Platform.isServer() ? !this.patternTerminal.isCraftingRecipe() : !this.isCraftingMode();
|
||||
} else if (idx == 2) {
|
||||
return Platform.isServer() ? this.patternTerminal.isCraftingRecipe() : this.isCraftingMode();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
if (Platform.isServer()) {
|
||||
if (this.isCraftingMode() != this.patternTerminal.isCraftingRecipe()) {
|
||||
this.setCraftingMode(this.patternTerminal.isCraftingRecipe());
|
||||
this.updateOrderOfOutputSlots();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(final String field, final Object oldValue, final Object newValue) {
|
||||
super.onUpdate(field, oldValue, newValue);
|
||||
if (field.equals("craftingMode")) {
|
||||
this.getAndUpdateOutput();
|
||||
this.updateOrderOfOutputSlots();
|
||||
}
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
super.clear();
|
||||
this.getAndUpdateOutput();
|
||||
}
|
||||
|
||||
private void setCraftingMode(final boolean craftingMode) {
|
||||
this.craftingMode = craftingMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doubleStacks(int val) {
|
||||
if (!isCraftingMode()) {
|
||||
super.doubleStacks(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
-153
@@ -1,153 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
import com.glodblock.github.client.gui.container.base.FCContainerEncodeTerminal;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.container.slot.IOptionalSlotHost;
|
||||
import appeng.container.slot.OptionalSlotFake;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ContainerFluidPatternTerminalEx extends FCContainerEncodeTerminal {
|
||||
|
||||
private static final int CRAFTING_GRID_PAGES = 2;
|
||||
private static final int CRAFTING_GRID_WIDTH = 4;
|
||||
private static final int CRAFTING_GRID_HEIGHT = 4;
|
||||
private static final int CRAFTING_GRID_SLOTS = CRAFTING_GRID_WIDTH * CRAFTING_GRID_HEIGHT;
|
||||
|
||||
public ContainerFluidPatternTerminalEx(final InventoryPlayer ip, final ITerminalHost monitorable) {
|
||||
super(ip, monitorable);
|
||||
this.craftingSlots = new ProcessingSlotFake[CRAFTING_GRID_SLOTS * CRAFTING_GRID_PAGES];
|
||||
this.outputSlots = new ProcessingSlotFake[CRAFTING_GRID_SLOTS * CRAFTING_GRID_PAGES];
|
||||
final IInventory output = this.getPatternTerminal().getInventoryByName("output");
|
||||
for (int page = 0; page < CRAFTING_GRID_PAGES; page++) {
|
||||
for (int y = 0; y < CRAFTING_GRID_HEIGHT; y++) {
|
||||
for (int x = 0; x < CRAFTING_GRID_WIDTH; x++) {
|
||||
this.addSlotToContainer(
|
||||
this.craftingSlots[x + y * CRAFTING_GRID_WIDTH
|
||||
+ page * CRAFTING_GRID_SLOTS] = new ProcessingSlotFake(
|
||||
crafting,
|
||||
this,
|
||||
x + y * CRAFTING_GRID_WIDTH + page * CRAFTING_GRID_SLOTS,
|
||||
15,
|
||||
-83,
|
||||
x,
|
||||
y,
|
||||
x + 4));
|
||||
}
|
||||
}
|
||||
for (int x = 0; x < CRAFTING_GRID_WIDTH; x++) {
|
||||
for (int y = 0; y < CRAFTING_GRID_HEIGHT; y++) {
|
||||
this.addSlotToContainer(
|
||||
this.outputSlots[x * CRAFTING_GRID_HEIGHT + y
|
||||
+ page * CRAFTING_GRID_SLOTS] = new ProcessingSlotFake(
|
||||
output,
|
||||
this,
|
||||
x * CRAFTING_GRID_HEIGHT + y + page * CRAFTING_GRID_SLOTS,
|
||||
112,
|
||||
-83,
|
||||
-x,
|
||||
y,
|
||||
x));
|
||||
}
|
||||
}
|
||||
}
|
||||
this.craftingMode = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlotEnabled(final int idx) {
|
||||
if (idx < 4) // outputs
|
||||
{
|
||||
return inverted || idx == 0;
|
||||
} else {
|
||||
return !inverted || idx == 4;
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean validPatternSlot(Slot slot) {
|
||||
return slot instanceof ProcessingSlotFake;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
if (Platform.isServer()) {
|
||||
if (inverted != patternTerminal.isInverted() || activePage != patternTerminal.getActivePage()) {
|
||||
inverted = patternTerminal.isInverted();
|
||||
activePage = patternTerminal.getActivePage();
|
||||
offsetSlots();
|
||||
}
|
||||
}
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
|
||||
private void offsetSlots() {
|
||||
for (int page = 0; page < CRAFTING_GRID_PAGES; page++) {
|
||||
for (int y = 0; y < CRAFTING_GRID_HEIGHT; y++) {
|
||||
for (int x = 0; x < CRAFTING_GRID_WIDTH; x++) {
|
||||
((ProcessingSlotFake) this.craftingSlots[x + y * CRAFTING_GRID_WIDTH + page * CRAFTING_GRID_SLOTS])
|
||||
.setHidden(page != activePage || x > 0 && inverted);
|
||||
((ProcessingSlotFake) this.outputSlots[x * CRAFTING_GRID_HEIGHT + y + page * CRAFTING_GRID_SLOTS])
|
||||
.setHidden(page != activePage || x > 0 && !inverted);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(String field, Object oldValue, Object newValue) {
|
||||
super.onUpdate(field, oldValue, newValue);
|
||||
if (field.equals("inverted") || field.equals("activePage")) {
|
||||
offsetSlots();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlotChange(final Slot s) {
|
||||
if (s == this.patternSlotOUT && Platform.isServer()) {
|
||||
inverted = patternTerminal.isInverted();
|
||||
}
|
||||
super.onSlotChange(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAction(EntityPlayerMP player, InventoryAction action, int slotId, long id) {
|
||||
this.craftingMode = false;
|
||||
super.doAction(player, action, slotId, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void encode() {
|
||||
this.craftingMode = false;
|
||||
super.encode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCraftingMode() {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static class ProcessingSlotFake extends OptionalSlotFake {
|
||||
|
||||
private static final int POSITION_SHIFT = 9000;
|
||||
private boolean hidden = false;
|
||||
|
||||
public ProcessingSlotFake(IInventory inv, IOptionalSlotHost containerBus, int idx, int x, int y, int offX,
|
||||
int offY, int groupNum) {
|
||||
super(inv, containerBus, idx, x, y, offX, offY, groupNum);
|
||||
this.setRenderDisabled(false);
|
||||
}
|
||||
|
||||
public void setHidden(boolean hide) {
|
||||
if (this.hidden != hide) {
|
||||
this.hidden = hide;
|
||||
this.xDisplayPosition += (hide ? -1 : 1) * POSITION_SHIFT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-17
@@ -1,17 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
|
||||
public class ContainerFluidPatternWireless extends ContainerFluidPatternTerminal {
|
||||
|
||||
public ContainerFluidPatternWireless(InventoryPlayer ip, IWirelessTerminal monitorable) {
|
||||
super(ip, monitorable);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isWirelessTerminal() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Loaded 100 of 617 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user