mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-10-26 14:24:23 +00:00
Compare commits
236
Commits
1.4.25-gtnh
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
358c238e17 | ||
|
|
e16be431c3 | ||
|
|
df71dd52b2 | ||
|
|
c7ec5b0c8b | ||
|
|
ec682b28c3 | ||
|
|
ff129e46d9 | ||
|
|
e670a0c3c0 | ||
|
|
b23c816d69 | ||
|
|
6e8dd013bd | ||
|
|
5e4cf83fff | ||
|
|
47300b8980 | ||
|
|
3c6a5d8933 | ||
|
|
c05448f8b3 | ||
|
|
31746024ee | ||
|
|
1706b5a8da | ||
|
|
d89808dc0b | ||
|
|
e7effee580 | ||
|
|
869613ae31 | ||
|
|
6bec3e7e3a | ||
|
|
c251372e95 | ||
|
|
5315b79c70 | ||
|
|
23d2142084 | ||
|
|
049156e63e | ||
|
|
3d445d7988 | ||
|
|
79648a17b5 | ||
|
|
965d3d9db6 | ||
|
|
8d7bde168d | ||
|
|
2352510223 | ||
|
|
5f9c1b236e | ||
|
|
3f5903aad4 | ||
|
|
10cd1d50ab | ||
|
|
7014b7eaca | ||
|
|
e50d549085 | ||
|
|
f381726ef2 | ||
|
|
c1de99049c | ||
|
|
31533e96df | ||
|
|
7124e812d1 | ||
|
|
edac0cdec6 | ||
|
|
3b67b77572 | ||
|
|
208e4d66d9 | ||
|
|
1aba13e96f | ||
|
|
dd05ae29c1 | ||
|
|
44dfa4d551 | ||
|
|
0a84d208f3 | ||
|
|
4a030a52b6 | ||
|
|
ead0aff1ae | ||
|
|
04d80384b2 | ||
|
|
1b5680d2fd | ||
|
|
0bccb9bc5c | ||
|
|
caf1b282a7 | ||
|
|
1f2613b331 | ||
|
|
a7bf25fcf0 | ||
|
|
07ce2fd1ea | ||
|
|
387c740dcb | ||
|
|
31a9034b8e | ||
|
|
a108986cbb | ||
|
|
abecbe8506 | ||
|
|
36671559a8 | ||
|
|
9c50bb0d70 | ||
|
|
d89a67d3db | ||
|
|
a684a07d7c | ||
|
|
ac0e0de363 | ||
|
|
f98e44d106 | ||
|
|
e66050c78d | ||
|
|
4313dbb4e0 | ||
|
|
fda338525e | ||
|
|
d69e7559cf | ||
|
|
fc2507477a | ||
|
|
e372300ced | ||
|
|
18f337c193 | ||
|
|
1e98b07ed5 | ||
|
|
184c4be4f2 | ||
|
|
a5f030223e | ||
|
|
1bca87de0c | ||
|
|
ed8a9f8372 | ||
|
|
e338176386 | ||
|
|
d97285ba52 | ||
|
|
a7fdb3ce7e | ||
|
|
62117facd5 | ||
|
|
59e596b0ba | ||
|
|
dfabc1c62b | ||
|
|
f02e72e96a | ||
|
|
c13cd0492a | ||
|
|
6160248ab3 | ||
|
|
16d18145b5 | ||
|
|
a93ddd5191 | ||
|
|
f3c3a81681 | ||
|
|
1ea9b2e410 | ||
|
|
cf189f00a3 | ||
|
|
a121342a4b | ||
|
|
e62215f02b | ||
|
|
f4c6d8a3f0 | ||
|
|
72a068b6d6 | ||
|
|
58cdd446a7 | ||
|
|
af032179f6 | ||
|
|
9732625ced | ||
|
|
f23d792b91 | ||
|
|
f6c3227cd9 | ||
|
|
20f03a8e9f | ||
|
|
341f1d9236 | ||
|
|
0f68feb0be | ||
|
|
300bb445e2 | ||
|
|
4cf54e7658 | ||
|
|
95dad4d305 | ||
|
|
f24e014bd7 | ||
|
|
ac4bfc9411 | ||
|
|
f8b19c7e16 | ||
|
|
f6b5ab03f1 | ||
|
|
90031e2fc8 | ||
|
|
93688313e6 | ||
|
|
b95dc4df18 | ||
|
|
d650636479 | ||
|
|
2e6bfe6aac | ||
|
|
219f8c313a | ||
|
|
0d5f682d3a | ||
|
|
adee911b77 | ||
|
|
8909e28ea3 | ||
|
|
0207ffe430 | ||
|
|
3bb08974ce | ||
|
|
2a2f22ce44 | ||
|
|
4a2b662dee | ||
|
|
d9ccbe4bb1 | ||
|
|
488b08f1fa | ||
|
|
6490451dc8 | ||
|
|
b0f0c22eae | ||
|
|
32af02239d | ||
|
|
f9c5b9bc41 | ||
|
|
3621f4ac62 | ||
|
|
8d9150bad9 | ||
|
|
7aaa651632 | ||
|
|
03140c9d9a | ||
|
|
826f966a46 | ||
|
|
f755ba66d5 | ||
|
|
98f40ca0fa | ||
|
|
ef7a5d4d86 | ||
|
|
0d91a7dd43 | ||
|
|
d49b319954 | ||
|
|
a955757cd7 | ||
|
|
855fe03f75 | ||
|
|
9a7630bdfa | ||
|
|
8c2bd3ceef | ||
|
|
0d58fe01b2 | ||
|
|
550e3b2bab | ||
|
|
d6ae1cf144 | ||
|
|
de2f625577 | ||
|
|
029b479297 | ||
|
|
446920485a | ||
|
|
a48914c55c | ||
|
|
f5bdb35783 | ||
|
|
99822efb6d | ||
|
|
4c19501f38 | ||
|
|
ec26b6a372 | ||
|
|
697217c5cd | ||
|
|
80bcb3bdf3 | ||
|
|
8fe16e87bc | ||
|
|
e471c1b38c | ||
|
|
81c975ce12 | ||
|
|
17d9ae47c0 | ||
|
|
bbcea46300 | ||
|
|
01b08897d2 | ||
|
|
64ecb14e96 | ||
|
|
12bdd5ebfc | ||
|
|
10ee6f40ca | ||
|
|
1e66772abc | ||
|
|
ae7af4e712 | ||
|
|
f9566ce891 | ||
|
|
8267150fa6 | ||
|
|
22b73f9fbf | ||
|
|
4669a1e4ed | ||
|
|
c86370caf9 | ||
|
|
10fefc7996 | ||
|
|
8a086d714a | ||
|
|
25abc806df | ||
|
|
04558b6913 | ||
|
|
0499adcc6f | ||
|
|
35136c31ee | ||
|
|
dffd8e07e0 | ||
|
|
88c5b6be72 | ||
|
|
0095f69da2 | ||
|
|
bfba45e796 | ||
|
|
dee1277753 | ||
|
|
6ac5ea30f0 | ||
|
|
1ffcea9dd9 | ||
|
|
3428c86f64 | ||
|
|
c504dbb28a | ||
|
|
fe3168ed6e | ||
|
|
c5cea9eb19 | ||
|
|
5cc8534ba2 | ||
|
|
410e33faa0 | ||
|
|
f235a68266 | ||
|
|
47e41751df | ||
|
|
df1384a7ee | ||
|
|
a70854c832 | ||
|
|
a57cb5db52 | ||
|
|
c0d438f774 | ||
|
|
830ac91521 | ||
|
|
1a959b5b8d | ||
|
|
f629b3a7da | ||
|
|
c9cf92ca4a | ||
|
|
6e613b33af | ||
|
|
3af7873882 | ||
|
|
412c6d9cf2 | ||
|
|
ddd046fa15 | ||
|
|
f72dde88e6 | ||
|
|
aecddfb94a | ||
|
|
3bc871e541 | ||
|
|
452f9d9620 | ||
|
|
bd67f35f36 | ||
|
|
a03db709ba | ||
|
|
56703bf498 | ||
|
|
d222b00de2 | ||
|
|
a4a5dcd9d8 | ||
|
|
c724875af6 | ||
|
|
3952557fa2 | ||
|
|
be8457d829 | ||
|
|
3bcbed7c44 | ||
|
|
64a17f61f4 | ||
|
|
613ca10f74 | ||
|
|
cdfe803f16 | ||
|
|
3b66cab727 | ||
|
|
e90c29413d | ||
|
|
77cfc0ba64 | ||
|
|
a7f00c1830 | ||
|
|
2f8d51183d | ||
|
|
21794f5a9f | ||
|
|
a4bf54f1b9 | ||
|
|
546d2f504b | ||
|
|
23e80c7dd9 | ||
|
|
8b61980087 | ||
|
|
d78618d950 | ||
|
|
e88af75f40 | ||
|
|
7b8d87477b | ||
|
|
149b9e36ba | ||
|
|
b14bded93c | ||
|
|
bedb2c25e1 | ||
|
|
0908e906d2 |
No files matched your search
@@ -0,0 +1,17 @@
|
||||
name: Optimize images
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, main, release/** ]
|
||||
paths:
|
||||
- "**/*.png"
|
||||
|
||||
push:
|
||||
branches: [ master, main, release/** ]
|
||||
paths:
|
||||
- "**/*.png"
|
||||
|
||||
jobs:
|
||||
optimize-images:
|
||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.yml@master
|
||||
secrets: inherit
|
||||
@@ -28,6 +28,7 @@ whitelist.json
|
||||
*.iws
|
||||
src/main/resources/mixins.*([!.]).json
|
||||
*.bat
|
||||
*.sh
|
||||
*.DS_Store
|
||||
!gradlew.bat
|
||||
.factorypath
|
||||
|
||||
+14
-24
@@ -34,32 +34,22 @@
|
||||
* 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.25-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-527-GTNH:dev')
|
||||
api('curse.maven:cofh-core-69162:2388751')
|
||||
api('com.github.GTNewHorizons:waila:1.8.2:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.6.3:dev")
|
||||
api('com.github.GTNewHorizons:NotEnoughItems:2.8.160-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-1078-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:waila:1.19.34:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.11.52:dev")
|
||||
|
||||
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.11.7:dev") {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
|
||||
}
|
||||
|
||||
compileOnly("com.github.GTNewHorizons:GTNHLib:0.6.3:dev") { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.0.3:dev')
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.25-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.64:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.35:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.10.1:dev')
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.9.2:dev')
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.51.93:dev') {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework'
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.39:dev')
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.49:dev')
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.64-GTNH:dev') { transitive = false }
|
||||
|
||||
compileOnly("org.jetbrains:annotations:26.1.0")
|
||||
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.4.6:dev")
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:WirelessCraftingTerminal:1.12.16:dev") {
|
||||
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.4-GTNH:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.7.5-GTNH:dev') { transitive = false }
|
||||
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.6.20:dev") { transitive = false }
|
||||
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.3.4:dev")
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:0.6.3:dev")
|
||||
}
|
||||
+47
-7
@@ -14,7 +14,7 @@ modId = ae2fc
|
||||
modGroup = com.glodblock.github
|
||||
|
||||
# Whether to use modGroup as the maven publishing group.
|
||||
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
|
||||
# When false, com.github.GTNewHorizons is used.
|
||||
useModGroupForPublishing = false
|
||||
|
||||
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
|
||||
@@ -39,9 +39,33 @@ remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/co
|
||||
# `./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 modern Java syntax support. Valid values:
|
||||
# - false: No modern syntax, Java 8 only
|
||||
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
|
||||
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
|
||||
# - modern: Native modern Java bytecode, no downgrading
|
||||
enableModernJavaSyntax = jabel
|
||||
|
||||
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
|
||||
# and should *not* be used in most situations. -1 disables this.
|
||||
# forceToolchainVersion = -1
|
||||
|
||||
# Target JVM version for JVM Downgrader bytecode downgrading.
|
||||
# Only used when enableModernJavaSyntax = jvmDowngrader
|
||||
# downgradeTargetVersion = 8
|
||||
|
||||
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
|
||||
# Classes will be available in META-INF/versions/N/ for each version N in this list.
|
||||
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
|
||||
# jvmDowngraderMultiReleaseVersions = 21,25
|
||||
|
||||
# Specifies how JVM Downgrader API stubs are provided. Options:
|
||||
# - shade: Shade minimized stubs into the jar
|
||||
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
|
||||
# - external: Another dependency provides stubs (no constraint, no warning)
|
||||
# - (empty): Warning reminding you to configure stubs
|
||||
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
|
||||
# jvmDowngraderStubsProvider =
|
||||
|
||||
# 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.
|
||||
@@ -96,13 +120,15 @@ 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!
|
||||
# Specify the package that contains all of your Mixins. The package must exist or
|
||||
# the build will fail. If you have a package property defined in your mixins.<modid>.json,
|
||||
# it must match with this 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
|
||||
coreModClass =
|
||||
|
||||
# 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!
|
||||
@@ -151,7 +177,7 @@ modrinthProjectId =
|
||||
# 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
|
||||
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
|
||||
modrinthRelations =
|
||||
|
||||
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
|
||||
@@ -160,6 +186,11 @@ modrinthRelations =
|
||||
# Leave this empty if you don't want to publish on CurseForge.
|
||||
curseForgeProjectId =
|
||||
|
||||
# Comma-separated supported CurseForge environments: client, server (case-insensitive).
|
||||
# Use client or server for mods that only support one environment. Defaults to client,server.
|
||||
# These tags describe where the mod can run, not whether installation is required on both sides.
|
||||
curseForgeEnvironments = client,server
|
||||
|
||||
# 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],
|
||||
@@ -172,6 +203,12 @@ curseForgeRelations =
|
||||
# projects. New projects should not use this parameter.
|
||||
# customArchiveBaseName =
|
||||
|
||||
# Optional parameter to customize the default working directory used by the runClient* tasks. Relative to the project directory.
|
||||
# runClientWorkingDirectory = run/client
|
||||
|
||||
# Optional parameter to customize the default working directory used by the runServer* tasks. Relative to the project directory.
|
||||
# runServerWorkingDirectory = run/server
|
||||
|
||||
# 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.
|
||||
@@ -201,3 +238,6 @@ curseForgeRelations =
|
||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||
# ideaCheckSpotlessOnBuild = true
|
||||
|
||||
# Non-GTNH properties
|
||||
org.gradle.configuration-cache = true
|
||||
org.gradle.parallel = true
|
||||
@@ -0,0 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/9064f22734b42ac03e85df04b632e167/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/4d0277c49991306ac78048580fe34bcf/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a9fa3b809e484a1e1ac4308a5dda661a/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/aa99913fa6d767d899ffc96082da01ca/redirect
|
||||
toolchainVersion=25
|
||||
Vendored
BIN
Binary file not shown.
+3
-1
@@ -1,7 +1,9 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
|
||||
networkTimeout=10000
|
||||
retries=0
|
||||
retryBackOffMs=500
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
# Copyright © 2015 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.
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
# gradlew start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
@@ -29,7 +29,7 @@
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
# ksh gradlew
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
@@ -57,7 +57,7 @@
|
||||
# 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
|
||||
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/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/.
|
||||
@@ -86,8 +86,7 @@ done
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||
' "$PWD" ) || exit
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@@ -115,7 +114,6 @@ case "$( uname )" in #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@@ -173,7 +171,6 @@ fi
|
||||
# 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" )
|
||||
|
||||
@@ -206,15 +203,14 @@ fi
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
|
||||
Vendored
+12
-24
@@ -19,12 +19,12 @@
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem gradlew startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
@rem Set local scope for the variables, and ensure extensions are enabled
|
||||
setlocal EnableExtensions
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@@ -51,7 +51,7 @@ echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
"%COMSPEC%" /c exit 1
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
@@ -65,30 +65,18 @@ echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
"%COMSPEC%" /c exit 1
|
||||
|
||||
: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 %*
|
||||
@rem Execute gradlew
|
||||
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
|
||||
@rem which allows us to clear the local environment before executing the java command
|
||||
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
:exitWithErrorLevel
|
||||
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
|
||||
"%COMSPEC%" /c exit %ERRORLEVEL%
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 8.6 KiB |
@@ -1,4 +1,5 @@
|
||||
// Add any additional repositories for your dependencies here
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
}
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.31'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.34'
|
||||
}
|
||||
|
||||
|
||||
@@ -3,18 +3,14 @@ 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 com.glodblock.github.proxy.CommonProxy;
|
||||
import com.glodblock.github.util.FluidCellHandler;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -22,18 +18,15 @@ 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;
|
||||
|
||||
@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")
|
||||
dependencies = "required-after:appliedenergistics2@[rv3-beta-238,);after:waila;after:thaumicenergistics;after:ae2wct")
|
||||
public class FluidCraft {
|
||||
|
||||
public static final String MODID = "ae2fc";
|
||||
@@ -69,7 +62,6 @@ public class FluidCraft {
|
||||
@Mod.EventHandler
|
||||
public static void postInit(FMLPostInitializationEvent event) {
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(FluidCraft.INSTANCE, new InventoryHandler());
|
||||
|
||||
AEApi.instance().registries().cell().addCellHandler(new FluidCellHandler());
|
||||
ItemAndBlockHolder.loadSetting();
|
||||
|
||||
@@ -83,13 +75,6 @@ public class FluidCraft {
|
||||
RecipeLoader.runTerminalRecipe();
|
||||
RecipeLoader.addDisassembleRecipe();
|
||||
|
||||
if (ModAndClassUtil.isV2) {
|
||||
CalculatorV2PluginLoader.installCalculatorV2Plugins();
|
||||
}
|
||||
if (ModAndClassUtil.isTypeFilter) {
|
||||
AEApi.instance().registries().itemDisplay().addItemFilter(FluidFilter::filter);
|
||||
}
|
||||
|
||||
proxy.postInit(event);
|
||||
}
|
||||
|
||||
@@ -98,23 +83,6 @@ public class FluidCraft {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.Set;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import com.glodblock.github.api.registries.ILevelTerminalRegistry;
|
||||
import com.glodblock.github.coremod.registries.LevelTerminalRegistry;
|
||||
import com.glodblock.github.util.LevelTerminalRegistry;
|
||||
|
||||
public final class FluidCraftAPI implements IFluidCraftAPI {
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.glodblock.github.api.registries;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import appeng.api.features.ILevelViewable;
|
||||
import appeng.api.networking.IGridHost;
|
||||
|
||||
public interface ILevelTerminalRegistry {
|
||||
|
||||
@@ -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,5 +1,6 @@
|
||||
package com.glodblock.github.api.registries;
|
||||
|
||||
import appeng.api.features.ILevelViewable;
|
||||
import appeng.api.networking.IGridHost;
|
||||
|
||||
public interface ILevelViewableAdapter extends ILevelViewable {
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.glodblock.github.client;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.network.CPacketCustomButtonUpdate;
|
||||
import com.glodblock.github.network.CPacketSwitchGuis;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SidelessMode;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketConfigButton;
|
||||
import appeng.helpers.ICustomButtonDataObject;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class FluidInterfaceButtons implements ICustomButtonDataObject {
|
||||
|
||||
private GuiImgButton sidelessMode;
|
||||
private GuiTabButton switcher;
|
||||
private final boolean fullBlock;
|
||||
public SidelessMode sidelessSate;
|
||||
|
||||
public FluidInterfaceButtons(final boolean fullBlock) {
|
||||
this.fullBlock = fullBlock;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void initCustomButtons(int guiLeft, int guiTop, int xSize, int ySize, int xOffset, int yOffset,
|
||||
List<GuiButton> buttonList) {
|
||||
if (fullBlock) {
|
||||
this.sidelessMode = new GuiImgButton(
|
||||
guiLeft - 18,
|
||||
guiTop + yOffset,
|
||||
Settings.SIDELESS_MODE,
|
||||
SidelessMode.SIDELESS);
|
||||
buttonList.add(this.sidelessMode);
|
||||
}
|
||||
|
||||
this.switcher = new GuiTabButton(
|
||||
guiLeft + 132,
|
||||
guiTop,
|
||||
!fullBlock ? ItemAndBlockHolder.FLUID_INTERFACE.stack() : ItemAndBlockHolder.INTERFACE.stack(),
|
||||
StatCollector.translateToLocal("ae2fc.tooltip.switch_fluid_interface"),
|
||||
RenderItem.getInstance());
|
||||
buttonList.add(this.switcher);
|
||||
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketCustomButtonUpdate());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean actionPerformedCustomButtons(final GuiButton btn) {
|
||||
if (btn == this.switcher) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis());
|
||||
return true;
|
||||
} else if (fullBlock && btn == this.sidelessMode) {
|
||||
final boolean backwards = Mouse.isButtonDown(1);
|
||||
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.sidelessMode.getSetting(), backwards));
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketCustomButtonUpdate());
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(NBTTagCompound tag) {}
|
||||
|
||||
@Override
|
||||
public void writeData(NBTTagCompound tag) {}
|
||||
|
||||
@Override
|
||||
public void readByte(ByteBuf buf) {
|
||||
this.sidelessMode.set(SidelessMode.values()[buf.readInt()]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeByte(ByteBuf buf) {
|
||||
buf.writeInt(this.sidelessSate.ordinal());
|
||||
}
|
||||
|
||||
public void setSidelessMode(SidelessMode sm) {
|
||||
this.sidelessSate = sm;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,246 @@
|
||||
package com.glodblock.github.client;
|
||||
|
||||
import static appeng.util.Platform.nextEnum;
|
||||
import static com.glodblock.github.common.item.ItemWirelessUltraTerminal.MODE;
|
||||
import static com.glodblock.github.inventory.item.WirelessMagnet.modeKey;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.GuiFCImgButton;
|
||||
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
|
||||
import com.glodblock.github.inventory.item.WirelessMagnet;
|
||||
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
|
||||
import com.glodblock.github.network.CPacketSwitchGuis;
|
||||
import com.glodblock.github.util.UltraTerminalModes;
|
||||
|
||||
import appeng.helpers.ICustomButtonDataObject;
|
||||
import appeng.util.Platform;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class UltraTerminalButtons implements ICustomButtonDataObject {
|
||||
|
||||
public static String restockItems = "restock";
|
||||
|
||||
private ItemStack terminal;
|
||||
|
||||
private GuiFCImgButton CraftingTerminal;
|
||||
private GuiFCImgButton PatternTerminal;
|
||||
private GuiFCImgButton InterfaceTerminal;
|
||||
private GuiFCImgButton LevelTerminal;
|
||||
private GuiFCImgButton PatternTerminalEx;
|
||||
|
||||
private GuiFCImgButton magnetOff;
|
||||
private GuiFCImgButton magnetInv;
|
||||
private GuiFCImgButton magnetME;
|
||||
|
||||
private GuiFCImgButton magnetFilter;
|
||||
|
||||
private GuiFCImgButton restockEnableBtn;
|
||||
private GuiFCImgButton restockDisableBtn;
|
||||
|
||||
private WirelessMagnet.Mode magnetMode;
|
||||
private boolean reStock;
|
||||
public UltraTerminalModes terminalMode;
|
||||
|
||||
private int offset;
|
||||
|
||||
public UltraTerminalButtons(ItemStack terminal) {
|
||||
this.terminal = terminal;
|
||||
}
|
||||
|
||||
public void initCustomButtons(int guiLeft, int guiTop, int xSize, int ySize, int xOffset, int yOffset,
|
||||
List<GuiButton> buttonList) {
|
||||
this.offset = yOffset;
|
||||
buttonList.add(
|
||||
this.magnetOff = new GuiFCImgButton(guiLeft + xSize - 17, guiTop + ySize - 65, "MAGNET_CARD", "OFF"));
|
||||
buttonList.add(
|
||||
this.magnetInv = new GuiFCImgButton(guiLeft + xSize - 17, guiTop + ySize - 65, "MAGNET_CARD", "INV"));
|
||||
buttonList.add(
|
||||
this.magnetME = new GuiFCImgButton(guiLeft + xSize - 17, guiTop + ySize - 65, "MAGNET_CARD", "ME"));
|
||||
|
||||
buttonList.add(
|
||||
this.magnetFilter = new GuiFCImgButton(
|
||||
guiLeft + xSize - 17,
|
||||
guiTop + ySize - 45,
|
||||
"MAGNET_CARD",
|
||||
"FILTER"));
|
||||
buttonList.add(
|
||||
this.restockEnableBtn = new GuiFCImgButton(
|
||||
guiLeft + xSize - 17,
|
||||
guiTop + ySize - 25,
|
||||
"RESTOCK",
|
||||
"ENABLE"));
|
||||
|
||||
buttonList.add(
|
||||
this.restockDisableBtn = new GuiFCImgButton(
|
||||
guiLeft + xSize - 17,
|
||||
guiTop + ySize - 25,
|
||||
"RESTOCK",
|
||||
"DISABLE"));
|
||||
|
||||
buttonList.add(this.CraftingTerminal = new GuiFCImgButton(guiLeft - 18, yOffset, "CRAFT_TEM", "YES"));
|
||||
|
||||
buttonList.add(this.PatternTerminal = new GuiFCImgButton(guiLeft - 18, yOffset, "PATTERN_TEM", "YES"));
|
||||
|
||||
buttonList.add(this.PatternTerminalEx = new GuiFCImgButton(guiLeft - 18, yOffset, "PATTERN_EX_TEM", "YES"));
|
||||
|
||||
buttonList.add(this.InterfaceTerminal = new GuiFCImgButton(guiLeft - 18, yOffset, "INTERFACE_TEM", "YES"));
|
||||
|
||||
buttonList.add(this.LevelTerminal = new GuiFCImgButton(guiLeft - 18, yOffset, "LEVEL_TEM", "YES"));
|
||||
|
||||
toggleSwitchButtons();
|
||||
toggleMagnetButtonsVisibility();
|
||||
toggleRestockVisibility();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean actionPerformedCustomButtons(final GuiButton btn) {
|
||||
if (btn instanceof GuiFCImgButton) {
|
||||
UltraTerminalModes mode = null;
|
||||
if (btn == this.CraftingTerminal) {
|
||||
mode = UltraTerminalModes.CRAFTING;
|
||||
} else if (btn == this.PatternTerminal) {
|
||||
mode = UltraTerminalModes.PATTERN;
|
||||
} else if (btn == this.InterfaceTerminal) {
|
||||
mode = UltraTerminalModes.INTERFACE;
|
||||
} else if (btn == this.LevelTerminal) {
|
||||
mode = UltraTerminalModes.LEVEL;
|
||||
} else if (btn == this.PatternTerminalEx) {
|
||||
mode = UltraTerminalModes.PATTERN_EX;
|
||||
}
|
||||
if (mode != null) {
|
||||
ItemWirelessUltraTerminal.setMode(this.terminal, mode);
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis(mode, true));
|
||||
}
|
||||
|
||||
if (btn == this.magnetOff || btn == this.magnetME || btn == this.magnetInv) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns(
|
||||
CPacketFluidPatternTermBtns.Command.MAGNET_MODE,
|
||||
this.magnetMode.ordinal()));
|
||||
} else if (btn == this.magnetFilter) FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns(CPacketFluidPatternTermBtns.Command.MAGNET_OPEN_FILTER, 0));
|
||||
else if (btn == this.restockDisableBtn || btn == this.restockEnableBtn) {
|
||||
FluidCraft.proxy.netHandler
|
||||
.sendToServer(new CPacketFluidPatternTermBtns(CPacketFluidPatternTermBtns.Command.RESTOCK, 1));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void toggleRestock() {
|
||||
this.reStock = !this.reStock;
|
||||
}
|
||||
|
||||
public void toggleRestockVisibility() {
|
||||
if (Platform.isClient()) {
|
||||
if (this.reStock) {
|
||||
this.restockEnableBtn.setVisibility(true);
|
||||
this.restockDisableBtn.setVisibility(false);
|
||||
} else {
|
||||
this.restockEnableBtn.setVisibility(false);
|
||||
this.restockDisableBtn.setVisibility(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void toggleMagnetMode() {
|
||||
this.magnetMode = nextEnum(this.magnetMode);
|
||||
}
|
||||
|
||||
public void toggleMagnetButtonsVisibility() {
|
||||
switch (this.magnetMode) {
|
||||
case Off -> {
|
||||
this.magnetME.setVisibility(false);
|
||||
this.magnetInv.setVisibility(false);
|
||||
this.magnetOff.setVisibility(true);
|
||||
}
|
||||
case ME -> {
|
||||
this.magnetME.setVisibility(true);
|
||||
this.magnetInv.setVisibility(false);
|
||||
this.magnetOff.setVisibility(false);
|
||||
}
|
||||
case Inv -> {
|
||||
this.magnetME.setVisibility(false);
|
||||
this.magnetInv.setVisibility(true);
|
||||
this.magnetOff.setVisibility(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void toggleSwitchButtons() {
|
||||
int offset = this.offset;
|
||||
|
||||
CraftingTerminal.setVisibility(false);
|
||||
PatternTerminal.setVisibility(false);
|
||||
InterfaceTerminal.setVisibility(false);
|
||||
LevelTerminal.setVisibility(false);
|
||||
PatternTerminalEx.setVisibility(false);
|
||||
|
||||
if (this.terminalMode != UltraTerminalModes.CRAFTING) {
|
||||
this.CraftingTerminal.setVisibility(true);
|
||||
this.CraftingTerminal.yPosition = offset;
|
||||
offset += 20;
|
||||
}
|
||||
if (this.terminalMode != UltraTerminalModes.PATTERN) {
|
||||
this.PatternTerminal.setVisibility(true);
|
||||
this.PatternTerminal.yPosition = offset;
|
||||
offset += 20;
|
||||
}
|
||||
if (this.terminalMode != UltraTerminalModes.PATTERN_EX) {
|
||||
this.PatternTerminalEx.setVisibility(true);
|
||||
this.PatternTerminalEx.yPosition = offset;
|
||||
offset += 20;
|
||||
}
|
||||
if (this.terminalMode != UltraTerminalModes.INTERFACE) {
|
||||
this.InterfaceTerminal.setVisibility(true);
|
||||
this.InterfaceTerminal.yPosition = offset;
|
||||
offset += 20;
|
||||
}
|
||||
if (this.terminalMode != UltraTerminalModes.LEVEL) {
|
||||
this.LevelTerminal.setVisibility(true);
|
||||
this.LevelTerminal.yPosition = offset;
|
||||
offset += 20;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(NBTTagCompound tag) {
|
||||
this.reStock = tag.getBoolean(restockItems);
|
||||
this.magnetMode = WirelessMagnet.Mode.values()[tag.getInteger(modeKey)];
|
||||
this.terminalMode = UltraTerminalModes.VALUES[tag.getInteger(MODE)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeData(NBTTagCompound tag) {
|
||||
tag.setBoolean(restockItems, this.reStock);
|
||||
tag.setInteger(modeKey, this.magnetMode.ordinal());
|
||||
tag.setInteger(MODE, this.terminalMode.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readByte(ByteBuf buf) {
|
||||
this.reStock = buf.readBoolean();
|
||||
this.magnetMode = WirelessMagnet.Mode.values()[buf.readInt()];
|
||||
this.terminalMode = UltraTerminalModes.VALUES[buf.readInt()];
|
||||
ItemWirelessUltraTerminal.setMode(this.terminal, this.terminalMode);
|
||||
|
||||
toggleMagnetButtonsVisibility();
|
||||
toggleRestockVisibility();
|
||||
toggleSwitchButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeByte(ByteBuf buf) {
|
||||
buf.writeBoolean(this.reStock);
|
||||
buf.writeInt(this.magnetMode.ordinal());
|
||||
buf.writeInt(this.terminalMode.ordinal());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
// copy from WirelessCraftingTerminal WCTGuiButton
|
||||
public class FCGuiBaseButton extends GuiButton {
|
||||
|
||||
protected static final ResourceLocation buttonTextures = new ResourceLocation(
|
||||
"minecraft",
|
||||
"textures/gui/widgets.png");
|
||||
|
||||
public FCGuiBaseButton(int id, int xPosition, int yPosition, int width, int height, String displayString) {
|
||||
super(id, xPosition, yPosition, width, height, displayString);
|
||||
this.enabled = true;
|
||||
this.visible = true;
|
||||
this.id = id;
|
||||
this.xPosition = xPosition;
|
||||
this.yPosition = yPosition;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.displayString = displayString;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
if (this.visible) {
|
||||
FontRenderer fontrenderer = mc.fontRenderer;
|
||||
mc.getTextureManager().bindTexture(buttonTextures);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition
|
||||
&& mouseX < this.xPosition + this.width
|
||||
&& mouseY < this.yPosition + this.height;
|
||||
int k = this.getHoverState(this.field_146123_n);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + k * 20, this.width / 2, this.height);
|
||||
this.drawTexturedModalRect(
|
||||
this.xPosition + this.width / 2,
|
||||
this.yPosition,
|
||||
200 - this.width / 2,
|
||||
46 + k * 20,
|
||||
this.width / 2,
|
||||
this.height - 2);
|
||||
this.drawTexturedModalRect(
|
||||
this.xPosition + 2,
|
||||
this.yPosition + (this.height - 2),
|
||||
200 - (this.width - 2),
|
||||
64 + k * 20,
|
||||
this.width - 2,
|
||||
2);
|
||||
this.drawTexturedModalRect(
|
||||
this.xPosition,
|
||||
this.yPosition + (this.height - 1),
|
||||
200 - this.width,
|
||||
65 + k * 20,
|
||||
this.width,
|
||||
1);
|
||||
this.mouseDragged(mc, mouseX, mouseY);
|
||||
|
||||
int l = 14737632;
|
||||
|
||||
if (packedFGColour != 0) {
|
||||
l = packedFGColour;
|
||||
} else if (!this.enabled) {
|
||||
l = 10526880;
|
||||
} else if (this.field_146123_n) {
|
||||
l = 16777120;
|
||||
}
|
||||
|
||||
this.drawCenteredString(
|
||||
fontrenderer,
|
||||
this.displayString,
|
||||
this.xPosition + this.width / 2,
|
||||
this.yPosition + (this.height - 8) / 2,
|
||||
l);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,80 +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.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.util.Ae2ReflectClient;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,6 +22,7 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
private static Map<EnumPair, ButtonAppearance> appearances;
|
||||
private final String buttonSetting;
|
||||
private boolean halfSize = false;
|
||||
private boolean threeFourths = false;
|
||||
private String fillVar;
|
||||
private String currentValue;
|
||||
private final boolean background;
|
||||
@@ -48,7 +49,7 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
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(5, "RENAME", "YES", "rename");
|
||||
this.registerApp(6, "DISABLE", "DISABLE", "disable");
|
||||
this.registerApp(7, "ENABLE", "ENABLE", "enable");
|
||||
this.registerApp(10, "FLUID_TEM", "YES", "fluid_terminal_w");
|
||||
@@ -64,8 +65,18 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
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(23, "OPEN_GUI", "YES", "open_gui");
|
||||
this.registerApp(24, "HIGHLIGHT", "YES", "block_highlight");
|
||||
this.registerApp(26, "stock mode button", "normalMode", "Normal.mode");
|
||||
this.registerApp(27, "stock mode button", "fullstockMode", "Full-stock.mode");
|
||||
this.registerApp(30, "MAGNET_CARD", "INV", "magnet_card.inv");
|
||||
this.registerApp(30, "MAGNET_CARD", "ME", "magnet_card.me");
|
||||
this.registerApp(30, "MAGNET_CARD", "FILTER", "magnet_card.filter");
|
||||
this.registerApp(31, "MAGNET_CARD", "OFF", "magnet_card.off");
|
||||
this.registerApp(32, "ENABLE_12x", "ENABLE", "enable");
|
||||
this.registerApp(33, "DISABLE_12x", "DISABLE", "disable");
|
||||
this.registerApp(34, "RESTOCK", "ENABLE", "restock.on");
|
||||
this.registerApp(35, "RESTOCK", "DISABLE", "restock.off");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,6 +146,14 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
this.halfSize = halfSize;
|
||||
}
|
||||
|
||||
public boolean isThreeFourths() {
|
||||
return threeFourths;
|
||||
}
|
||||
|
||||
public void setThreeFourths(boolean threeFourths) {
|
||||
this.threeFourths = threeFourths;
|
||||
}
|
||||
|
||||
public String getFillVar() {
|
||||
return this.fillVar;
|
||||
}
|
||||
@@ -155,12 +174,12 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return this.halfSize ? 8 : 16;
|
||||
return this.halfSize ? 8 : threeFourths ? 12 : 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return this.halfSize ? 8 : 16;
|
||||
return this.halfSize ? 8 : threeFourths ? 12 : 16;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -217,79 +236,44 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
if (this.visible) {
|
||||
final int iconIndex = this.getIconIndex();
|
||||
final int iconPage = this.getIconPage();
|
||||
this.width = getWidth();
|
||||
this.height = getHeight();
|
||||
float scaleFactor = halfSize ? 3 : threeFourths ? 4.5f : 6;
|
||||
|
||||
if (this.halfSize) {
|
||||
this.width = 8;
|
||||
this.height = 8;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(this.xPosition, this.yPosition, 0.0F);
|
||||
GL11.glScalef(0.5f / 16 * 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));
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(this.xPosition, this.yPosition, 0.0F);
|
||||
GL11.glScalef(0.5f / 16 * scaleFactor, 0.5f / 16 * scaleFactor, 0.5f / 16 * scaleFactor);
|
||||
|
||||
if (this.enabled) {
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
} else {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(this.xPosition, this.yPosition, 0.0F);
|
||||
GL11.glScalef(0.5f / 16 * 6, 0.5f / 16 * 6, 0.5f / 16 * 6);
|
||||
if (this.enabled) {
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
} else {
|
||||
GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
}
|
||||
GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
}
|
||||
|
||||
par1Minecraft.renderEngine.bindTexture(FluidCraft.resource("textures/gui/states" + iconPage + ".png"));
|
||||
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition
|
||||
&& par2 < this.xPosition + this.width
|
||||
&& par3 < this.yPosition + this.height;
|
||||
par1Minecraft.renderEngine.bindTexture(FluidCraft.resource("textures/gui/states" + iconPage + ".png"));
|
||||
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition
|
||||
&& par2 < this.xPosition + this.width
|
||||
&& par3 < this.yPosition + this.height;
|
||||
|
||||
final int uv_y = (int) Math.floor(iconIndex / 3.0);
|
||||
final int uv_x = iconIndex - uv_y * 3;
|
||||
if (this.background) {
|
||||
this.drawTexturedModalRect(
|
||||
0,
|
||||
0,
|
||||
Math.round(32F * 16F / 3F),
|
||||
Math.round(32F * 16F / 3F),
|
||||
Math.round(16F * 16F / 3F),
|
||||
Math.round(16F * 16F / 3F));
|
||||
}
|
||||
final int uv_y = (int) Math.floor(iconIndex / 3.0);
|
||||
final int uv_x = iconIndex - uv_y * 3;
|
||||
if (this.background) {
|
||||
this.drawTexturedModalRect(
|
||||
0,
|
||||
0,
|
||||
Math.round(uv_x * 16F * 16F / 3F),
|
||||
Math.round(uv_y * 16F * 16F / 3F),
|
||||
Math.round(32F * 16F / 3F),
|
||||
Math.round(32F * 16F / 3F),
|
||||
Math.round(16F * 16F / 3F),
|
||||
Math.round(16F * 16F / 3F));
|
||||
}
|
||||
this.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();
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
@@ -8,12 +8,13 @@ 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.FCGuiColors;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.client.gui.AEBaseMEGui;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class GuiFluidAutoFiller extends AEBaseMEGui {
|
||||
public class GuiFluidAutoFiller extends AEBaseGui {
|
||||
|
||||
protected EntityPlayer player;
|
||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/fluid_auto_filler.png");
|
||||
@@ -31,7 +32,12 @@ public class GuiFluidAutoFiller extends AEBaseMEGui {
|
||||
|
||||
@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);
|
||||
fontRendererObj.drawString(
|
||||
getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_AUTO_FILLER)),
|
||||
8,
|
||||
6,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
fontRendererObj
|
||||
.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, FCGuiColors.guiTextColorGray.getColor());
|
||||
}
|
||||
}
|
||||
@@ -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,43 +1,35 @@
|
||||
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.FCGuiColors;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.glodblock.github.util.RenderUtil;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.client.gui.GuiSub;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class GuiFluidInterface extends AEBaseGui {
|
||||
public class GuiFluidInterface extends GuiSub {
|
||||
|
||||
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) {
|
||||
@@ -58,36 +50,26 @@ public class GuiFluidInterface extends AEBaseGui {
|
||||
}
|
||||
}
|
||||
|
||||
@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);
|
||||
fontRendererObj.drawString(
|
||||
getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_INTERFACE)),
|
||||
8,
|
||||
6,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
fontRendererObj
|
||||
.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, FCGuiColors.guiTextColorGray.getColor());
|
||||
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);
|
||||
fontRendererObj.drawString(
|
||||
dirName(i),
|
||||
TANK_X + i * TANK_X_OFF + 5,
|
||||
22,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
}
|
||||
RenderUtil.renderFluidIntoGui(
|
||||
this,
|
||||
@@ -112,14 +94,6 @@ public class GuiFluidInterface extends AEBaseGui {
|
||||
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);
|
||||
@@ -129,6 +103,6 @@ public class GuiFluidInterface extends AEBaseGui {
|
||||
}
|
||||
|
||||
private boolean isPart() {
|
||||
return this.cont.getTile() instanceof PartFluidInterface;
|
||||
return this.cont.getTile() instanceof IPart;
|
||||
}
|
||||
}
|
||||
@@ -1,208 +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.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.GuiNumberBox;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiColors;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class GuiFluidLevelEmitter extends GuiUpgradeable {
|
||||
|
||||
private GuiNumberBox level;
|
||||
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 boolean isMul = false;
|
||||
|
||||
public GuiFluidLevelEmitter(final InventoryPlayer inventoryPlayer, final PartFluidLevelEmitter te) {
|
||||
super(new ContainerFluidLevelEmitter(inventoryPlayer, te));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
this.level = new GuiNumberBox(this.fontRendererObj, 24, 43, 79, this.fontRendererObj.FONT_HEIGHT, Long.class);
|
||||
this.level.setEnableBackgroundDrawing(false);
|
||||
this.level.setMaxStringLength(16);
|
||||
this.level.setTextColor(GuiColors.LevelEmitterValue.getColor());
|
||||
this.level.setVisible(true);
|
||||
this.level.setFocused(true);
|
||||
((ContainerFluidLevelEmitter) this.inventorySlots).setTextField(this.level);
|
||||
}
|
||||
|
||||
@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 + 59, 22, 20, "-" + a));
|
||||
this.buttonList.add(this.minus10 = new GuiButton(0, this.guiLeft + 48, this.guiTop + 59, 28, 20, "-" + b));
|
||||
this.buttonList.add(this.minus100 = new GuiButton(0, this.guiLeft + 82, this.guiTop + 59, 32, 20, "-" + c));
|
||||
this.buttonList.add(this.minus1000 = new GuiButton(0, this.guiLeft + 120, this.guiTop + 59, 38, 20, "-" + d));
|
||||
|
||||
this.buttonList.add(this.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());
|
||||
this.level.drawTextBox();
|
||||
if (isShiftKeyDown() && !isMul) {
|
||||
for (Object btn : this.buttonList) {
|
||||
if (btn instanceof GuiButton) {
|
||||
((GuiButton) btn).displayString += "000";
|
||||
}
|
||||
}
|
||||
isMul = true;
|
||||
} else if (!isShiftKeyDown() && isMul) {
|
||||
for (Object btn : this.buttonList) {
|
||||
if (btn instanceof GuiButton) {
|
||||
((GuiButton) btn).displayString = ((GuiButton) btn).displayString
|
||||
.substring(0, ((GuiButton) 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);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleButtonVisibility() {}
|
||||
|
||||
@Override
|
||||
protected String getBackground() {
|
||||
return "guis/lvlemitter.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
final boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
|
||||
final boolean isMinus = btn == this.minus1 || btn == this.minus10
|
||||
|| btn == this.minus100
|
||||
|| btn == this.minus1000;
|
||||
|
||||
if (isPlus || isMinus) {
|
||||
this.addQty(this.getQty(btn));
|
||||
}
|
||||
}
|
||||
|
||||
private void addQty(final long i) {
|
||||
try {
|
||||
String Out = this.level.getText();
|
||||
|
||||
boolean Fixed = false;
|
||||
while (Out.startsWith("0") && Out.length() > 1) {
|
||||
Out = Out.substring(1);
|
||||
Fixed = true;
|
||||
}
|
||||
|
||||
if (Fixed) {
|
||||
this.level.setText(Out);
|
||||
}
|
||||
|
||||
if (Out.isEmpty()) {
|
||||
Out = "0";
|
||||
}
|
||||
|
||||
long result = Long.parseLong(Out);
|
||||
result += i;
|
||||
if (result < 0) {
|
||||
result = 0;
|
||||
}
|
||||
|
||||
this.level.setText(Out = Long.toString(result));
|
||||
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketValueConfig(result, 0));
|
||||
} catch (final NumberFormatException e) {
|
||||
this.level.setText("0");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(final char character, final int key) {
|
||||
if (!this.checkHotbarKeys(key)) {
|
||||
if ((key == 211 || key == 205 || key == 203 || key == 14 || Character.isDigit(character))
|
||||
&& this.level.textboxKeyTyped(character, key)) {
|
||||
try {
|
||||
String Out = this.level.getText();
|
||||
|
||||
boolean Fixed = false;
|
||||
while (Out.startsWith("0") && Out.length() > 1) {
|
||||
Out = Out.substring(1);
|
||||
Fixed = true;
|
||||
}
|
||||
|
||||
if (Fixed) {
|
||||
this.level.setText(Out);
|
||||
}
|
||||
|
||||
if (Out.isEmpty()) {
|
||||
Out = "0";
|
||||
}
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketValueConfig(Long.parseLong(Out), 0));
|
||||
} catch (final NumberFormatException e) {
|
||||
AELog.debug(e);
|
||||
}
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ 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.FCGuiColors;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
@@ -28,7 +29,12 @@ 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);
|
||||
fontRendererObj.drawString(
|
||||
getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_PACKET_DECODER)),
|
||||
8,
|
||||
6,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
fontRendererObj
|
||||
.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, FCGuiColors.guiTextColorGray.getColor());
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ 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.FCGuiColors;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
@@ -50,7 +50,7 @@ public class GuiFluidPatternEncoder extends AEBaseGui {
|
||||
public boolean onClick(int button) {
|
||||
if (button == 0) {
|
||||
if (cont.canEncodePattern()) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketEncodePattern());
|
||||
// FluidCraft.proxy.netHandler.sendToServer(new CPacketEncodePattern());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -74,8 +74,13 @@ 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);
|
||||
fontRendererObj.drawString(
|
||||
getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_PATTERN_ENCODER)),
|
||||
8,
|
||||
6,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
fontRendererObj
|
||||
.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, FCGuiColors.guiTextColorGray.getColor());
|
||||
mouseRegions.render(mouseX, mouseY);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ 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.FCGuiColors;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.glodblock.github.util.RenderUtil;
|
||||
|
||||
@@ -66,8 +67,13 @@ public class GuiIngredientBuffer extends AEBaseGui {
|
||||
|
||||
@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);
|
||||
fontRendererObj.drawString(
|
||||
getGuiDisplayName(I18n.format(NameConst.GUI_INGREDIENT_BUFFER)),
|
||||
8,
|
||||
6,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
fontRendererObj
|
||||
.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, FCGuiColors.guiTextColorGray.getColor());
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
|
||||
IAEFluidTank fluidInv = cont.getTile().getInternalFluid();
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ 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.FCGuiColors;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.glodblock.github.util.RenderUtil;
|
||||
|
||||
@@ -66,9 +67,13 @@ public class GuiLargeIngredientBuffer extends AEBaseGui {
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(
|
||||
getGuiDisplayName(I18n.format(NameConst.GUI_LARGE_INGREDIENT_BUFFER)),
|
||||
8,
|
||||
6,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
fontRendererObj
|
||||
.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_LARGE_INGREDIENT_BUFFER)), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, FCGuiColors.guiTextColorGray.getColor());
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
|
||||
IAEFluidTank fluidInv = cont.getTile().getInternalFluid();
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import appeng.api.parts.ILevelEmitter;
|
||||
import appeng.client.gui.IGuiSub;
|
||||
import appeng.client.gui.implementations.GuiLevelEmitter;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.container.interfaces.IContainerSubGui;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||
|
||||
public class GuiLevelEmitterProxy extends GuiLevelEmitter implements IGuiSub {
|
||||
|
||||
protected final IContainerSubGui container;
|
||||
protected GuiTabButton originalGuiBtn;;
|
||||
|
||||
public GuiLevelEmitterProxy(final InventoryPlayer inventoryPlayer, final ILevelEmitter te) {
|
||||
super(inventoryPlayer, te);
|
||||
this.container = (IContainerSubGui) inventorySlots;
|
||||
this.container.setGuiLink(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
if (container.getPrimaryGuiIcon() != null) initPrimaryGuiButton();
|
||||
}
|
||||
|
||||
public void initPrimaryGuiButton() {
|
||||
this.buttonList.add(
|
||||
this.originalGuiBtn = new GuiTabButton(
|
||||
this.guiLeft + this.xSize - 57,
|
||||
this.guiTop,
|
||||
container.getPrimaryGuiIcon(),
|
||||
container.getPrimaryGuiIcon().getDisplayName(),
|
||||
itemRender));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
if (btn == this.originalGuiBtn) {
|
||||
NetworkHandler.instance.sendToServer(new PacketSwitchGuis());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,165 +1,77 @@
|
||||
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 java.util.regex.Pattern;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
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.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
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 com.gtnewhorizon.gtnhlib.util.parsing.MathExpressionParser;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.api.features.LevelState;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.client.gui.GuiSub;
|
||||
import appeng.client.gui.slots.VirtualMEPhantomSlot;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotFake;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketNEIDragClick;
|
||||
import codechicken.nei.VisiblityData;
|
||||
import codechicken.nei.api.INEIGuiHandler;
|
||||
import codechicken.nei.api.TaggedInventoryArea;
|
||||
import cofh.core.render.CoFHFontRenderer;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import appeng.client.gui.widgets.GuiToggleButton;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.util.calculators.ArithHelper;
|
||||
import appeng.util.calculators.Calculator;
|
||||
|
||||
@Optional.Interface(modid = "NotEnoughItems", iface = "codechicken.nei.api.INEIGuiHandler")
|
||||
public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
public class GuiLevelMaintainer extends GuiSub {
|
||||
|
||||
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 FCGuiTextField input;
|
||||
private int lastWorkingTick;
|
||||
private int refreshTick;
|
||||
private final CoFHFontRenderer render;
|
||||
protected ItemStack icon = null;
|
||||
|
||||
protected GuiType originalGui;
|
||||
protected Util.DimensionalCoordSide originalBlockPos;
|
||||
protected GuiTabButton originalGuiBtn;
|
||||
|
||||
protected static final boolean isGTNHLibLoaded = Loader.isModLoaded("gtnhlib");
|
||||
protected static final Pattern numberPattern = isGTNHLibLoaded ? MathExpressionParser.EXPRESSION_PATTERN
|
||||
: Pattern.compile("^[0-9]+");
|
||||
private Widget focusedWidget;
|
||||
private final FontRenderer render;
|
||||
private GuiToggleButton liteMode;
|
||||
|
||||
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(
|
||||
this.render = new FontRenderer(
|
||||
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].setEnable(isEnable);
|
||||
component[idx].setState(state);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.lastWorkingTick = this.refreshTick;
|
||||
|
||||
for (int i = 0; i < TileLevelMaintainer.REQ_COUNT; i++) {
|
||||
VirtualMEPhantomSlot slot = new VirtualMEPhantomSlot(
|
||||
27,
|
||||
20 + i * 19,
|
||||
this.cont.getTile().getAEStackInventory(),
|
||||
i,
|
||||
GuiLevelMaintainer::acceptType);
|
||||
slot.setShowAmount(true);
|
||||
slot.setShowAmountAlways(true);
|
||||
this.registerVirtualSlots(slot);
|
||||
}
|
||||
|
||||
for (int i = 0; i < TileLevelMaintainer.REQ_COUNT; i++) {
|
||||
component[i] = new Component(
|
||||
new Widget(
|
||||
@@ -175,24 +87,35 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
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);
|
||||
new FCGuiLineField(fontRendererObj, guiLeft + 47, guiTop + 33 + 19 * i, 120),
|
||||
this.buttonList,
|
||||
this.cont);
|
||||
}
|
||||
if (this.icon != null) {
|
||||
this.originalGuiBtn = new GuiTabButton(
|
||||
this.guiLeft + 151,
|
||||
this.guiTop - 4,
|
||||
this.icon,
|
||||
this.icon.getDisplayName(),
|
||||
itemRender);
|
||||
this.originalGuiBtn.setHideEdge(13);
|
||||
this.buttonList.add(originalGuiBtn);
|
||||
}
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.Refresh));
|
||||
this.buttonList.add(
|
||||
this.liteMode = new GuiToggleButton(
|
||||
guiLeft - 18,
|
||||
guiTop + 2,
|
||||
178,
|
||||
194,
|
||||
GuiText.CraftingModeLite.getLocal(),
|
||||
NameConst.TT_LEVEL_MAINTAINER_LITE_CRAFT_DESC));
|
||||
this.liteMode.setState(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initPrimaryGuiButton() {
|
||||
this.originalGuiBtn = new GuiTabButton(
|
||||
this.guiLeft + 151,
|
||||
this.guiTop - 4,
|
||||
this.cont.getPrimaryGuiIcon(),
|
||||
this.cont.getPrimaryGuiIcon().getDisplayName(),
|
||||
itemRender);
|
||||
this.originalGuiBtn.setHideEdge(13);
|
||||
this.buttonList.add(originalGuiBtn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(final int mouseX, final int mouseY, final float btn) {
|
||||
this.refreshTick++;
|
||||
super.drawScreen(mouseX, mouseY, btn);
|
||||
for (Component com : this.component) {
|
||||
com.getQty().textField.handleTooltip(mouseX, mouseY, this);
|
||||
@@ -205,12 +128,7 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
mc.getTextureManager().bindTexture(TEX_BG);
|
||||
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
|
||||
int tick = this.refreshTick;
|
||||
int interval = 20;
|
||||
if (tick > lastWorkingTick + interval && this.input == null) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.Refresh));
|
||||
lastWorkingTick = this.refreshTick;
|
||||
}
|
||||
|
||||
for (int i = 0; i < TileLevelMaintainer.REQ_COUNT; i++) {
|
||||
this.component[i].draw();
|
||||
}
|
||||
@@ -218,244 +136,215 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(getGuiDisplayName(NameConst.i18n(NameConst.GUI_LEVEL_MAINTAINER)), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(
|
||||
getGuiDisplayName(NameConst.i18n(NameConst.GUI_LEVEL_MAINTAINER)),
|
||||
8,
|
||||
6,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
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();
|
||||
if (this.component[slot.getSlotIndex()].getQty().textField.getText().matches("[0-9]+")) {
|
||||
fake.setStackSize(Long.parseLong(this.component[slot.getSlotIndex()].getQty().textField.getText()));
|
||||
} else {
|
||||
fake.setStackSize(0);
|
||||
}
|
||||
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 (input != null) {
|
||||
input.setFocused(false);
|
||||
}
|
||||
for (Component com : this.component) {
|
||||
FCGuiTextField textField = com.isMouseIn(xCoord, yCoord);
|
||||
Widget textField = com.isMouseIn(xCoord, yCoord);
|
||||
if (textField != null) {
|
||||
textField.setFocused(true);
|
||||
this.input = textField;
|
||||
this.focusWidget(textField);
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.input = null;
|
||||
this.focusWidget(null);
|
||||
}
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(final char character, final int key) {
|
||||
if (this.input == null) {
|
||||
if (this.focusedWidget == null) {
|
||||
super.keyTyped(character, key);
|
||||
return;
|
||||
}
|
||||
if (!this.checkHotbarKeys(key)) {
|
||||
if (!((character == ' ') && this.input.getText().isEmpty())) {
|
||||
this.input.textboxKeyTyped(character, key);
|
||||
if (!((character == ' ') && this.focusedWidget.textField.getText().isEmpty())) {
|
||||
this.focusedWidget.textField.textboxKeyTyped(character, key);
|
||||
}
|
||||
super.keyTyped(character, key);
|
||||
if (!numberPattern.matcher(this.input.getText()).matches()) {
|
||||
this.input.setTextColor(0xFF0000);
|
||||
} else {
|
||||
this.input.setTextColor(0xFFFFFF);
|
||||
}
|
||||
|
||||
this.focusedWidget.validate();
|
||||
|
||||
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
|
||||
this.input.setFocused(false);
|
||||
this.input = null;
|
||||
this.component[this.focusedWidget.componentIndex].submit();
|
||||
this.focusWidget(null);
|
||||
}
|
||||
|
||||
if (key == Keyboard.KEY_TAB) {
|
||||
this.focusAdjacentWidget(isShiftKeyDown());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@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;
|
||||
private void focusWidget(@Nullable Widget widget) {
|
||||
if (this.focusedWidget != null) {
|
||||
this.focusedWidget.textField.setFocused(false);
|
||||
}
|
||||
this.focusedWidget = widget;
|
||||
if (this.focusedWidget != null) {
|
||||
this.focusedWidget.textField.setFocused(true);
|
||||
}
|
||||
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
|
||||
}
|
||||
|
||||
public void updateAmount(int idx, int stackSize) {
|
||||
this.component[idx].getQty().textField.setText(String.valueOf(stackSize));
|
||||
private void focusAdjacentWidget(boolean backwards) {
|
||||
this.focusedWidget.validate();
|
||||
this.focusWidget(this.getAdjacentWidget(backwards));
|
||||
}
|
||||
|
||||
private Widget getAdjacentWidget(boolean backwards) {
|
||||
int index = this.focusedWidget.componentIndex;
|
||||
boolean isBatch = this.focusedWidget.action == Action.Batch;
|
||||
|
||||
if (backwards) {
|
||||
if (isBatch) {
|
||||
return this.component[index].getQty();
|
||||
}
|
||||
return this.component[(index + TileLevelMaintainer.REQ_COUNT - 1) % TileLevelMaintainer.REQ_COUNT]
|
||||
.getBatch();
|
||||
}
|
||||
|
||||
if (isBatch) {
|
||||
return this.component[(index + 1) % TileLevelMaintainer.REQ_COUNT].getQty();
|
||||
}
|
||||
return this.component[index].getBatch();
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
for (Component com : this.component) {
|
||||
if (com.sendToServer(btn)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
if (btn == this.liteMode) {
|
||||
if (isShiftKeyDown()) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.ClearLiteMode));
|
||||
} else {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.ToggleLiteMode));
|
||||
}
|
||||
return;
|
||||
}
|
||||
return false;
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hideItemPanelSlot(GuiContainer gui, int x, int y, int w, int h) {
|
||||
return false;
|
||||
public void updateComponent(int index, long quantity, long batchSize, boolean isEnabled, LevelState state) {
|
||||
if (index < 0 || index >= TileLevelMaintainer.REQ_COUNT) return;
|
||||
component[index].setEnable(isEnabled);
|
||||
component[index].setState(state);
|
||||
component[index].getQty().textField.setText(String.valueOf(quantity));
|
||||
component[index].getBatch().textField.setText(String.valueOf(batchSize));
|
||||
component[index].getQty().validate();
|
||||
component[index].getBatch().validate();
|
||||
}
|
||||
|
||||
public void updateComponent(int index, LevelState state) {
|
||||
if (index < 0 || index >= TileLevelMaintainer.REQ_COUNT) return;
|
||||
component[index].setState(state);
|
||||
}
|
||||
|
||||
public void updateComponent(boolean isLiteMode) {
|
||||
this.liteMode.setState(isLiteMode);
|
||||
}
|
||||
|
||||
private static boolean acceptType(VirtualMEPhantomSlot slot, IAEStackType<?> type, int mouseButton) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private class Component {
|
||||
|
||||
public boolean isEnable = true;
|
||||
public boolean isEnable = false;
|
||||
private final Widget qty;
|
||||
private final Widget batch;
|
||||
private final GuiFCImgButton disable;
|
||||
private final GuiFCImgButton enable;
|
||||
private final GuiFCImgButton submit;
|
||||
private final FCGuiLineField line;
|
||||
private State state;
|
||||
private LevelState state;
|
||||
private final ContainerLevelMaintainer container;
|
||||
|
||||
public Component(Widget qtyInput, Widget batchInput, GuiFCImgButton submitBtn, GuiFCImgButton enableBtn,
|
||||
GuiFCImgButton disableBtn, FCGuiLineField line, List<GuiButton> buttonList) {
|
||||
GuiFCImgButton disableBtn, FCGuiLineField line, List<GuiButton> buttonList,
|
||||
ContainerLevelMaintainer container) {
|
||||
this.qty = qtyInput;
|
||||
this.batch = batchInput;
|
||||
this.enable = enableBtn;
|
||||
this.disable = disableBtn;
|
||||
this.submit = submitBtn;
|
||||
this.line = line;
|
||||
this.state = State.None;
|
||||
this.state = LevelState.None;
|
||||
this.container = container;
|
||||
buttonList.add(this.submit);
|
||||
buttonList.add(this.enable);
|
||||
buttonList.add(this.disable);
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return this.qty.idx;
|
||||
return this.qty.componentIndex;
|
||||
}
|
||||
|
||||
public void setEnable(boolean enable) {
|
||||
this.isEnable = enable;
|
||||
}
|
||||
|
||||
private boolean send(Widget widget) {
|
||||
if (((SlotFluidConvertingFake) cont.inventorySlots.get(widget.idx)).getHasStack()) {
|
||||
if (isGTNHLibLoaded) {
|
||||
long value = (long) MathExpressionParser.parse(widget.textField.getText());
|
||||
widget.textField.setText(String.valueOf(value));
|
||||
}
|
||||
if (!widget.textField.getText().isEmpty()
|
||||
&& numberPattern.matcher(widget.textField.getText()).matches()) {
|
||||
String str = widget.textField.getText().replaceAll("^(0+)", "");
|
||||
widget.textField.setText(str.isEmpty() ? "0" : str);
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketLevelMaintainer(widget.action, widget.idx, widget.textField.getText()));
|
||||
widget.textField.setTextColor(0xFFFFFF);
|
||||
return true;
|
||||
} else {
|
||||
widget.textField.setTextColor(0xFF0000);
|
||||
return false;
|
||||
}
|
||||
public IAEStack<?> getStack() {
|
||||
return this.container.getTile().getAEStackInventory().getAEStackInSlot(this.getIndex());
|
||||
}
|
||||
|
||||
private void send(Widget widget) {
|
||||
if (this.getStack() != null && widget.getAmount() != null) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketLevelMaintainer(widget.action, widget.componentIndex, widget.getAmount()));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void submit() {
|
||||
this.sendToServer(this.submit);
|
||||
}
|
||||
|
||||
protected boolean sendToServer(GuiButton btn) {
|
||||
boolean didSomething = false;
|
||||
if (this.submit == btn) {
|
||||
if (this.send(this.getQty())) this.send(this.getBatch());
|
||||
final Widget qty = this.getQty();
|
||||
final Widget batch = this.getBatch();
|
||||
qty.validate();
|
||||
batch.validate();
|
||||
if (qty.getAmount() != null) {
|
||||
this.send(qty);
|
||||
qty.textField.setText(String.valueOf(qty.getAmount()));
|
||||
}
|
||||
if (batch.getAmount() != null) {
|
||||
this.send(batch);
|
||||
batch.textField.setText(String.valueOf(batch.getAmount()));
|
||||
}
|
||||
|
||||
didSomething = true;
|
||||
} else if (this.enable == btn) {
|
||||
this.setEnable(false);
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.Enable, this.getIndex()));
|
||||
didSomething = true;
|
||||
} else if (this.disable == btn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.Disable, this.getIndex()));
|
||||
didSomething = true;
|
||||
if (this.getStack() != null) {
|
||||
this.setEnable(true);
|
||||
FluidCraft.proxy.netHandler
|
||||
.sendToServer(new CPacketLevelMaintainer(Action.Disable, this.getIndex()));
|
||||
didSomething = true;
|
||||
}
|
||||
}
|
||||
return didSomething;
|
||||
}
|
||||
|
||||
public FCGuiTextField isMouseIn(final int xCoord, final int yCoord) {
|
||||
if (this.qty.textField.isMouseIn(xCoord, yCoord)) return this.getQty().textField;
|
||||
if (this.batch.textField.isMouseIn(xCoord, yCoord)) return this.getBatch().textField;
|
||||
public Widget isMouseIn(final int xCoord, final int yCoord) {
|
||||
if (this.qty.textField.isMouseIn(xCoord, yCoord)) return this.getQty();
|
||||
if (this.batch.textField.isMouseIn(xCoord, yCoord)) return this.getBatch();
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -478,31 +367,43 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_TITLE) + "\n");
|
||||
switch (this.state) {
|
||||
case Idle -> {
|
||||
this.line.setColor(FCGuiColors.StateIdle.getColor());
|
||||
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());
|
||||
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());
|
||||
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());
|
||||
this.line.setColor(FCGuiColors.stateError.getColor());
|
||||
message.add(
|
||||
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_ERROR));
|
||||
}
|
||||
case NotFound -> {
|
||||
this.line.setColor(FCGuiColors.stateError.getColor());
|
||||
message.add(
|
||||
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_NOT_FOUND));
|
||||
}
|
||||
case CantCraft -> {
|
||||
this.line.setColor(FCGuiColors.stateError.getColor());
|
||||
message.add(
|
||||
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CANT_CRAFT));
|
||||
}
|
||||
default -> {
|
||||
this.line.setColor(FCGuiColors.StateNone.getColor());
|
||||
this.line.setColor(FCGuiColors.stateNone.getColor());
|
||||
message.add(
|
||||
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_NONE));
|
||||
@@ -517,7 +418,11 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
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));
|
||||
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_ERROR_DESC) + "\n");
|
||||
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_NOT_FOUND));
|
||||
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_NOT_FOUND_DESC) + "\n");
|
||||
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CANT_CRAFT));
|
||||
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CANT_CRAFT_DESC));
|
||||
} else {
|
||||
message.add(NameConst.i18n(NameConst.TT_SHIFT_FOR_MORE));
|
||||
}
|
||||
@@ -533,35 +438,48 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public void setState(State state) {
|
||||
public void setState(LevelState state) {
|
||||
this.state = state;
|
||||
}
|
||||
}
|
||||
|
||||
private class Widget {
|
||||
|
||||
public final int idx;
|
||||
public final int componentIndex;
|
||||
public final Action action;
|
||||
private final FCGuiTextField textField;
|
||||
public final FCGuiTextField textField;
|
||||
private final String tooltip;
|
||||
private Long amount;
|
||||
|
||||
public Widget(FCGuiTextField textField, String tooltip, int idx, Action action) {
|
||||
public Widget(FCGuiTextField textField, String tooltip, int componentIndex, Action action) {
|
||||
this.textField = textField;
|
||||
this.textField.setEnableBackgroundDrawing(false);
|
||||
this.textField.setText("0");
|
||||
this.textField.setMaxStringLength(16); // this length is enough to be useful
|
||||
this.idx = idx;
|
||||
this.componentIndex = componentIndex;
|
||||
this.action = action;
|
||||
this.tooltip = tooltip;
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
String current = amount != null
|
||||
? StatCollector.translateToLocal(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||
+ NumberFormat.getNumberInstance().format(amount)
|
||||
+ "\n"
|
||||
: "";
|
||||
if (isShiftKeyDown()) {
|
||||
this.setTooltip(render.wrapFormattedStringToWidth(NameConst.i18n(this.tooltip), xSize / 2));
|
||||
this.setTooltip(
|
||||
render.wrapFormattedStringToWidth(
|
||||
StatCollector.translateToLocal(this.tooltip) + "\n"
|
||||
+ current
|
||||
+ "\n"
|
||||
+ StatCollector.translateToLocal(this.tooltip + ".hint"),
|
||||
xSize / 2));
|
||||
} else {
|
||||
this.setTooltip(
|
||||
render.wrapFormattedStringToWidth(
|
||||
NameConst.i18n(this.tooltip, "\n", false) + "\n"
|
||||
+ current
|
||||
+ NameConst.i18n(NameConst.TT_SHIFT_FOR_MORE),
|
||||
(int) Math.floor(xSize * 0.8)));
|
||||
}
|
||||
@@ -571,5 +489,27 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
|
||||
public void setTooltip(String message) {
|
||||
this.textField.setMessage(message);
|
||||
}
|
||||
|
||||
public void validate() {
|
||||
final double result = Calculator.conversion(this.textField.getText());
|
||||
if (Double.isNaN(result) || result < 0) {
|
||||
this.amount = null;
|
||||
this.textField.setTextColor(FCGuiColors.guiLevelMaintainerError.getColor());
|
||||
} else {
|
||||
this.amount = (long) ArithHelper.round(result, 0);
|
||||
this.textField.setTextColor(FCGuiColors.guiTextColorGray.getColor());
|
||||
}
|
||||
|
||||
IAEStack<?> stack = component[this.componentIndex].getStack();
|
||||
if (stack != null) {
|
||||
Long amount = component[this.componentIndex].getQty().getAmount();
|
||||
stack.setStackSize(amount != null ? amount : 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Long getAmount() {
|
||||
return this.amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,5 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import static com.glodblock.github.common.item.ItemWirelessUltraTerminal.hasInfinityBoosterCard;
|
||||
import static com.glodblock.github.network.SPacketLevelTerminalUpdate.CLEAR_ALL_BIT;
|
||||
import static com.glodblock.github.network.SPacketLevelTerminalUpdate.DISCONNECT_BIT;
|
||||
import static com.glodblock.github.network.SPacketLevelTerminalUpdate.PacketAdd;
|
||||
import static com.glodblock.github.network.SPacketLevelTerminalUpdate.PacketEntry;
|
||||
import static com.glodblock.github.network.SPacketLevelTerminalUpdate.PacketOverwrite;
|
||||
import static com.glodblock.github.network.SPacketLevelTerminalUpdate.PacketRemove;
|
||||
import static com.glodblock.github.network.SPacketLevelTerminalUpdate.PacketRename;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -17,7 +8,6 @@ import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
@@ -28,13 +18,12 @@ import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -46,14 +35,9 @@ import org.lwjgl.opengl.GL12;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.base.FCBaseMEGui;
|
||||
import com.glodblock.github.client.gui.container.ContainerLevelTerminal;
|
||||
import com.glodblock.github.common.tile.TileLevelMaintainer.State;
|
||||
import com.glodblock.github.common.tile.TileLevelMaintainer.TLMTags;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.network.CPacketInventoryAction;
|
||||
import com.glodblock.github.network.CPacketLevelTerminalCommands;
|
||||
import com.glodblock.github.network.CPacketLevelTerminalCommands.Action;
|
||||
import com.glodblock.github.network.CPacketRenamer;
|
||||
import com.glodblock.github.network.SPacketLevelTerminalUpdate;
|
||||
import com.glodblock.github.util.FCGuiColors;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
@@ -63,8 +47,10 @@ import appeng.api.config.Settings;
|
||||
import appeng.api.config.TerminalFontSize;
|
||||
import appeng.api.config.TerminalStyle;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.features.LevelItemInfo;
|
||||
import appeng.api.features.LevelState;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.client.gui.IGuiTooltipHandler;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.GuiScrollbar;
|
||||
@@ -76,17 +62,16 @@ import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
import appeng.core.localization.GuiColors;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.ReadableNumberConverter;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextField, IGuiTooltipHandler {
|
||||
|
||||
@@ -95,7 +80,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
public static final int VIEW_WIDTH = 174;
|
||||
public static final int VIEW_LEFT = 8;
|
||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/level_terminal.png");
|
||||
protected int offsetY;
|
||||
private static final RenderItem renderItem = new RenderItem();
|
||||
private static final int offsetX = 21;
|
||||
protected static String searchFieldOutputsText = "";
|
||||
protected static String searchFieldNamesText = "";
|
||||
@@ -106,8 +91,8 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
private GuiImgButton terminalStyleBox;
|
||||
|
||||
private ItemStack tooltipStack;
|
||||
private List<String> buttonTooltip;
|
||||
private boolean online;
|
||||
private final boolean neiPresent;
|
||||
private int viewHeight;
|
||||
|
||||
protected GuiTabButton craftingStatusBtn;
|
||||
@@ -121,16 +106,14 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
private static final float ITEM_STACK_Z = 100.0f;
|
||||
private static final float ITEM_STACK_OVERLAY_Z = 200.0f;
|
||||
private static final float SLOT_HOVER_Z = 310.0f;
|
||||
private static final float TOOLTIP_Z = 410.0f;
|
||||
private static final float STEP_Z = 10.0f;
|
||||
private static final float MAGIC_RENDER_ITEM_Z = 50.0f;
|
||||
|
||||
public GuiLevelTerminal(InventoryPlayer inventoryPlayer, Container container) {
|
||||
super(inventoryPlayer, container);
|
||||
setScrollBar(new GuiScrollbar());
|
||||
xSize = 208;
|
||||
xSize = 209;
|
||||
ySize = 255;
|
||||
neiPresent = Loader.isModLoaded("NotEnoughItems");
|
||||
|
||||
searchFieldOutputs = new MEGuiTextField(86, 12, ButtonToolTips.SearchFieldOutputs.getLocal()) {
|
||||
|
||||
@@ -147,24 +130,14 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
masterList.markDirty();
|
||||
}
|
||||
};
|
||||
searchFieldNames.setFocused(true);
|
||||
extraOptionsText.add(ButtonToolTips.HighlightInterface.getLocal());
|
||||
online = true;
|
||||
}
|
||||
|
||||
public GuiLevelTerminal(final InventoryPlayer inventoryPlayer, final ITerminalHost te) {
|
||||
this(inventoryPlayer, new ContainerLevelTerminal(inventoryPlayer, te));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOffsetY() {
|
||||
return offsetY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOffsetY(int y) {
|
||||
offsetY = y;
|
||||
}
|
||||
|
||||
private void setScrollBar() {
|
||||
int maxScroll = masterList.getHeight() - viewHeight - 1;
|
||||
if (maxScroll <= 0) {
|
||||
@@ -182,9 +155,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
final int unusedSpace = height - ySize;
|
||||
guiTop = (int) Math.floor(unusedSpace / (unusedSpace < 0 ? 3.8f : 2.0f));
|
||||
|
||||
// modeSwitchView = new GuiFCImgButton(guiLeft + xSize - 40, guiTop + 1, "SWITCH", "OFF", false);
|
||||
// modeSwitchEdit = new GuiFCImgButton(guiLeft + xSize - 40, guiTop + 1, "SWITCH", "ON", false);
|
||||
offsetY = guiTop + 8;
|
||||
int offsetY = guiTop + 8;
|
||||
terminalStyleBox = new GuiImgButton(
|
||||
guiLeft - 18,
|
||||
offsetY,
|
||||
@@ -203,18 +174,19 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
|
||||
searchFieldNames.x = guiLeft + Math.max(32, offsetX) + 99;
|
||||
searchFieldNames.y = guiTop + 38;
|
||||
searchFieldNames.setFocused(true);
|
||||
|
||||
terminalStyleBox.xPosition = guiLeft - 18;
|
||||
terminalStyleBox.yPosition = guiTop + 8;
|
||||
craftingStatusBtn = new GuiTabButton(
|
||||
guiLeft + xSize - 24,
|
||||
guiLeft + xSize - 25,
|
||||
guiTop - 4,
|
||||
2 + 11 * 16,
|
||||
GuiText.CraftingStatus.getLocal(),
|
||||
itemRender);
|
||||
craftingStatusBtn.setHideEdge(13);
|
||||
|
||||
if (ModAndClassUtil.isSearchBar && (AEConfig.instance.preserveSearchBar || isSubGui())) {
|
||||
if (AEConfig.instance.preserveSearchBar || isSubGui()) {
|
||||
setSearchString();
|
||||
}
|
||||
buttonList.add(terminalStyleBox);
|
||||
@@ -223,7 +195,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
|
||||
setScrollBar();
|
||||
repositionSlots();
|
||||
initGuiDone();
|
||||
initCustomButtons(0, offsetY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -268,14 +240,14 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
StatCollector.translateToLocal(NameConst.GUI_LEVEL_TERMINAL),
|
||||
8,
|
||||
6,
|
||||
GuiColors.InterfaceTerminalTitle.getColor());
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
fontRendererObj.drawString(
|
||||
GuiText.inventory.getLocal(),
|
||||
GuiLevelTerminal.offsetX + 2,
|
||||
ySize - 96 + 3,
|
||||
GuiColors.InterfaceTerminalInventory.getColor());
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
|
||||
if (!neiPresent && tooltipStack != null) {
|
||||
if (!ModAndClassUtil.NEI && tooltipStack != null) {
|
||||
renderToolTip(tooltipStack, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
@@ -284,17 +256,15 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
public void drawScreen(final int mouseX, final int mouseY, final float btn) {
|
||||
terminalStyleBox.set(AEConfig.instance.settings.getSetting(Settings.TERMINAL_STYLE));
|
||||
|
||||
buttonList.clear();
|
||||
buttonList.add(terminalStyleBox);
|
||||
buttonList.add(searchStringSave);
|
||||
buttonList.add(craftingStatusBtn);
|
||||
// buttonList.add(Objects.equals(currentMode, "OFF") ? modeSwitchView : modeSwitchEdit);
|
||||
addSwitchGuiBtns();
|
||||
|
||||
super.drawScreen(mouseX, mouseY, btn);
|
||||
|
||||
handleTooltip(mouseX, mouseY, searchFieldOutputs);
|
||||
handleTooltip(mouseX, mouseY, searchFieldNames);
|
||||
|
||||
// Drawn after the viewport so the items do not cover it
|
||||
if (buttonTooltip != null) {
|
||||
drawHoveringText(buttonTooltip, mouseX, mouseY, fontRendererObj);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -320,12 +290,8 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
// if (btn == modeSwitchView) {
|
||||
// currentMode = "ON";
|
||||
// } else if (btn == modeSwitchEdit) {
|
||||
// currentMode = "OFF";
|
||||
// } else
|
||||
if (ModAndClassUtil.isSaveText && btn == searchStringSave) {
|
||||
if (actionPerformedCustomButtons(btn)) return;
|
||||
if (btn == searchStringSave) {
|
||||
|
||||
final boolean backwards = Mouse.isButtonDown(1);
|
||||
final GuiImgButton iBtn = (GuiImgButton) btn;
|
||||
@@ -336,7 +302,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
searchStringSave.set(next);
|
||||
|
||||
} else if (btn == craftingStatusBtn) {
|
||||
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
|
||||
NetworkHandler.instance.sendToServer(new PacketSwitchGuis(GuiBridge.GUI_CRAFTING_STATUS));
|
||||
} else if (btn instanceof final GuiImgButton iBtn) {
|
||||
if (iBtn.getSetting() != Settings.ACTIONS) {
|
||||
final Enum<?> cv = iBtn.getCurrentValue();
|
||||
@@ -360,7 +326,8 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
/* Draws the top part. */
|
||||
drawTexturedModalRect(offsetX, offsetY, 0, 0, xSize, HEADER_HEIGHT);
|
||||
/* Draws the middle part. */
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
final Tessellator tess = Tessellator.instance;
|
||||
tess.startDrawingQuads();
|
||||
addTexturedRectToTesselator(
|
||||
offsetX,
|
||||
offsetY + HEADER_HEIGHT,
|
||||
@@ -371,7 +338,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
(HEADER_HEIGHT + LevelTerminalSection.TITLE_HEIGHT + 1.0f) / 256.0f,
|
||||
xSize / 256.0f,
|
||||
(HEADER_HEIGHT + 106.0f) / 256.0f);
|
||||
Tessellator.instance.draw();
|
||||
tess.draw();
|
||||
/* Draw the bottom part */
|
||||
drawTexturedModalRect(offsetX, offsetY + HEADER_HEIGHT + viewHeight, 0, 158, xSize, INV_HEIGHT);
|
||||
if (online) {
|
||||
@@ -382,6 +349,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(offsetX + VIEW_LEFT, offsetY + HEADER_HEIGHT, 0);
|
||||
tooltipStack = null;
|
||||
buttonTooltip = null;
|
||||
drawViewport(mouseX - offsetX - VIEW_LEFT, mouseY - offsetY - HEADER_HEIGHT - 1);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopAttrib();
|
||||
@@ -432,7 +400,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
int title;
|
||||
int renderY = 0;
|
||||
final int sectionBottom = viewY + section.getHeight() - 1;
|
||||
final int fontColor = GuiColors.InterfaceTerminalInventory.getColor();
|
||||
final int fontColor = FCGuiColors.guiTextColorGray.getColor();
|
||||
/*
|
||||
* Render title
|
||||
*/
|
||||
@@ -499,10 +467,11 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
private int drawEntry(LevelTerminalEntry entry, int viewY, int titleBottom, int relMouseX, int relMouseY) {
|
||||
final EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
mc.getTextureManager().bindTexture(TEX_BG);
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
final Tessellator tess = Tessellator.instance;
|
||||
tess.startDrawingQuads();
|
||||
int relY = 0;
|
||||
final int slotLeftMargin = (VIEW_WIDTH - entry.rowSize * 18);
|
||||
float lastZLevel = aeRenderItem.zLevel;
|
||||
float lastZLevel = renderItem.zLevel;
|
||||
|
||||
entry.dispY = viewY;
|
||||
/* PASS 1: BG */
|
||||
@@ -528,29 +497,33 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
(173 + 18) / 256f);
|
||||
}
|
||||
}
|
||||
Tessellator.instance.draw();
|
||||
tess.draw();
|
||||
/* Draw button */
|
||||
if (viewY + entry.highlightButton.height > 0 && viewY < viewHeight) {
|
||||
entry.highlightButton.yPosition = viewY + 1;
|
||||
entry.renameButton.yPosition = viewY + 1;
|
||||
entry.configButton.yPosition = viewY + 1;
|
||||
GuiFCImgButton toRender;
|
||||
if (isCtrlKeyDown() && isShiftKeyDown() && hasInfinityBoosterCard(player)) {
|
||||
toRender = entry.configButton;
|
||||
} else if (isShiftKeyDown()) {
|
||||
if (isShiftKeyDown() && entry.isInPlayerDimension()) {
|
||||
toRender = entry.renameButton;
|
||||
} else if (isCtrlKeyDown() && entry.isInPlayerDimension()) {
|
||||
toRender = entry.configButton;
|
||||
} else {
|
||||
toRender = entry.highlightButton;
|
||||
}
|
||||
toRender.drawButton(mc, relMouseX, relMouseY);
|
||||
if (toRender.getMouseIn()
|
||||
&& relMouseY >= Math.max(LevelTerminalSection.TITLE_HEIGHT, entry.highlightButton.yPosition)) {
|
||||
// draw a tooltip
|
||||
GL11.glTranslatef(0f, 0f, TOOLTIP_Z);
|
||||
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
||||
drawHoveringText(Arrays.asList(toRender.getMessage()), relMouseX, relMouseY);
|
||||
GL11.glTranslatef(0f, 0f, -TOOLTIP_Z);
|
||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
tooltip.add(toRender.getMessage());
|
||||
if (entry.isInPlayerDimension()) {
|
||||
tooltip.add(StatCollector.translateToLocal(NameConst.TT_KEY + "level_terminal.hint_rename"));
|
||||
tooltip.add(StatCollector.translateToLocal(NameConst.TT_KEY + "level_terminal.hint_open_gui"));
|
||||
} else {
|
||||
tooltip.add(
|
||||
StatCollector.translateToLocal(NameConst.TT_KEY + "level_terminal.hint_other_dimension"));
|
||||
}
|
||||
buttonTooltip = tooltip;
|
||||
}
|
||||
} else {
|
||||
entry.highlightButton.yPosition = -1;
|
||||
@@ -564,50 +537,44 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
if (viewY + rowYBot <= titleBottom) {
|
||||
continue;
|
||||
}
|
||||
AppEngInternalInventory inv = entry.getInventory();
|
||||
|
||||
for (int col = 0; col < entry.rowSize; ++col) {
|
||||
final int colLeft = col * 18 + slotLeftMargin + 1;
|
||||
final int colRight = colLeft + 18 + 1;
|
||||
final int slotIdx = row * entry.rowSize + col;
|
||||
ItemStack stack = inv.getStackInSlot(slotIdx);
|
||||
LevelItemInfo info = entry.infoList[slotIdx];
|
||||
|
||||
boolean tooltip = relMouseX > colLeft - 1 && relMouseX < colRight - 1
|
||||
&& relMouseY >= Math.max(viewY + rowYTop, LevelTerminalSection.TITLE_HEIGHT)
|
||||
&& relMouseY < Math.min(viewY + rowYBot, viewHeight);
|
||||
if (stack != null) {
|
||||
|
||||
NBTTagCompound data = stack.getTagCompound();
|
||||
ItemStack itemStack = data.hasKey(TLMTags.Stack.tagName)
|
||||
? ItemStack.loadItemStackFromNBT(data.getCompoundTag(TLMTags.Stack.tagName))
|
||||
: stack.copy();
|
||||
long quantity = data.getLong(TLMTags.Quantity.tagName);
|
||||
long batch = data.getLong(TLMTags.Batch.tagName);
|
||||
State state = State.values()[data.getInteger(TLMTags.State.tagName)];
|
||||
if (info != null) {
|
||||
IAEStack<?> aes = info.stack;
|
||||
long quantity = info.quantity;
|
||||
long batch = info.batchSize;
|
||||
LevelState state = info.state;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(colLeft, viewY + rowYTop + 1, ITEM_STACK_Z);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
itemStack.stackSize = 0;
|
||||
aeRenderItem.setAeStack(null);
|
||||
aeRenderItem.zLevel = ITEM_STACK_Z - MAGIC_RENDER_ITEM_Z;
|
||||
aeRenderItem.renderItemAndEffectIntoGUI(fontRendererObj, mc.getTextureManager(), itemStack, 0, 0);
|
||||
aeRenderItem.renderItemOverlayIntoGUI(fontRendererObj, mc.getTextureManager(), itemStack, 0, 0);
|
||||
aes.setStackSize(1);
|
||||
renderItem.zLevel = ITEM_STACK_Z - MAGIC_RENDER_ITEM_Z;
|
||||
aes.drawInGui(mc, 0, 0);
|
||||
aes.drawOverlayInGui(mc, 0, 0, false, false, false, false);
|
||||
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z - ITEM_STACK_Z);
|
||||
int color = switch (state) {
|
||||
case Idle -> FCGuiColors.StateIdle.getColor();
|
||||
case Craft -> FCGuiColors.StateCraft.getColor();
|
||||
case Export -> FCGuiColors.StateExport.getColor();
|
||||
case Error -> FCGuiColors.StateError.getColor();
|
||||
case None -> FCGuiColors.StateNone.getColor();
|
||||
case Idle -> FCGuiColors.stateIdle.getColor();
|
||||
case Craft -> FCGuiColors.stateCraft.getColor();
|
||||
case Export -> FCGuiColors.stateExport.getColor();
|
||||
case Error, NotFound, CantCraft -> FCGuiColors.stateError.getColor();
|
||||
case None -> FCGuiColors.stateNone.getColor();
|
||||
};
|
||||
int offset = 0;
|
||||
int size = 4;
|
||||
drawRect(offset, offset, offset + size, offset + size, color);
|
||||
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z - ITEM_STACK_Z);
|
||||
this.drawReadableAmount(fontRendererObj, quantity, true, 16777215);
|
||||
if (batch > 0) {
|
||||
if (batch >= 0) {
|
||||
this.drawReadableAmount(fontRendererObj, batch, false, 16777215);
|
||||
}
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
@@ -618,30 +585,35 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
if (!tooltip) {
|
||||
if (entry.filteredRecipes[slotIdx]) {
|
||||
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z);
|
||||
drawRect(0, 0, 16, 16, GuiColors.ItemSlotOverlayUnpowered.getColor());
|
||||
drawRect(0, 0, 16, 16, FCGuiColors.itemSlotOverlayUnpowered.getColor());
|
||||
}
|
||||
} else {
|
||||
tooltipStack = stack;
|
||||
tooltipStack = aes.getItemStackForNEI();
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
} else if (entry.filteredRecipes[slotIdx]) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(colLeft, viewY + rowYTop + 1, ITEM_STACK_OVERLAY_Z);
|
||||
drawRect(0, 0, 16, 16, GuiColors.ItemSlotOverlayUnpowered.getColor());
|
||||
drawRect(0, 0, 16, 16, FCGuiColors.itemSlotOverlayUnpowered.getColor());
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (tooltip) {
|
||||
// overlay highlight
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glTranslatef(0.0f, 0.0f, SLOT_HOVER_Z);
|
||||
drawRect(colLeft, viewY + 1 + rowYTop, -2 + colRight, viewY - 1 + rowYBot, 0x77FFFFFF);
|
||||
drawRect(
|
||||
colLeft,
|
||||
viewY + 1 + rowYTop,
|
||||
-2 + colRight,
|
||||
viewY - 1 + rowYBot,
|
||||
FCGuiColors.guiLevelTerminalOverlayHighlight.getColor());
|
||||
GL11.glTranslatef(0.0f, 0.0f, -SLOT_HOVER_Z);
|
||||
}
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
}
|
||||
}
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
aeRenderItem.zLevel = lastZLevel;
|
||||
renderItem.zLevel = lastZLevel;
|
||||
return relY + 1;
|
||||
}
|
||||
|
||||
@@ -692,102 +664,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawHoveringText(List<String> textLines, int x, int y, FontRenderer font) {
|
||||
if (!textLines.isEmpty()) {
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
int maxStrWidth = 0;
|
||||
|
||||
// is this more efficient than doing 1 pass, then doing a translate before drawing the text?
|
||||
for (String s : (List<String>) textLines) {
|
||||
int width = font.getStringWidth(s);
|
||||
|
||||
if (width > maxStrWidth) {
|
||||
maxStrWidth = width;
|
||||
}
|
||||
}
|
||||
|
||||
// top left corner
|
||||
int curX = x + 12;
|
||||
int curY = y - 12;
|
||||
int totalHeight = 8;
|
||||
|
||||
if (textLines.size() > 1) {
|
||||
totalHeight += 2 + (textLines.size() - 1) * 10;
|
||||
}
|
||||
|
||||
/* String is too long? Display on the left side */
|
||||
if (curX + maxStrWidth > width) {
|
||||
curX -= 28 + maxStrWidth;
|
||||
}
|
||||
|
||||
/* String is too tall? move it up */
|
||||
if (curY + totalHeight + 6 > height) {
|
||||
curY = height - totalHeight - 6;
|
||||
}
|
||||
|
||||
int borderColor = -267386864;
|
||||
// drawing the border...
|
||||
drawGradientRect(curX - 3, curY - 4, curX + maxStrWidth + 3, curY - 3, borderColor, borderColor);
|
||||
drawGradientRect(
|
||||
curX - 3,
|
||||
curY + totalHeight + 3,
|
||||
curX + maxStrWidth + 3,
|
||||
curY + totalHeight + 4,
|
||||
borderColor,
|
||||
borderColor);
|
||||
drawGradientRect(
|
||||
curX - 3,
|
||||
curY - 3,
|
||||
curX + maxStrWidth + 3,
|
||||
curY + totalHeight + 3,
|
||||
borderColor,
|
||||
borderColor);
|
||||
drawGradientRect(curX - 4, curY - 3, curX - 3, curY + totalHeight + 3, borderColor, borderColor);
|
||||
drawGradientRect(
|
||||
curX + maxStrWidth + 3,
|
||||
curY - 3,
|
||||
curX + maxStrWidth + 4,
|
||||
curY + totalHeight + 3,
|
||||
borderColor,
|
||||
borderColor);
|
||||
int color1 = 1347420415;
|
||||
int color2 = (color1 & 16711422) >> 1 | color1 & -16777216;
|
||||
drawGradientRect(curX - 3, curY - 3 + 1, curX - 3 + 1, curY + totalHeight + 3 - 1, color1, color2);
|
||||
drawGradientRect(
|
||||
curX + maxStrWidth + 2,
|
||||
curY - 3 + 1,
|
||||
curX + maxStrWidth + 3,
|
||||
curY + totalHeight + 3 - 1,
|
||||
color1,
|
||||
color2);
|
||||
drawGradientRect(curX - 3, curY - 3, curX + maxStrWidth + 3, curY - 3 + 1, color1, color1);
|
||||
drawGradientRect(
|
||||
curX - 3,
|
||||
curY + totalHeight + 2,
|
||||
curX + maxStrWidth + 3,
|
||||
curY + totalHeight + 3,
|
||||
color2,
|
||||
color2);
|
||||
|
||||
for (int i = 0; i < textLines.size(); ++i) {
|
||||
String line = (String) textLines.get(i);
|
||||
font.drawStringWithShadow(line, curX, curY, -1);
|
||||
|
||||
if (i == 0) {
|
||||
// gap between name and lore text
|
||||
curY += 2;
|
||||
}
|
||||
|
||||
curY += 10;
|
||||
}
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(final char character, final int key) {
|
||||
if (!checkHotbarKeys(key)) {
|
||||
@@ -845,74 +721,61 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
&& mouseY < guiTop + HEADER_HEIGHT + viewHeight;
|
||||
}
|
||||
|
||||
public void postUpdate(List<PacketEntry> updates, int statusFlags) {
|
||||
if ((statusFlags & CLEAR_ALL_BIT) == CLEAR_ALL_BIT) {
|
||||
/* Should clear all client entries. */
|
||||
masterList.list.clear();
|
||||
}
|
||||
/* Should indicate disconnected, so the terminal turns dark. */
|
||||
online = (statusFlags & DISCONNECT_BIT) != DISCONNECT_BIT;
|
||||
|
||||
for (PacketEntry cmd : updates) {
|
||||
parsePacketCmd(cmd);
|
||||
public void receivePackets(List<SPacketLevelTerminalUpdate.PacketEntry> packets) {
|
||||
for (SPacketLevelTerminalUpdate.PacketEntry packet : packets) {
|
||||
parsePacket(packet);
|
||||
}
|
||||
masterList.markDirty();
|
||||
}
|
||||
|
||||
private void parsePacketCmd(PacketEntry cmd) {
|
||||
long id = cmd.entryId;
|
||||
if (cmd instanceof PacketAdd addCmd) {
|
||||
private void parsePacket(SPacketLevelTerminalUpdate.PacketEntry packet) {
|
||||
if (packet instanceof SPacketLevelTerminalUpdate.PacketAdd packetAdd) {
|
||||
LevelTerminalEntry entry = new LevelTerminalEntry(
|
||||
id,
|
||||
addCmd.name,
|
||||
addCmd.rows,
|
||||
addCmd.rowSize,
|
||||
addCmd.online).setLocation(addCmd.x, addCmd.y, addCmd.z, addCmd.dim, addCmd.side)
|
||||
.setIcons(addCmd.selfItemStack, addCmd.displayItemStack).setItems(addCmd.items);
|
||||
masterList.addEntry(entry);
|
||||
} else if (cmd instanceof PacketRemove) {
|
||||
masterList.removeEntry(id);
|
||||
} else if (cmd instanceof PacketOverwrite owCmd) {
|
||||
LevelTerminalEntry entry = masterList.list.get(id);
|
||||
packetAdd.entryId,
|
||||
packetAdd.name,
|
||||
packetAdd.rows,
|
||||
packetAdd.rowSize,
|
||||
true).setLocation(packetAdd.x, packetAdd.y, packetAdd.z, packetAdd.dim, packetAdd.side)
|
||||
.setInfoList(packetAdd.infolist);
|
||||
this.masterList.addEntry(entry);
|
||||
} else if (packet instanceof SPacketLevelTerminalUpdate.PacketRemove packetRemove) {
|
||||
this.masterList.removeEntry(packetRemove.entryId);
|
||||
} else if (packet instanceof SPacketLevelTerminalUpdate.PacketRename packetRename) {
|
||||
LevelTerminalEntry entry = masterList.list.get(packetRename.entryId);
|
||||
if (entry == null) return;
|
||||
|
||||
if (entry == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (owCmd.itemsValid) {
|
||||
if (owCmd.allItemUpdate) {
|
||||
entry.fullItemUpdate(owCmd.items, owCmd.validIndices.length);
|
||||
} else {
|
||||
entry.partialItemUpdate(owCmd.items, owCmd.validIndices);
|
||||
}
|
||||
if (StatCollector.canTranslate(packetRename.newName)) {
|
||||
entry.customName = StatCollector.translateToLocal(packetRename.newName);
|
||||
} else {
|
||||
entry.customName = StatCollector.translateToFallback(packetRename.newName);
|
||||
}
|
||||
masterList.isDirty = true;
|
||||
} else if (cmd instanceof PacketRename renameCmd) {
|
||||
LevelTerminalEntry entry = masterList.list.get(id);
|
||||
} else if (packet instanceof SPacketLevelTerminalUpdate.PacketDisconnect) {
|
||||
online = false;
|
||||
}
|
||||
|
||||
if (entry != null) {
|
||||
if (StatCollector.canTranslate(renameCmd.newName)) {
|
||||
entry.customName = StatCollector.translateToLocal(renameCmd.newName);
|
||||
} else {
|
||||
entry.customName = StatCollector.translateToFallback(renameCmd.newName);
|
||||
}
|
||||
}
|
||||
else if (packet instanceof SPacketLevelTerminalUpdate.PacketOverwriteSlot packetOverwirteSlot) {
|
||||
LevelTerminalEntry entry = masterList.list.get(packetOverwirteSlot.entryId);
|
||||
if (entry == null) return;
|
||||
|
||||
entry.infoList[packetOverwirteSlot.index] = packetOverwirteSlot.info;
|
||||
masterList.isDirty = true;
|
||||
} else if (packet instanceof SPacketLevelTerminalUpdate.PacketOverwirteAllSlot packetOverwirteAllSlot) {
|
||||
LevelTerminalEntry entry = masterList.list.get(packetOverwirteAllSlot.entryId);
|
||||
if (entry == null) return;
|
||||
|
||||
entry.infoList = packetOverwirteAllSlot.infoList;
|
||||
masterList.isDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean itemStackMatchesSearchTerm(final ItemStack itemStack, final String searchTerm) {
|
||||
if (itemStack == null) {
|
||||
private boolean stackMatchesSearchTerm(final IAEStack<?> stack, final String searchTerm) {
|
||||
if (stack == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final String displayName = Platform.getItemDisplayName(itemStack).toLowerCase();
|
||||
|
||||
if (displayName.contains(searchTerm)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
final String displayName = stack.getDisplayName();
|
||||
return displayName != null && displayName.toLowerCase().contains(searchTerm);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -931,22 +794,23 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
|
||||
@Override
|
||||
public List<String> handleItemTooltip(ItemStack stack, int mouseX, int mouseY, List<String> currentToolTip) {
|
||||
if (stack == null || !isShiftKeyDown()) return currentToolTip;
|
||||
|
||||
if (stack != null && isShiftKeyDown() && stack.hasTagCompound()) {
|
||||
NBTTagCompound data = stack.getTagCompound();
|
||||
for (LevelTerminalSection section : this.masterList.getVisibleSections()) {
|
||||
for (LevelTerminalEntry entry : section.visibleEntries) {
|
||||
for (LevelItemInfo info : entry.infoList) {
|
||||
if (info != null && info.stack.equals(stack)) {
|
||||
currentToolTip.add(
|
||||
I18n.format(NameConst.TT_LEVEL_MAINTAINER_REQUEST_SIZE, "\n", false) + ": "
|
||||
+ NumberFormat.getInstance().format(info.quantity));
|
||||
|
||||
if (data.hasKey(TLMTags.Quantity.tagName)) {
|
||||
long quantity = data.getLong(TLMTags.Quantity.tagName);
|
||||
long batch = data.getLong(TLMTags.Batch.tagName);
|
||||
|
||||
currentToolTip.add(
|
||||
I18n.format(NameConst.TT_LEVEL_MAINTAINER_REQUEST_SIZE, "\n", false) + ": "
|
||||
+ NumberFormat.getNumberInstance(Locale.US).format(quantity));
|
||||
|
||||
if (batch > 0) {
|
||||
currentToolTip.add(
|
||||
I18n.format(NameConst.TT_LEVEL_MAINTAINER_BATCH_SIZE, "\n", false) + ": "
|
||||
+ NumberFormat.getNumberInstance(Locale.US).format(batch));
|
||||
if (info.batchSize >= 0) {
|
||||
currentToolTip.add(
|
||||
I18n.format(NameConst.TT_LEVEL_MAINTAINER_BATCH_SIZE, "\n", false) + ": "
|
||||
+ NumberFormat.getInstance().format(info.batchSize));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1101,13 +965,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
|
||||
String name;
|
||||
List<LevelTerminalEntry> entries = new ArrayList<>();
|
||||
Set<LevelTerminalEntry> visibleEntries = new TreeSet<>(Comparator.comparing(e -> {
|
||||
if (e.displayItemStack != null) {
|
||||
return e.displayItemStack.getDisplayName() + e.id;
|
||||
} else {
|
||||
return String.valueOf(e.id);
|
||||
}
|
||||
}));
|
||||
Set<LevelTerminalEntry> visibleEntries = new TreeSet<>(Comparator.comparing(e -> e.customName + e.id));
|
||||
int height;
|
||||
private boolean isDirty = true;
|
||||
boolean visible = false;
|
||||
@@ -1147,18 +1005,22 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
entry.dispY = -9999;
|
||||
// Find search terms
|
||||
if (!output.isEmpty()) {
|
||||
AppEngInternalInventory inv = entry.inv;
|
||||
boolean shouldAdd = false;
|
||||
|
||||
for (int i = 0; i < inv.getSizeInventory(); ++i) {
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if (itemStackMatchesSearchTerm(stack, output)) {
|
||||
for (int i = 0; i < entry.infoList.length; ++i) {
|
||||
if (entry.infoList[i] == null) {
|
||||
entry.filteredRecipes[i] = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (stackMatchesSearchTerm(entry.infoList[i].stack, output)) {
|
||||
shouldAdd = true;
|
||||
entry.filteredRecipes[i] = false;
|
||||
} else {
|
||||
entry.filteredRecipes[i] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!shouldAdd) {
|
||||
continue;
|
||||
}
|
||||
@@ -1206,12 +1068,9 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
private class LevelTerminalEntry {
|
||||
|
||||
String customName;
|
||||
AppEngInternalInventory inv;
|
||||
GuiFCImgButton highlightButton;
|
||||
GuiFCImgButton renameButton;
|
||||
GuiFCImgButton configButton;
|
||||
/** Nullable - icon that represents the interface's "target" */
|
||||
ItemStack displayItemStack;
|
||||
LevelTerminalSection section;
|
||||
long id;
|
||||
int x, y, z, dim, side;
|
||||
@@ -1219,7 +1078,8 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
int guiHeight;
|
||||
int dispY = -9999;
|
||||
boolean[] filteredRecipes;
|
||||
int numItems = 0;
|
||||
|
||||
LevelItemInfo[] infoList;
|
||||
|
||||
LevelTerminalEntry(long id, String name, int rows, int rowSize, boolean online) {
|
||||
this.id = id;
|
||||
@@ -1235,10 +1095,9 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
customName = StatCollector.translateToFallback(name);
|
||||
}
|
||||
}
|
||||
inv = new AppEngInternalInventory(null, rows * rowSize, 1);
|
||||
highlightButton = new GuiFCImgButton(1, 0, "HIGHLIGHT", "YES");
|
||||
renameButton = new GuiFCImgButton(1, 0, "EDIT", "YES");
|
||||
configButton = new GuiFCImgButton(1, 0, "CONFIG", "YES");
|
||||
renameButton = new GuiFCImgButton(1, 0, "RENAME", "YES");
|
||||
configButton = new GuiFCImgButton(1, 0, "OPEN_GUI", "YES");
|
||||
guiHeight = 18 * rows + 1;
|
||||
filteredRecipes = new boolean[rows * rowSize];
|
||||
}
|
||||
@@ -1253,51 +1112,13 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
return this;
|
||||
}
|
||||
|
||||
LevelTerminalEntry setIcons(ItemStack selfItemStack, ItemStack displayItemStack) {
|
||||
this.displayItemStack = displayItemStack;
|
||||
|
||||
LevelTerminalEntry setInfoList(LevelItemInfo[] infoList) {
|
||||
this.infoList = infoList;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void fullItemUpdate(NBTTagList items, int newSize) {
|
||||
inv = new AppEngInternalInventory(null, newSize);
|
||||
rows = newSize / rowSize;
|
||||
numItems = 0;
|
||||
|
||||
for (int i = 0; i < inv.getSizeInventory(); ++i) {
|
||||
setItemInSlot(ItemStack.loadItemStackFromNBT(items.getCompoundTagAt(i)), i);
|
||||
}
|
||||
guiHeight = 18 * rows + 4;
|
||||
}
|
||||
|
||||
LevelTerminalEntry setItems(NBTTagList items) {
|
||||
assert items.tagCount() == inv.getSizeInventory();
|
||||
|
||||
for (int i = 0; i < items.tagCount(); ++i) {
|
||||
setItemInSlot(ItemStack.loadItemStackFromNBT(items.getCompoundTagAt(i)), i);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public void partialItemUpdate(NBTTagList items, int[] validIndices) {
|
||||
for (int i = 0; i < validIndices.length; ++i) {
|
||||
setItemInSlot(ItemStack.loadItemStackFromNBT(items.getCompoundTagAt(i)), validIndices[i]);
|
||||
}
|
||||
}
|
||||
|
||||
private void setItemInSlot(ItemStack stack, int idx) {
|
||||
final int oldHasItem = inv.getStackInSlot(idx) != null ? 1 : 0;
|
||||
final int newHasItem = stack != null ? 1 : 0;
|
||||
|
||||
inv.setInventorySlotContents(idx, stack);
|
||||
|
||||
// Update item count
|
||||
numItems += newHasItem - oldHasItem;
|
||||
assert numItems >= 0;
|
||||
}
|
||||
|
||||
public AppEngInternalInventory getInventory() {
|
||||
return inv;
|
||||
private boolean isInPlayerDimension() {
|
||||
return mc != null && mc.thePlayer != null && mc.thePlayer.dimension == this.dim;
|
||||
}
|
||||
|
||||
public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||
@@ -1315,18 +1136,19 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
dim,
|
||||
ForgeDirection.getOrientation(side),
|
||||
"");
|
||||
if (isCtrlKeyDown() && isShiftKeyDown() && hasInfinityBoosterCard(mc.thePlayer)) {
|
||||
if (isShiftKeyDown() && isInPlayerDimension()) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketLevelTerminalCommands(
|
||||
Action.EDIT,
|
||||
Action.RENAME,
|
||||
blockPos.x,
|
||||
blockPos.y,
|
||||
blockPos.z,
|
||||
blockPos.getDimension(),
|
||||
blockPos.getSide()));
|
||||
} else if (isShiftKeyDown()) {
|
||||
} else if (isCtrlKeyDown() && isInPlayerDimension()) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketRenamer(
|
||||
new CPacketLevelTerminalCommands(
|
||||
Action.EDIT,
|
||||
blockPos.x,
|
||||
blockPos.y,
|
||||
blockPos.z,
|
||||
@@ -1336,8 +1158,8 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
BlockPosHighlighter.highlightBlocks(
|
||||
mc.thePlayer,
|
||||
Collections.singletonList(blockPos),
|
||||
PlayerMessages.LevelEmitterHighlighted.getName(),
|
||||
PlayerMessages.LevelEmitterInAnotherDim.getName());
|
||||
PlayerMessages.LevelEmitterHighlighted.getUnlocalized(),
|
||||
PlayerMessages.LevelEmitterInAnotherDim.getUnlocalized());
|
||||
mc.thePlayer.closeScreen();
|
||||
}
|
||||
return true;
|
||||
@@ -1367,20 +1189,11 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
default -> null;// drop item:
|
||||
};
|
||||
|
||||
if (action != null) {
|
||||
ItemStack itemStack = getInventory().getStackInSlot(slotIdx);
|
||||
if (itemStack != null && itemStack.hasTagCompound()
|
||||
&& itemStack.getTagCompound().hasKey(TLMTags.Stack.tagName)) {
|
||||
long batch = itemStack.getTagCompound().getLong(TLMTags.Batch.tagName);
|
||||
NBTTagCompound stackData = itemStack.getTagCompound().getCompoundTag(TLMTags.Stack.tagName);
|
||||
ItemStack is = ItemStack.loadItemStackFromNBT(stackData);
|
||||
IAEItemStack stack = AEItemStack.create(is);
|
||||
|
||||
if (stack == null) return true;
|
||||
stack.setStackSize(batch);
|
||||
((AEBaseContainer) inventorySlots).setTargetStack(stack);
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketInventoryAction(action, slotIdx, 0, stack));
|
||||
}
|
||||
if (action != null && this.infoList[slotIdx] != null) {
|
||||
IAEStack<?> aeStack = this.infoList[slotIdx].stack;
|
||||
((AEBaseContainer) inventorySlots).setTargetStack(aeStack);
|
||||
// FluidCraft.proxy.netHandler.sendToServer(new CPacketInventoryAction(action, slotIdx, 0,
|
||||
// aeStack));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -0,0 +1,218 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerMagnetFilter;
|
||||
import com.glodblock.github.inventory.item.WirelessMagnet;
|
||||
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
|
||||
import com.glodblock.github.util.FCGuiColors;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.config.ActionItems;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.client.gui.GuiSub;
|
||||
import appeng.client.gui.widgets.GuiImgButton;
|
||||
import appeng.client.gui.widgets.MEGuiTextField;
|
||||
|
||||
public class GuiMagnetFilter extends GuiSub {
|
||||
|
||||
protected FCGuiBaseButton listModeBtn;
|
||||
protected ContainerMagnetFilter cont;
|
||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/magnet_filter.png");
|
||||
|
||||
protected Component[] components = new Component[4];
|
||||
protected MEGuiTextField oreDict;
|
||||
protected GuiImgButton clearBtn;
|
||||
|
||||
public GuiMagnetFilter(InventoryPlayer ip, ITerminalHost container) {
|
||||
super(new ContainerMagnetFilter(ip, container));
|
||||
this.xSize = 176;
|
||||
this.ySize = 214;
|
||||
this.cont = (ContainerMagnetFilter) this.inventorySlots;
|
||||
oreDict = new MEGuiTextField(149, 12, NameConst.i18n(NameConst.TT_MAGNET_CARD_OREDICT));
|
||||
}
|
||||
|
||||
private class Component {
|
||||
|
||||
private final GuiFCImgButton enable;
|
||||
private final GuiFCImgButton disable;
|
||||
private final CPacketFluidPatternTermBtns.Command action;
|
||||
private boolean var;
|
||||
|
||||
public Component(int x, int y, boolean var, CPacketFluidPatternTermBtns.Command action) {
|
||||
this.enable = new GuiFCImgButton(x, y, "ENABLE_12x", "ENABLE", false);
|
||||
this.disable = new GuiFCImgButton(x, y, "DISABLE_12x", "DISABLE", false);
|
||||
this.var = var;
|
||||
this.action = action;
|
||||
enable.setThreeFourths(true);
|
||||
disable.setThreeFourths(true);
|
||||
buttonList.add(this.enable);
|
||||
buttonList.add(this.disable);
|
||||
}
|
||||
|
||||
public boolean sameBtn(GuiButton btn) {
|
||||
return btn == this.enable || btn == this.disable;
|
||||
}
|
||||
|
||||
public boolean getVar() {
|
||||
return this.var;
|
||||
}
|
||||
|
||||
public void setVar(boolean var) {
|
||||
this.var = var;
|
||||
}
|
||||
|
||||
public void send() {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns(this.action, !this.getVar()));
|
||||
}
|
||||
|
||||
public void draw() {
|
||||
if (var) {
|
||||
this.enable.visible = true;
|
||||
this.disable.visible = false;
|
||||
} else {
|
||||
this.enable.visible = false;
|
||||
this.disable.visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.buttonList.clear();
|
||||
|
||||
this.buttonList.add(
|
||||
this.listModeBtn = new FCGuiBaseButton(
|
||||
0,
|
||||
this.guiLeft + 86,
|
||||
this.guiTop + 4,
|
||||
64,
|
||||
14,
|
||||
NameConst.i18n(
|
||||
this.cont.listMode == WirelessMagnet.ListMode.WhiteList
|
||||
? NameConst.GUI_MAGNET_CARD_WhiteList
|
||||
: NameConst.GUI_MAGNET_CARD_BlackList)));
|
||||
this.components[0] = new Component(
|
||||
this.guiLeft + 157,
|
||||
this.guiTop + 18,
|
||||
this.cont.nbt,
|
||||
CPacketFluidPatternTermBtns.Command.MAGNET_FILTER_NBT);
|
||||
this.components[1] = new Component(
|
||||
this.guiLeft + 157,
|
||||
this.guiTop + 31,
|
||||
this.cont.meta,
|
||||
CPacketFluidPatternTermBtns.Command.MAGNET_FILTER_META);
|
||||
this.components[2] = new Component(
|
||||
this.guiLeft + 157,
|
||||
this.guiTop + 44,
|
||||
this.cont.ore,
|
||||
CPacketFluidPatternTermBtns.Command.MAGNET_FILTER_ORE);
|
||||
this.components[3] = new Component(
|
||||
this.guiLeft + 157,
|
||||
this.guiTop + 112,
|
||||
this.cont.oreDict,
|
||||
CPacketFluidPatternTermBtns.Command.MAGNET_FILTER_OREDICT_STATE);
|
||||
|
||||
oreDict.x = this.guiLeft + 7;
|
||||
oreDict.y = this.guiTop + 112;
|
||||
oreDict.setText(this.cont.oreDictFilter);
|
||||
|
||||
this.clearBtn = new GuiImgButton(this.guiLeft + 7, this.guiTop + 48, Settings.ACTIONS, ActionItems.CLOSE);
|
||||
this.clearBtn.setHalfSize(true);
|
||||
this.buttonList.add(this.clearBtn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float btn) {
|
||||
handleTooltip(mouseX, mouseY, oreDict);
|
||||
super.drawScreen(mouseX, mouseY, btn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
this.fontRendererObj
|
||||
.drawString(NameConst.i18n(NameConst.GUI_MAGNET_CARD), 8, 6, FCGuiColors.guiTextColorGray.getColor());
|
||||
this.fontRendererObj.drawString(
|
||||
NameConst.i18n(NameConst.GUI_MAGNET_CARD_NBT),
|
||||
61,
|
||||
22,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
this.fontRendererObj.drawString(
|
||||
NameConst.i18n(NameConst.GUI_MAGNET_CARD_META),
|
||||
61,
|
||||
34,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
this.fontRendererObj.drawString(
|
||||
NameConst.i18n(NameConst.GUI_MAGNET_CARD_ORE),
|
||||
61,
|
||||
46,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
this.components[0].setVar(this.cont.nbt);
|
||||
this.components[1].setVar(this.cont.meta);
|
||||
this.components[2].setVar(this.cont.ore);
|
||||
this.components[3].setVar(this.cont.oreDict);
|
||||
// the synced value arrives after initGui, so re-apply it while the field is not being edited
|
||||
if (!oreDict.isFocused() && this.cont.oreDictFilter != null
|
||||
&& !this.cont.oreDictFilter.equals(oreDict.getText())) {
|
||||
oreDict.setText(this.cont.oreDictFilter, true);
|
||||
}
|
||||
for (Component c : components) {
|
||||
c.draw();
|
||||
}
|
||||
this.listModeBtn.displayString = NameConst.i18n(
|
||||
this.cont.listMode == WirelessMagnet.ListMode.WhiteList ? NameConst.GUI_MAGNET_CARD_WhiteList
|
||||
: NameConst.GUI_MAGNET_CARD_BlackList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
bindTexture(TEX_BG);
|
||||
drawTexturedModalRect(offsetX, offsetY, 0, 0, xSize, ySize);
|
||||
oreDict.drawTextBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char typedChar, int keyCode) {
|
||||
if (oreDict.isFocused() && (Keyboard.KEY_NUMPADENTER == keyCode || Keyboard.KEY_RETURN == keyCode)) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns(
|
||||
CPacketFluidPatternTermBtns.Command.MAGNET_FILTER_OREDICT_FILTER,
|
||||
oreDict.getText()));
|
||||
}
|
||||
|
||||
if (!oreDict.textboxKeyTyped(typedChar, keyCode)) super.keyTyped(typedChar, keyCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(int xCoord, int yCoord, int btn) {
|
||||
oreDict.mouseClicked(xCoord, yCoord, btn);
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton btn) {
|
||||
for (Component c : components) {
|
||||
if (c.sameBtn(btn)) {
|
||||
c.send();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (btn == this.listModeBtn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns(
|
||||
CPacketFluidPatternTermBtns.Command.MAGNET_FILTER_MODE,
|
||||
this.cont.listMode != WirelessMagnet.ListMode.WhiteList));
|
||||
} else if (btn == this.clearBtn) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketFluidPatternTermBtns(CPacketFluidPatternTermBtns.Command.MAGNET_FILTER_CLEAR, 1));
|
||||
}
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ 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.FCGuiColors;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
@@ -29,7 +30,12 @@ public class GuiOCPatternEditor extends AEBaseGui {
|
||||
|
||||
@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);
|
||||
fontRendererObj.drawString(
|
||||
getGuiDisplayName(I18n.format(NameConst.GUI_OC_PATTERN_EDITOR)),
|
||||
8,
|
||||
6,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
fontRendererObj
|
||||
.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, FCGuiColors.guiTextColorGray.getColor());
|
||||
}
|
||||
}
|
||||
@@ -1,152 +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.xPosition = this.guiLeft + 50;
|
||||
this.amountTextField.setText(String.valueOf(DEFAULT_VALUE));
|
||||
this.amountTextField.setSelectionPos(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.fontRendererObj
|
||||
.drawString(GuiText.SelectAmount.getLocal(), 8, 6, GuiColors.CraftAmountSelectAmount.getColor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
super.drawBG(offsetX, offsetY, mouseX, mouseY);
|
||||
this.nextBtn.displayString = GuiText.Set.getLocal();
|
||||
|
||||
try {
|
||||
int resultI = getAmount();
|
||||
|
||||
this.symbolSwitch.set(resultI >= 0 ? ActionItems.MULTIPLY : ActionItems.DIVIDE);
|
||||
this.nextBtn.enabled = resultI < -1 || resultI > 1;
|
||||
} catch (final NumberFormatException e) {
|
||||
this.nextBtn.enabled = false;
|
||||
}
|
||||
|
||||
this.amountTextField.drawTextBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
|
||||
try {
|
||||
|
||||
if (btn == this.nextBtn && btn.enabled) {
|
||||
int resultI = getAmount();
|
||||
if (resultI > 1 || resultI < -1)
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketPatternMultiSet(this.originalGui, resultI));
|
||||
}
|
||||
} catch (final NumberFormatException e) {
|
||||
// nope..
|
||||
this.amountTextField.setText(String.valueOf(DEFAULT_VALUE));
|
||||
}
|
||||
|
||||
if (btn == this.symbolSwitch) {
|
||||
int resultI = -getAmount();
|
||||
this.amountTextField.setText(Integer.toString(resultI));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getAmount() {
|
||||
String out = this.amountTextField.getText();
|
||||
|
||||
double resultD = Calculator.conversion(out);
|
||||
|
||||
if (Double.isNaN(resultD)) {
|
||||
return DEFAULT_VALUE;
|
||||
} else {
|
||||
return (int) ArithHelper.round(resultD, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int addOrderAmount(final int i) {
|
||||
return i + getAmount();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBackground() {
|
||||
return "guis/patternMulti.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setOriginGUI(Object target) {
|
||||
if (target instanceof PartFluidPatternTerminal) {
|
||||
this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL.stack();
|
||||
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL;
|
||||
} else if (target instanceof PartFluidPatternTerminalEx) {
|
||||
this.myIcon = ItemAndBlockHolder.FLUID_TERMINAL_EX.stack();
|
||||
this.originalGui = GuiType.FLUID_PATTERN_TERMINAL_EX;
|
||||
} else if (target instanceof PartFluidTerminal) {
|
||||
this.myIcon = ItemAndBlockHolder.FLUID_TERM.stack();
|
||||
this.originalGui = GuiType.FLUID_TERMINAL;
|
||||
} else if (target instanceof PartLevelTerminal) {
|
||||
myIcon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
|
||||
originalGui = GuiType.LEVEL_TERMINAL;
|
||||
} else if (target instanceof IWirelessTerminal terminal && terminal.isUniversal(target)) {
|
||||
this.myIcon = ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack();
|
||||
this.originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
|
||||
} else if (target instanceof WirelessPatternTerminalInventory) {
|
||||
this.myIcon = ItemAndBlockHolder.WIRELESS_PATTERN_TERM.stack();
|
||||
this.originalGui = GuiType.FLUID_TERMINAL;
|
||||
} else if (target instanceof WirelessLevelTerminalInventory) {
|
||||
myIcon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
|
||||
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerSuperStockReplenisher;
|
||||
import com.glodblock.github.common.tile.TileSuperStockReplenisher;
|
||||
import com.glodblock.github.util.FCGuiColors;
|
||||
|
||||
import appeng.api.storage.StorageName;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.slots.VirtualMEPhantomSlot;
|
||||
import appeng.client.gui.slots.VirtualMEPhantomSlotPrecise;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.util.item.AEFluidStackType;
|
||||
import appeng.util.item.AEItemStackType;
|
||||
|
||||
public class GuiSuperStockReplenisher extends AEBaseGui {
|
||||
|
||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/superStockReplenisher.png");
|
||||
private final DecimalFormat df = new DecimalFormat("#.#");
|
||||
private Map<Integer, IAEStack<?>> list = new HashMap<>();
|
||||
private final ContainerSuperStockReplenisher containerSuperStockReplenisher;
|
||||
private final TileSuperStockReplenisher tileSuperStockReplenisher;
|
||||
|
||||
private final VirtualMEPhantomSlotPrecise[] configFluidsSlots = new VirtualMEPhantomSlotPrecise[9];
|
||||
private final VirtualMEPhantomSlotPrecise[] configItemsSlots = new VirtualMEPhantomSlotPrecise[63];
|
||||
|
||||
private GuiFCImgButton StockModeButton;
|
||||
|
||||
public GuiSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockReplenisher tile) {
|
||||
super(new ContainerSuperStockReplenisher(ipl, tile));
|
||||
|
||||
this.containerSuperStockReplenisher = (ContainerSuperStockReplenisher) inventorySlots;
|
||||
this.tileSuperStockReplenisher = tile;
|
||||
|
||||
this.ySize = 251;
|
||||
this.xSize = 216;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
this.StockModeButton = new GuiFCImgButton(
|
||||
guiLeft - 18,
|
||||
guiTop + 8,
|
||||
"stock mode button",
|
||||
this.containerSuperStockReplenisher.isFullStockMode() ? "fullstockMode" : "normalMode",
|
||||
true);
|
||||
this.containerSuperStockReplenisher.setModeButton(this.StockModeButton);
|
||||
buttonList.add(this.StockModeButton);
|
||||
this.initSlots();
|
||||
}
|
||||
|
||||
private void initSlots() {
|
||||
|
||||
final int xo = 8;
|
||||
final int yo = 8;
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
VirtualMEPhantomSlotPrecise slot = new VirtualMEPhantomSlotPrecise(
|
||||
xo + i * 18,
|
||||
yo,
|
||||
this.containerSuperStockReplenisher.configFluidsSlots,
|
||||
i,
|
||||
this::acceptType);
|
||||
this.configFluidsSlots[i] = slot;
|
||||
this.registerVirtualSlots(slot);
|
||||
}
|
||||
|
||||
final int iyo = 29;
|
||||
for (int y = 0; y < 7; y++) {
|
||||
for (int ix = 0; ix < 9; ix++) {
|
||||
VirtualMEPhantomSlotPrecise slot = new VirtualMEPhantomSlotPrecise(
|
||||
xo + ix * 18,
|
||||
iyo + y * 18,
|
||||
this.containerSuperStockReplenisher.configItemsSlots,
|
||||
y * 9 + ix,
|
||||
this::acceptType);
|
||||
this.configItemsSlots[y * 9 + ix] = slot;
|
||||
this.registerVirtualSlots(slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void drawFillStatus(VirtualMEPhantomSlotPrecise virtualSlot) {
|
||||
final int offsetX = virtualSlot.getX() - 8;
|
||||
final int offsetY = virtualSlot.getY() - 12;
|
||||
final IAEStack<?> aes = virtualSlot.getAEStack();
|
||||
final long stackSize = aes != null ? aes.getStackSize() : 0;
|
||||
final int slotIndex = virtualSlot.getStorageName() == StorageName.NONE ? virtualSlot.getSlotIndex()
|
||||
: virtualSlot.getSlotIndex() + 100;
|
||||
|
||||
if (stackSize != 0) {
|
||||
String s = "0%";
|
||||
IAEStack<?> aeStack = list.get(slotIndex);
|
||||
|
||||
if (aeStack != null) s = df.format((float) aeStack.getStackSize() / stackSize * 100) + "%";
|
||||
|
||||
float scale = 0.5f;
|
||||
float shiftX = 2;
|
||||
float shiftY = 1;
|
||||
final float inverseScaleFactor = 1.0f / scale;
|
||||
|
||||
final int X = (int) (((float) offsetX - shiftX + 10.0f) * inverseScaleFactor) + 1;
|
||||
final int Y = (int) (((float) offsetY - shiftY + 16.0f - 7.0f * scale) * inverseScaleFactor) + 2;
|
||||
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
this.fontRendererObj.drawStringWithShadow(s, X, Y, 16777215);
|
||||
GL11.glScaled(inverseScaleFactor, inverseScaleFactor, inverseScaleFactor);
|
||||
GL11.glTranslatef(0.0f, 0.0f, -200.0f);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawVirtualSlots() {
|
||||
for (VirtualMEPhantomSlotPrecise slot : this.configFluidsSlots) this.drawFillStatus(slot);
|
||||
for (VirtualMEPhantomSlotPrecise slot : this.configItemsSlots) this.drawFillStatus(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj
|
||||
.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, FCGuiColors.guiTextColorGray.getColor());
|
||||
this.drawVirtualSlots();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
this.bindTexture(TEX_BG);
|
||||
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (actionPerformedCustomButtons(btn)) return;
|
||||
if (btn == StockModeButton) {
|
||||
boolean newMode = !containerSuperStockReplenisher.isFullStockMode();
|
||||
this.containerSuperStockReplenisher.setFullStockMode(newMode);
|
||||
StockModeButton.set(newMode ? "fullstockMode" : "normalMode");
|
||||
|
||||
this.flushPendingSync();
|
||||
}
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
|
||||
public void update(Map<Integer, IAEStack<?>> map) {
|
||||
this.list = map;
|
||||
}
|
||||
|
||||
private boolean acceptType(VirtualMEPhantomSlot slot, IAEStackType<?> type, int mouseButton) {
|
||||
if (slot.getStorageName() == StorageName.NONE) return type == AEFluidStackType.FLUID_STACK_TYPE;
|
||||
else return type == AEItemStackType.ITEM_STACK_TYPE;
|
||||
}
|
||||
}
|
||||
@@ -1,49 +1,14 @@
|
||||
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.GuiInterfaceWireless;
|
||||
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.AEBaseGui;
|
||||
|
||||
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 abstract class FCBaseMEGui extends AEBaseGui {
|
||||
|
||||
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
|
||||
@@ -51,90 +16,6 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
|
||||
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);
|
||||
}
|
||||
if (!(this instanceof GuiInterfaceWireless)) {
|
||||
this.buttonList.add(
|
||||
this.InterfaceTerminal = new GuiFCImgButton(
|
||||
this.guiLeft - 18,
|
||||
this.getOffsetY(),
|
||||
"INTERFACE_TEM",
|
||||
"YES"));
|
||||
this.setOffsetY(this.getOffsetY() + 20);
|
||||
termBtns.add(this.InterfaceTerminal);
|
||||
}
|
||||
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
|
||||
@@ -156,26 +37,4 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
|
||||
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,786 +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;
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
-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;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -15,11 +15,11 @@ 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.ContainerSubGui;
|
||||
import appeng.container.slot.IOptionalSlotHost;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
|
||||
public class ContainerFluidInterface extends AEBaseContainer implements IOptionalSlotHost {
|
||||
public class ContainerFluidInterface extends ContainerSubGui implements IOptionalSlotHost {
|
||||
|
||||
private final IDualHost tile;
|
||||
|
||||
|
||||
-105
@@ -1,105 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
import 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.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 GuiTextField 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");
|
||||
final int y = 40;
|
||||
final int x = 80 + 44;
|
||||
this.addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(inv, null, this, 0, x, y, 0, 0, 0));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setTextField(final GuiTextField level) {
|
||||
this.textField = level;
|
||||
this.textField.setText(String.valueOf(this.EmitterValue));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,556 +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) {
|
||||
emptiedTanksStack = targetStack.copy();
|
||||
emptiedTanksStack.stackSize = 1;
|
||||
fcItem.drain(emptiedTanksStack, fluidPerContainer, true);
|
||||
emptiedTanksStack.stackSize = emptiedTanks;
|
||||
} else {
|
||||
emptiedTanksStack = null;
|
||||
}
|
||||
if (partialTanks > 0) {
|
||||
partialTanksStack = targetStack.copy();
|
||||
partialTanksStack.stackSize = 1;
|
||||
fcItem.drain(partialTanksStack, partialDrain, true);
|
||||
} else {
|
||||
partialTanksStack = null;
|
||||
}
|
||||
} else {
|
||||
if (emptiedTanks > 0) {
|
||||
emptiedTanksStack = FluidContainerRegistry.drainFluidContainer(targetStack);
|
||||
emptiedTanksStack.stackSize = emptiedTanks;
|
||||
} else {
|
||||
emptiedTanksStack = null;
|
||||
}
|
||||
// Not possible > see Step 2 and Step 3
|
||||
partialTanksStack = null;
|
||||
}
|
||||
|
||||
// Done. Put the output in the inventory or ground, and update stack size.
|
||||
boolean shouldSendStack = true;
|
||||
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.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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
-1
@@ -1,7 +1,10 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.DROP;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.PACKET;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.common.tile.TileFluidPacketDecoder;
|
||||
@@ -13,7 +16,14 @@ 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 FCSlotRestrictedInput(
|
||||
Arrays.asList(PACKET.stack(), DROP.stack()),
|
||||
tile.getInventory(),
|
||||
0,
|
||||
80,
|
||||
35,
|
||||
ipl));
|
||||
bindPlayerInventory(ipl, 0, 84);
|
||||
}
|
||||
}
|
||||
-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;
|
||||
}
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.inventory.item.IFluidPortableCell;
|
||||
|
||||
public class ContainerFluidPortableCell extends ContainerFluidMonitor {
|
||||
|
||||
public ContainerFluidPortableCell(final InventoryPlayer ip, final IFluidPortableCell monitorable) {
|
||||
super(ip, monitorable, false);
|
||||
this.bindPlayerInventory(ip, 0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isWirelessTerminal() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
-194
@@ -1,194 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
import com.glodblock.github.client.gui.container.base.FCContainerFluidConfigurable;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.common.parts.PartFluidStorageBus;
|
||||
import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
|
||||
import com.glodblock.github.util.Ae2Reflect;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.StorageFilter;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.util.IterationCounter;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.iterators.NullIterator;
|
||||
|
||||
public class ContainerFluidStorageBus extends FCContainerFluidConfigurable {
|
||||
|
||||
public final PartFluidStorageBus bus;
|
||||
|
||||
@GuiSync(3)
|
||||
public AccessRestriction rwMode = AccessRestriction.READ_WRITE;
|
||||
|
||||
@GuiSync(4)
|
||||
public StorageFilter storageFilter = StorageFilter.EXTRACTABLE_ONLY;
|
||||
|
||||
public ContainerFluidStorageBus(InventoryPlayer ip, PartFluidStorageBus te) {
|
||||
super(ip, te);
|
||||
this.bus = te;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getHeight() {
|
||||
return 251;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupConfig() {
|
||||
final int xo = 8;
|
||||
final int yo = 23 + 6;
|
||||
final IInventory upgrades = Ae2Reflect.getUpgradeList(this).getInventoryByName("upgrades");
|
||||
final IInventory config = Ae2Reflect.getUpgradeList(this).getInventoryByName("config");
|
||||
for (int y = 0; y < 7; y++) {
|
||||
for (int x = 0; x < 9; x++) {
|
||||
this.addSlotToContainer(
|
||||
new OptionalFluidSlotFakeTypeOnly(config, null, this, y * 9 + x, xo, yo, x, y, y));
|
||||
}
|
||||
}
|
||||
this.addSlotToContainer(
|
||||
(new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.UPGRADES,
|
||||
upgrades,
|
||||
0,
|
||||
187,
|
||||
8,
|
||||
this.getInventoryPlayer())).setNotDraggable());
|
||||
this.addSlotToContainer(
|
||||
(new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.UPGRADES,
|
||||
upgrades,
|
||||
1,
|
||||
187,
|
||||
8 + 18,
|
||||
this.getInventoryPlayer())).setNotDraggable());
|
||||
this.addSlotToContainer(
|
||||
(new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.UPGRADES,
|
||||
upgrades,
|
||||
2,
|
||||
187,
|
||||
8 + 18 * 2,
|
||||
this.getInventoryPlayer())).setNotDraggable());
|
||||
this.addSlotToContainer(
|
||||
(new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.UPGRADES,
|
||||
upgrades,
|
||||
3,
|
||||
187,
|
||||
8 + 18 * 3,
|
||||
this.getInventoryPlayer())).setNotDraggable());
|
||||
this.addSlotToContainer(
|
||||
(new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.UPGRADES,
|
||||
upgrades,
|
||||
4,
|
||||
187,
|
||||
8 + 18 * 4,
|
||||
this.getInventoryPlayer())).setNotDraggable());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isValidForConfig(int slot, IAEFluidStack fs) {
|
||||
if (this.supportCapacity()) {
|
||||
final int upgrades = Ae2Reflect.getUpgradeList(this).getInstalledUpgrades(Upgrades.CAPACITY);
|
||||
final int y = slot / 9;
|
||||
return y < upgrades + 2;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean supportCapacity() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int availableUpgrades() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
this.verifyPermissions(SecurityPermissions.BUILD, false);
|
||||
|
||||
if (Platform.isServer()) {
|
||||
this.setReadWriteMode(
|
||||
(AccessRestriction) Ae2Reflect.getUpgradeList(this).getConfigManager().getSetting(Settings.ACCESS));
|
||||
this.setStorageFilter(
|
||||
(StorageFilter) Ae2Reflect.getUpgradeList(this).getConfigManager()
|
||||
.getSetting(Settings.STORAGE_FILTER));
|
||||
}
|
||||
|
||||
this.standardDetectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlotEnabled(final int idx) {
|
||||
if (Ae2Reflect.getUpgradeList(this).getInstalledUpgrades(Upgrades.ORE_FILTER) > 0) return false;
|
||||
final int upgrades = Ae2Reflect.getUpgradeList(this).getInstalledUpgrades(Upgrades.CAPACITY);
|
||||
return upgrades > (idx - 2);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
AppEngInternalAEInventory h = this.bus.getConfig();
|
||||
for (int i = 0; i < h.getSizeInventory(); ++i) {
|
||||
h.setInventorySlotContents(i, null);
|
||||
}
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
public void partition() {
|
||||
AppEngInternalAEInventory h = this.bus.getConfig();
|
||||
final IMEInventory<IAEFluidStack> cellInv = this.bus.getInternalHandler();
|
||||
Iterator<IAEFluidStack> i = new NullIterator<>();
|
||||
if (cellInv != null) {
|
||||
final IItemList<IAEFluidStack> list = cellInv
|
||||
.getAvailableItems(AEApi.instance().storage().createFluidList(), IterationCounter.fetchNewId());
|
||||
i = list.iterator();
|
||||
}
|
||||
|
||||
for (int x = 0; x < h.getSizeInventory(); x++) {
|
||||
if (i.hasNext() && this.isSlotEnabled((x / 9) - 2)) {
|
||||
h.setInventorySlotContents(x, ItemFluidPacket.newStack(i.next()));
|
||||
} else {
|
||||
h.setInventorySlotContents(x, null);
|
||||
}
|
||||
}
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
public AccessRestriction getReadWriteMode() {
|
||||
return this.rwMode;
|
||||
}
|
||||
|
||||
public StorageFilter getStorageFilter() {
|
||||
return this.storageFilter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppEngInternalAEInventory getFakeFluidInv() {
|
||||
return (AppEngInternalAEInventory) this.bus.getInventoryByName("config");
|
||||
}
|
||||
|
||||
private void setReadWriteMode(final AccessRestriction rwMode) {
|
||||
this.rwMode = rwMode;
|
||||
}
|
||||
|
||||
private void setStorageFilter(final StorageFilter storageFilter) {
|
||||
this.storageFilter = storageFilter;
|
||||
}
|
||||
}
|
||||
-44
@@ -1,44 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.client.gui.container.base.FCBaseContainer;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
|
||||
import appeng.container.implementations.ContainerInterfaceTerminal;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ContainerInterfaceWireless extends FCBaseContainer {
|
||||
|
||||
ContainerInterfaceTerminal delegateContainer;
|
||||
|
||||
public ContainerInterfaceWireless(final InventoryPlayer ip, final IWirelessTerminal monitorable) {
|
||||
super(ip, monitorable);
|
||||
|
||||
delegateContainer = new ContainerInterfaceTerminal(ip, monitorable);
|
||||
|
||||
this.bindPlayerInventory(ip, 14, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
if (Platform.isClient()) {
|
||||
return;
|
||||
}
|
||||
super.detectAndSendChanges();
|
||||
|
||||
delegateContainer.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAction(final EntityPlayerMP player, final InventoryAction action, final int slot, final long id) {
|
||||
delegateContainer.doAction(player, action, slot, id);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isWirelessTerminal() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import java.util.ArrayList;
|
||||
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.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.glodblock.github.client.gui.container.base.FCContainerMonitor;
|
||||
import com.glodblock.github.network.SPacketMEUpdateBuffer;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.implementations.tiles.IViewCellStorage;
|
||||
import appeng.api.networking.IGrid;
|
||||
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.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.me.helpers.ChannelPowerSrc;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ContainerItemMonitor extends FCContainerMonitor<IAEItemStack> {
|
||||
|
||||
private final IItemList<IAEItemStack> items = AEApi.instance().storage().createItemList();
|
||||
|
||||
public ContainerItemMonitor(final InventoryPlayer ip, final ITerminalHost monitorable) {
|
||||
this(ip, monitorable, true);
|
||||
}
|
||||
|
||||
protected ContainerItemMonitor(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.getItemInventory();
|
||||
if (this.monitor == null) {
|
||||
this.setValidContainer(false);
|
||||
} else {
|
||||
this.monitor.addListener(this, null);
|
||||
this.setCellInventory(this.monitor);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.setValidContainer(false);
|
||||
}
|
||||
} else {
|
||||
this.monitor = monitorable.getItemInventory();
|
||||
this.monitor.addListener(this, null);
|
||||
this.setCellInventory(this.monitor);
|
||||
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
|
||||
protected void processItemList() {
|
||||
if (!this.items.isEmpty()) {
|
||||
final IItemList<IAEItemStack> monitorCache = this.monitor.getStorageList();
|
||||
List<IAEItemStack> toSend = new ArrayList<>();
|
||||
for (final IAEItemStack is : this.items) {
|
||||
final IAEItemStack 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 EntityPlayer) {
|
||||
SPacketMEUpdateBuffer.scheduleItemUpdate((EntityPlayerMP) c, toSend);
|
||||
}
|
||||
}
|
||||
this.items.resetStatus();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void queueInventory(final ICrafting c) {
|
||||
if (Platform.isServer() && c instanceof EntityPlayer && this.monitor != null) {
|
||||
final IItemList<IAEItemStack> monitorCache = this.monitor.getStorageList();
|
||||
List<IAEItemStack> toSend = new ArrayList<>();
|
||||
for (final IAEItemStack is : monitorCache) {
|
||||
toSend.add(is);
|
||||
}
|
||||
SPacketMEUpdateBuffer.scheduleItemUpdate((EntityPlayerMP) c, toSend);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCraftingFromCrafters(final ICrafting c) {
|
||||
super.removeCraftingFromCrafters(c);
|
||||
if (this.crafters.isEmpty() && this.monitor != null) {
|
||||
this.monitor.removeListener(this);
|
||||
if (c instanceof EntityPlayerMP) {
|
||||
SPacketMEUpdateBuffer.clear((EntityPlayerMP) c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postChange(final IBaseMonitor<IAEItemStack> monitor, final Iterable<IAEItemStack> change,
|
||||
final BaseActionSource source) {
|
||||
for (final IAEItemStack is : change) {
|
||||
this.items.add(is);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isWirelessTerminal() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+68
-91
@@ -1,40 +1,41 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
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 net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
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.AeItemStackHandler;
|
||||
import com.glodblock.github.inventory.slot.SlotFluidConvertingFake;
|
||||
import com.glodblock.github.util.Util;
|
||||
import com.glodblock.github.network.SPacketLevelMaintainerGuiUpdate;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.api.storage.StorageName;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.container.ContainerSubGui;
|
||||
import appeng.container.interfaces.IVirtualSlotHolder;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketVirtualSlot;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.tile.inventory.IAEStackInventory;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
|
||||
public class ContainerLevelMaintainer extends AEBaseContainer {
|
||||
public class ContainerLevelMaintainer extends ContainerSubGui implements IVirtualSlotHolder {
|
||||
|
||||
private final TileLevelMaintainer tile;
|
||||
private final SlotFluidConvertingFake[] requestSlots = new SlotFluidConvertingFake[TileLevelMaintainer.REQ_COUNT];
|
||||
|
||||
private static final int UPDATE_INTERVAL = 20;
|
||||
private boolean isFirstUpdate = true;
|
||||
private int updateCount = UPDATE_INTERVAL;
|
||||
|
||||
public ContainerLevelMaintainer(InventoryPlayer ipl, TileLevelMaintainer tile) {
|
||||
super(ipl, tile);
|
||||
this.tile = tile;
|
||||
AeItemStackHandler request = new AeItemStackHandler(tile.getRequestSlots());
|
||||
for (int y = 0; y < TileLevelMaintainer.REQ_COUNT; y++) {
|
||||
SlotFluidConvertingFake slot = new SlotFluidConvertingFake(request, y, 27, 20 + y * 19);
|
||||
addSlotToContainer(slot);
|
||||
requestSlots[y] = slot;
|
||||
}
|
||||
|
||||
bindPlayerInventory(ipl, 0, 130);
|
||||
}
|
||||
|
||||
@@ -42,55 +43,16 @@ public class ContainerLevelMaintainer extends AEBaseContainer {
|
||||
return tile;
|
||||
}
|
||||
|
||||
public SlotFluidConvertingFake[] getRequestSlots() {
|
||||
return this.requestSlots;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAction(EntityPlayerMP player, InventoryAction action, int slotId, long id) {
|
||||
Slot slot = getSlot(slotId);
|
||||
if (slot instanceof SlotFluidConvertingFake) {
|
||||
if (getSlot(slotId) instanceof SlotFluidConvertingFake slot) {
|
||||
final ItemStack stack = player.inventory.getItemStack();
|
||||
switch (action) {
|
||||
case PICKUP_OR_SET_DOWN -> {
|
||||
case PICKUP_OR_SET_DOWN, PLACE_SINGLE, SPLIT_OR_PLACE_SINGLE -> {
|
||||
if (stack == null) {
|
||||
slot.putStack(null);
|
||||
} else {
|
||||
((SlotFluidConvertingFake) slot).putConvertedStack(createLevelValues(stack.copy()));
|
||||
}
|
||||
}
|
||||
case PLACE_SINGLE -> {
|
||||
if (stack != null) {
|
||||
((SlotFluidConvertingFake) slot).putConvertedStack(
|
||||
createLevelValues(Objects.requireNonNull(Util.copyStackWithSize(stack, 1))));
|
||||
}
|
||||
}
|
||||
case SPLIT_OR_PLACE_SINGLE -> {
|
||||
ItemStack inSlot = slot.getStack();
|
||||
if (inSlot != null) {
|
||||
if (stack == null) {
|
||||
slot.putStack(
|
||||
createLevelValues(
|
||||
Objects.requireNonNull(
|
||||
Util.copyStackWithSize(
|
||||
inSlot,
|
||||
Math.max(1, inSlot.stackSize - 1)))));
|
||||
} else if (stack.isItemEqual(inSlot)) {
|
||||
slot.putStack(
|
||||
createLevelValues(
|
||||
Objects.requireNonNull(
|
||||
Util.copyStackWithSize(
|
||||
inSlot,
|
||||
Math.min(
|
||||
inSlot.getMaxStackSize(),
|
||||
inSlot.stackSize + 1)))));
|
||||
} else {
|
||||
((SlotFluidConvertingFake) slot).putConvertedStack(
|
||||
createLevelValues(Objects.requireNonNull(Util.copyStackWithSize(stack, 1))));
|
||||
}
|
||||
} else if (stack != null) {
|
||||
((SlotFluidConvertingFake) slot).putConvertedStack(
|
||||
createLevelValues(Objects.requireNonNull(Util.copyStackWithSize(stack, 1))));
|
||||
slot.putConvertedStack(stack);
|
||||
}
|
||||
}
|
||||
default -> {}
|
||||
@@ -106,14 +68,15 @@ public class ContainerLevelMaintainer extends AEBaseContainer {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.getRequestSlots().length; i++) {
|
||||
SlotFluidConvertingFake slot = this.getRequestSlots()[i];
|
||||
if (!slot.getHasStack()) {
|
||||
ItemStack itemStack = ((Slot) this.inventorySlots.get(idx)).getStack();
|
||||
ItemStack configuration = createLevelValues(itemStack.copy());
|
||||
configuration.getTagCompound().setInteger(TLMTags.Index.tagName, i);
|
||||
slot.putConvertedStack(configuration);
|
||||
break;
|
||||
ItemStack clickedStack = this.inventorySlots.get(idx).getStack();
|
||||
if (clickedStack != null) {
|
||||
IAEStackInventory inventory = this.getTile().getAEStackInventory();
|
||||
for (int i = 0; i < inventory.getSizeInventory(); i++) {
|
||||
IAEStack<?> stack = inventory.getAEStackInSlot(i);
|
||||
if (stack == null) {
|
||||
tile.updateStack(i, AEItemStack.create(clickedStack));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -123,35 +86,49 @@ public class ContainerLevelMaintainer extends AEBaseContainer {
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
if (Platform.isClient()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.verifyPermissions(SecurityPermissions.BUILD, false);
|
||||
|
||||
super.detectAndSendChanges();
|
||||
if (this.updateCount++ >= UPDATE_INTERVAL) {
|
||||
this.updateGui();
|
||||
}
|
||||
}
|
||||
|
||||
public static ItemStack createLevelValues(ItemStack itemStack) {
|
||||
var data = itemStack.hasTagCompound() ? itemStack.getTagCompound() : new NBTTagCompound();
|
||||
if (!data.hasKey(TLMTags.Stack.tagName)) {
|
||||
var itemStackTag = new NBTTagCompound();
|
||||
itemStack.copy().writeToNBT(itemStackTag);
|
||||
data.setTag(TLMTags.Stack.tagName, itemStackTag);
|
||||
public void updateGui() {
|
||||
if (this.isFirstUpdate) {
|
||||
Int2ObjectMap<IAEStack<?>> list = new Int2ObjectOpenHashMap<>();
|
||||
for (int i = 0; i < this.tile.requests.length; i++) {
|
||||
TileLevelMaintainer.RequestInfo info = this.tile.requests[i];
|
||||
list.put(i, info != null ? info.getAEStack() : null);
|
||||
}
|
||||
NetworkHandler.instance.sendTo(
|
||||
new PacketVirtualSlot(StorageName.NONE, list),
|
||||
(EntityPlayerMP) this.getInventoryPlayer().player);
|
||||
}
|
||||
if (!data.hasKey(TLMTags.Quantity.tagName)) {
|
||||
data.setLong(TLMTags.Quantity.tagName, itemStack.stackSize > 0 ? itemStack.stackSize : 1);
|
||||
}
|
||||
if (!data.hasKey(TLMTags.Batch.tagName)) {
|
||||
data.setLong(TLMTags.Batch.tagName, 1);
|
||||
}
|
||||
if (!data.hasKey(TLMTags.Enable.tagName)) {
|
||||
data.setBoolean(TLMTags.Enable.tagName, false);
|
||||
}
|
||||
if (data.hasKey(TLMTags.Index.tagName)) {
|
||||
data.removeTag(TLMTags.Index.tagName);
|
||||
}
|
||||
|
||||
data.setInteger(TLMTags.State.tagName, State.None.ordinal());
|
||||
itemStack.setTagCompound(data);
|
||||
|
||||
return itemStack;
|
||||
FluidCraft.proxy.netHandler.sendTo(
|
||||
new SPacketLevelMaintainerGuiUpdate(this.tile.requests, !this.isFirstUpdate, this.tile.isLiteMode()),
|
||||
(EntityPlayerMP) this.getInventoryPlayer().player);
|
||||
this.isFirstUpdate = false;
|
||||
this.updateCount = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveSlotStacks(StorageName invName, Int2ObjectMap<IAEStack<?>> slotStacks) {
|
||||
for (var entry : slotStacks.int2ObjectEntrySet()) {
|
||||
this.tile.updateStack(entry.getIntKey(), entry.getValue());
|
||||
}
|
||||
if (!this.tile.getWorldObj().isRemote) {
|
||||
for (var player : this.crafters) {
|
||||
NetworkHandler.instance
|
||||
.sendTo(new PacketVirtualSlot(StorageName.NONE, slotStacks), (EntityPlayerMP) player);
|
||||
FluidCraft.proxy.netHandler.sendTo(
|
||||
new SPacketLevelMaintainerGuiUpdate(this.tile.requests, false, this.tile.isLiteMode()),
|
||||
(EntityPlayerMP) player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+83
-234
@@ -1,43 +1,39 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.api.registries.ILevelViewable;
|
||||
import com.glodblock.github.client.gui.container.base.FCBaseContainer;
|
||||
import com.glodblock.github.common.parts.PartLevelTerminal;
|
||||
import com.glodblock.github.coremod.registries.LevelTerminalRegistry;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.network.SPacketLevelTerminalUpdate;
|
||||
import com.google.common.primitives.Ints;
|
||||
import com.glodblock.github.util.FluidPrimaryGui;
|
||||
import com.glodblock.github.util.LevelTerminalRegistry;
|
||||
|
||||
import appeng.api.features.ILevelViewable;
|
||||
import appeng.api.features.LevelItemInfo;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.items.misc.ItemEncodedPattern;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.container.ContainerOpenContext;
|
||||
import appeng.container.PrimaryGui;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.inv.AdaptorPlayerHand;
|
||||
import appeng.util.inv.ItemSlot;
|
||||
|
||||
public class ContainerLevelTerminal extends FCBaseContainer {
|
||||
|
||||
@@ -50,8 +46,8 @@ public class ContainerLevelTerminal extends FCBaseContainer {
|
||||
private final Map<Long, ContainerLevelTerminal.InvTracker> trackedById = new HashMap<>();
|
||||
|
||||
private IGrid grid;
|
||||
private SPacketLevelTerminalUpdate dirty;
|
||||
private boolean isDirty;
|
||||
private SPacketLevelTerminalUpdate updatePacket;
|
||||
private boolean isPacketDirty;
|
||||
private boolean wasOff;
|
||||
private int ticks = 0;
|
||||
|
||||
@@ -63,11 +59,13 @@ public class ContainerLevelTerminal extends FCBaseContainer {
|
||||
} else if (monitorable instanceof IWirelessTerminal wirelessTerminal) {
|
||||
grid = wirelessTerminal.getActionableNode().getGrid();
|
||||
}
|
||||
dirty = this.updateList();
|
||||
if (dirty != null) {
|
||||
this.isDirty = true;
|
||||
|
||||
updatePacket = this.updateList();
|
||||
if (updatePacket != null) {
|
||||
this.isPacketDirty = true;
|
||||
} else {
|
||||
dirty = new SPacketLevelTerminalUpdate();
|
||||
updatePacket = new SPacketLevelTerminalUpdate();
|
||||
this.isPacketDirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +90,7 @@ public class ContainerLevelTerminal extends FCBaseContainer {
|
||||
if (!wasOff) {
|
||||
SPacketLevelTerminalUpdate update = new SPacketLevelTerminalUpdate();
|
||||
|
||||
update.setDisconnect();
|
||||
update.addDisconnectEntry();
|
||||
wasOff = true;
|
||||
FluidCraft.proxy.netHandler.sendTo(update, (EntityPlayerMP) this.getPlayerInv().player);
|
||||
}
|
||||
@@ -100,149 +98,20 @@ public class ContainerLevelTerminal extends FCBaseContainer {
|
||||
}
|
||||
wasOff = false;
|
||||
|
||||
if (isDirty) {
|
||||
FluidCraft.proxy.netHandler.sendTo(dirty, (EntityPlayerMP) this.getPlayerInv().player);
|
||||
dirty = new SPacketLevelTerminalUpdate();
|
||||
isDirty = false;
|
||||
if (isPacketDirty) {
|
||||
FluidCraft.proxy.netHandler.sendTo(updatePacket, (EntityPlayerMP) this.getPlayerInv().player);
|
||||
updatePacket = new SPacketLevelTerminalUpdate();
|
||||
isPacketDirty = false;
|
||||
} else if (++ticks % 20 == 0) {
|
||||
ticks = 0;
|
||||
SPacketLevelTerminalUpdate update = this.updateList();
|
||||
if (update != null) {
|
||||
FluidCraft.proxy.netHandler.sendTo(update, (EntityPlayerMP) this.getPlayerInv().player);
|
||||
SPacketLevelTerminalUpdate updateNew = this.updateList();
|
||||
if (updateNew != null) {
|
||||
FluidCraft.proxy.netHandler.sendTo(updateNew, (EntityPlayerMP) this.getPlayerInv().player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge from slot -> player inv. Returns the items not added.
|
||||
*/
|
||||
private ItemStack mergeToPlayerInventory(InventoryAdaptor playerInv, ItemStack stack) {
|
||||
if (stack == null) return null;
|
||||
for (ItemSlot slot : playerInv) {
|
||||
if (Platform.isSameItemPrecise(slot.getItemStack(), stack)) {
|
||||
if (slot.getItemStack().stackSize < slot.getItemStack().getMaxStackSize()) {
|
||||
++slot.getItemStack().stackSize;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return playerInv.addItems(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doAction(final EntityPlayerMP player, final InventoryAction action, final int slotIdx, final long id) {
|
||||
final ContainerLevelTerminal.InvTracker invTracker = this.trackedById.get(id);
|
||||
if (invTracker != null) {
|
||||
final ItemStack handStack = player.inventory.getItemStack();
|
||||
|
||||
if (handStack != null && !(handStack.getItem() instanceof ItemEncodedPattern)) {
|
||||
// Why even bother if we're not dealing with an encoded pattern in hand
|
||||
return;
|
||||
}
|
||||
|
||||
final ItemStack slotStack = invTracker.requests.getStackInSlot(slotIdx);
|
||||
final InventoryAdaptor playerHand = new AdaptorPlayerHand(player);
|
||||
|
||||
switch (action) {
|
||||
/* Set down/pickup. This is the same as SPLIT_OR_PLACE_SINGLE as our max stack sizes are 1 in slots. */
|
||||
case PICKUP_OR_SET_DOWN -> {
|
||||
if (handStack != null) {
|
||||
for (int s = 0; s < invTracker.requests.getSizeInventory(); s++) {
|
||||
/* Is there a duplicate pattern here? */
|
||||
if (Platform.isSameItemPrecise(invTracker.requests.getStackInSlot(s), handStack)) {
|
||||
/* We're done here - dupe found. */
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (slotStack == null) {
|
||||
/* Insert to container, if valid */
|
||||
if (handStack == null) {
|
||||
/* Nothing happens */
|
||||
return;
|
||||
}
|
||||
invTracker.requests.setInventorySlotContents(slotIdx, playerHand.removeItems(1, null, null));
|
||||
} else {
|
||||
/* Exchange? */
|
||||
if (handStack != null && handStack.stackSize > 1) {
|
||||
/* Exchange is impossible, abort */
|
||||
return;
|
||||
}
|
||||
invTracker.requests.setInventorySlotContents(slotIdx, playerHand.removeItems(1, null, null));
|
||||
playerHand.addItems(slotStack.copy());
|
||||
}
|
||||
syncLevelTerminalSlot(invTracker, id, slotIdx, invTracker.requests.getStackInSlot(slotIdx));
|
||||
}
|
||||
/* Shift click from slotIdx -> player. Player -> slotIdx is not supported. */
|
||||
case SHIFT_CLICK -> {
|
||||
InventoryAdaptor playerInv = InventoryAdaptor.getAdaptor(player.inventory, ForgeDirection.UNKNOWN);
|
||||
ItemStack leftOver = mergeToPlayerInventory(playerInv, slotStack);
|
||||
|
||||
if (leftOver == null) {
|
||||
invTracker.requests.setInventorySlotContents(slotIdx, null);
|
||||
syncLevelTerminalSlot(invTracker, id, slotIdx, null);
|
||||
}
|
||||
}
|
||||
/* Move all blank patterns -> player */
|
||||
case MOVE_REGION -> {
|
||||
final InventoryAdaptor playerInv = InventoryAdaptor.getAdaptor(player, ForgeDirection.UNKNOWN);
|
||||
List<Integer> valid = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < invTracker.requests.getSizeInventory(); i++) {
|
||||
ItemStack toExtract = invTracker.requests.getStackInSlot(i);
|
||||
|
||||
if (toExtract == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack leftOver = mergeToPlayerInventory(playerInv, toExtract);
|
||||
|
||||
if (leftOver != null) {
|
||||
break;
|
||||
} else {
|
||||
invTracker.requests.setInventorySlotContents(i, null);
|
||||
}
|
||||
valid.add(i);
|
||||
}
|
||||
if (!valid.isEmpty()) {
|
||||
int[] validIndices = Ints.toArray(valid);
|
||||
NBTTagList tag = new NBTTagList();
|
||||
for (int i = 0; i < valid.size(); ++i) {
|
||||
tag.appendTag(new NBTTagCompound());
|
||||
}
|
||||
dirty.addOverwriteEntry(id).setItems(validIndices, tag);
|
||||
isDirty = true;
|
||||
}
|
||||
}
|
||||
case CREATIVE_DUPLICATE -> {
|
||||
if (player.capabilities.isCreativeMode) {
|
||||
playerHand.addItems(handStack);
|
||||
}
|
||||
}
|
||||
default -> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.updateHeld(player);
|
||||
}
|
||||
}
|
||||
|
||||
private void syncLevelTerminalSlot(ContainerLevelTerminal.InvTracker inv, long id, int slot, ItemStack stack) {
|
||||
int[] validIndices = { slot };
|
||||
NBTTagList list = new NBTTagList();
|
||||
NBTTagCompound item = new NBTTagCompound();
|
||||
|
||||
if (stack != null) {
|
||||
stack.writeToNBT(item);
|
||||
}
|
||||
list.appendTag(item);
|
||||
inv.updateNBT();
|
||||
this.dirty.addOverwriteEntry(id).setItems(validIndices, list);
|
||||
this.isDirty = true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private SPacketLevelTerminalUpdate updateList() {
|
||||
SPacketLevelTerminalUpdate update = null;
|
||||
var supported = LevelTerminalRegistry.instance().getSupportedClasses();
|
||||
@@ -257,64 +126,67 @@ public class ContainerLevelTerminal extends FCBaseContainer {
|
||||
final ILevelViewable machine = isAdopted
|
||||
? LevelTerminalRegistry.instance().getAdapter(clz).adapt(gridHost)
|
||||
: (ILevelViewable) gridHost;
|
||||
visited.add(gridHost);
|
||||
|
||||
/* First check if we are already tracking this node */
|
||||
if (tracked.containsKey(gridHost)) {
|
||||
/* Check for updates */
|
||||
ContainerLevelTerminal.InvTracker knownTracker = tracked.get(gridHost);
|
||||
|
||||
/* Name changed? */
|
||||
String name = machine.getCustomName();
|
||||
|
||||
if (!Objects.equals(knownTracker.name, name)) {
|
||||
if (update == null) update = new SPacketLevelTerminalUpdate();
|
||||
update.addRenamedEntry(knownTracker.id, name);
|
||||
knownTracker.name = name;
|
||||
if (update == null) update = new SPacketLevelTerminalUpdate();
|
||||
update.addRenameEntry(knownTracker.id, name);
|
||||
}
|
||||
|
||||
/* Status changed? */
|
||||
boolean isActive = gridNode.isActive() || machine.shouldDisplay();
|
||||
LevelItemInfo[] prev = knownTracker.infoList;
|
||||
LevelItemInfo[] curr = machine.getLevelItemInfoList();
|
||||
if (prev.length == curr.length) {
|
||||
for (int i = 0; i < prev.length; i++) {
|
||||
if (prev[i] == null && curr[i] == null) continue;
|
||||
|
||||
if (!knownTracker.online && isActive) {
|
||||
/* Node offline -> online */
|
||||
knownTracker.online = true;
|
||||
if (update == null) update = new SPacketLevelTerminalUpdate();
|
||||
knownTracker.updateNBT();
|
||||
update.addOverwriteEntry(knownTracker.id).setOnline(true)
|
||||
.setItems(knownTracker.requests.getSizeInventory(), knownTracker.inventoryNbt);
|
||||
} else if (knownTracker.online && !isActive) {
|
||||
/* Node online -> offline */
|
||||
knownTracker.online = false;
|
||||
if (update == null) update = new SPacketLevelTerminalUpdate();
|
||||
update.addOverwriteEntry(knownTracker.id).setOnline(false);
|
||||
}
|
||||
|
||||
for (int i = 0; i < knownTracker.requests.getSizeInventory(); i++) {
|
||||
ItemStack knowmItemStack = ItemStack
|
||||
.loadItemStackFromNBT(knownTracker.inventoryNbt.getCompoundTagAt(i));
|
||||
ItemStack machineItemStack = machine.getInventoryByName("config").getStackInSlot(i);
|
||||
if (isDifferent(knowmItemStack, machineItemStack)) {
|
||||
if (update == null) update = new SPacketLevelTerminalUpdate();
|
||||
knownTracker.updateNBT();
|
||||
update.addOverwriteEntry(knownTracker.id)
|
||||
.setItems(knownTracker.requests.getSizeInventory(), knownTracker.inventoryNbt);
|
||||
if (prev[i] == null) {
|
||||
knownTracker.infoList[i] = curr[i];
|
||||
if (update == null) update = new SPacketLevelTerminalUpdate();
|
||||
update.addOverwriteSlotEntry(knownTracker.id, i, curr[i]);
|
||||
} else if (curr[i] == null) {
|
||||
knownTracker.infoList[i] = null;
|
||||
if (update == null) update = new SPacketLevelTerminalUpdate();
|
||||
update.addOverwriteSlotEntry(knownTracker.id, i, null);
|
||||
} else if (!Platform.isStacksIdentical(prev[i].stack, curr[i].stack)
|
||||
|| prev[i].quantity != curr[i].quantity
|
||||
|| prev[i].batchSize != curr[i].batchSize
|
||||
|| prev[i].state != curr[i].state) {
|
||||
knownTracker.infoList[i] = curr[i];
|
||||
if (update == null) update = new SPacketLevelTerminalUpdate();
|
||||
update.addOverwriteSlotEntry(knownTracker.id, i, curr[i]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
knownTracker.infoList = curr;
|
||||
if (update == null) update = new SPacketLevelTerminalUpdate();
|
||||
update.addOverwriteAllSlotEntry(knownTracker.id, curr);
|
||||
}
|
||||
} else {
|
||||
/* Add a new entry */
|
||||
if (update == null) update = new SPacketLevelTerminalUpdate();
|
||||
ContainerLevelTerminal.InvTracker entry = new ContainerLevelTerminal.InvTracker(
|
||||
nextId++,
|
||||
machine,
|
||||
gridNode.isActive());
|
||||
update.addNewEntry(entry.id, entry.name, entry.online)
|
||||
.setLocation(entry.x, entry.y, entry.z, entry.dim, entry.side.ordinal())
|
||||
.setItems(entry.rows, entry.rowSize, entry.inventoryNbt)
|
||||
.setViewItemStack(machine.getSelfItemStack(), machine.getDisplayItemStack());
|
||||
ContainerLevelTerminal.InvTracker entry = new ContainerLevelTerminal.InvTracker(nextId++, machine);
|
||||
|
||||
update.addNewEntry(
|
||||
entry.id,
|
||||
entry.x,
|
||||
entry.y,
|
||||
entry.z,
|
||||
entry.dim,
|
||||
entry.side.ordinal(),
|
||||
entry.rows,
|
||||
entry.rowSize,
|
||||
entry.name,
|
||||
entry.infoList);
|
||||
tracked.put(gridHost, entry);
|
||||
trackedById.put(entry.id, entry);
|
||||
}
|
||||
visited.add(gridHost);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -327,10 +199,9 @@ public class ContainerLevelTerminal extends FCBaseContainer {
|
||||
}
|
||||
|
||||
if (update == null) update = new SPacketLevelTerminalUpdate();
|
||||
|
||||
update.addRemoveEntry(entry.getValue().id);
|
||||
trackedById.remove(entry.getValue().id);
|
||||
it.remove();
|
||||
update.addRemovalEntry(entry.getValue().id);
|
||||
}
|
||||
return update;
|
||||
}
|
||||
@@ -340,23 +211,10 @@ public class ContainerLevelTerminal extends FCBaseContainer {
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isDifferent(final ItemStack a, final ItemStack b) {
|
||||
if (a == null && b == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (a == null || b == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return !ItemStack.areItemStacksEqual(a, b);
|
||||
}
|
||||
|
||||
private static class InvTracker {
|
||||
|
||||
private final long id;
|
||||
private String name;
|
||||
private final IInventory requests;
|
||||
private final int rowSize;
|
||||
private final int rows;
|
||||
private final int x;
|
||||
@@ -364,16 +222,15 @@ public class ContainerLevelTerminal extends FCBaseContainer {
|
||||
private final int z;
|
||||
private final int dim;
|
||||
private final ForgeDirection side;
|
||||
private boolean online;
|
||||
private NBTTagList inventoryNbt;
|
||||
|
||||
public InvTracker(long id, ILevelViewable machine, boolean online) {
|
||||
private LevelItemInfo[] infoList;
|
||||
|
||||
public InvTracker(long id, ILevelViewable machine) {
|
||||
|
||||
DimensionalCoord location = machine.getLocation();
|
||||
|
||||
this.id = id;
|
||||
this.name = machine.getCustomName();
|
||||
this.requests = machine.getInventoryByName("config");
|
||||
this.rowSize = machine.rowSize();
|
||||
this.rows = machine.rows();
|
||||
this.x = location.x;
|
||||
@@ -381,26 +238,18 @@ public class ContainerLevelTerminal extends FCBaseContainer {
|
||||
this.z = location.z;
|
||||
this.dim = location.getDimension();
|
||||
this.side = machine.getSide();
|
||||
this.online = online;
|
||||
this.inventoryNbt = new NBTTagList();
|
||||
updateNBT();
|
||||
}
|
||||
|
||||
private void updateNBT() {
|
||||
this.inventoryNbt = new NBTTagList();
|
||||
for (int i = 0; i < this.rows; ++i) {
|
||||
for (int j = 0; j < this.rowSize; ++j) {
|
||||
final int offset = this.rowSize * i;
|
||||
ItemStack stack = this.requests.getStackInSlot(offset + j);
|
||||
|
||||
if (stack != null) {
|
||||
this.inventoryNbt.appendTag(stack.writeToNBT(new NBTTagCompound()));
|
||||
} else {
|
||||
this.inventoryNbt.appendTag(new NBTTagCompound());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.infoList = machine.getLevelItemInfoList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrimaryGui createPrimaryGui() {
|
||||
ContainerOpenContext context = getOpenContext();
|
||||
return new FluidPrimaryGui(
|
||||
GuiType.LEVEL_TERMINAL,
|
||||
ItemAndBlockHolder.LEVEL_TERMINAL.stack(),
|
||||
context.getTile(),
|
||||
context.getSide());
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,13 @@ package com.glodblock.github.client.gui.container;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.FluidPrimaryGui;
|
||||
|
||||
import appeng.container.ContainerOpenContext;
|
||||
import appeng.container.PrimaryGui;
|
||||
|
||||
public class ContainerLevelWireless extends ContainerLevelTerminal {
|
||||
|
||||
@@ -14,4 +20,16 @@ public class ContainerLevelWireless extends ContainerLevelTerminal {
|
||||
protected boolean isWirelessTerminal() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrimaryGui createPrimaryGui() {
|
||||
ContainerOpenContext context = getOpenContext();
|
||||
PrimaryGui primaryGui = new FluidPrimaryGui(
|
||||
GuiType.WIRELESS_LEVEL_TERMINAL,
|
||||
ItemAndBlockHolder.WIRELESS_LEVEL_TERM.stack(),
|
||||
context.getTile(),
|
||||
context.getSide());
|
||||
primaryGui.setSlotIndex(getTargetSlotIndex());
|
||||
return primaryGui;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.glodblock.github.inventory.item.IWirelessMagnetFilter;
|
||||
import com.glodblock.github.inventory.item.WirelessMagnet;
|
||||
import com.glodblock.github.inventory.item.WirelessMagnetCardFilterInventory;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.container.ContainerSubGui;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.container.slot.IOptionalSlotHost;
|
||||
import appeng.container.slot.OptionalSlotFake;
|
||||
import appeng.container.slot.SlotFake;
|
||||
import appeng.container.slot.SlotPatternOutputs;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ContainerMagnetFilter extends ContainerSubGui implements IOptionalSlotHost {
|
||||
|
||||
@GuiSync(101)
|
||||
public WirelessMagnet.ListMode listMode;
|
||||
|
||||
@GuiSync(102)
|
||||
public boolean nbt;
|
||||
|
||||
@GuiSync(103)
|
||||
public boolean meta;
|
||||
|
||||
@GuiSync(104)
|
||||
public boolean ore;
|
||||
|
||||
@GuiSync(105)
|
||||
public boolean oreDict;
|
||||
|
||||
@GuiSync(106)
|
||||
public String oreDictFilter;
|
||||
|
||||
protected OptionalSlotFake[] filterSlots;
|
||||
protected final IInventory filter;
|
||||
private final IWirelessMagnetFilter object;
|
||||
|
||||
public ContainerMagnetFilter(InventoryPlayer ip, ITerminalHost monitorable) {
|
||||
super(ip, monitorable);
|
||||
this.object = (WirelessMagnetCardFilterInventory) monitorable;
|
||||
this.filter = object.getInventoryByName("config");
|
||||
this.filterSlots = new OptionalSlotFake[27];
|
||||
oreDictFilter = object.getOreDictFilter();
|
||||
for (int y = 0; y < 3; y++) {
|
||||
for (int x = 0; x < 9; x++) {
|
||||
this.addSlotToContainer(
|
||||
this.filterSlots[x + y * 9] = new SlotPatternOutputs(
|
||||
this.filter,
|
||||
this,
|
||||
x + y * 9,
|
||||
8 + x * 18,
|
||||
58 + y * 18,
|
||||
0,
|
||||
0,
|
||||
1));
|
||||
this.filterSlots[x + y * 9].setRenderDisabled(false);
|
||||
}
|
||||
}
|
||||
this.lockPlayerInventorySlot(this.object.getInventorySlot());
|
||||
bindPlayerInventory(ip, 0, 126);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p, int idx) {
|
||||
AppEngSlot clickSlot = (AppEngSlot) this.inventorySlots.get(idx);
|
||||
if (clickSlot == null || !clickSlot.getHasStack()) return null;
|
||||
ItemStack tis = clickSlot.getStack();
|
||||
for (SlotFake slot : this.filterSlots) {
|
||||
if (!slot.getHasStack()) {
|
||||
slot.putStack(tis);
|
||||
detectAndSendChanges();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return super.transferStackInSlot(p, idx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
if (Platform.isServer()) {
|
||||
this.listMode = this.object.getListMode();
|
||||
this.meta = this.object.getMetaMode();
|
||||
this.nbt = this.object.getNBTMode();
|
||||
this.ore = this.object.getOreMode();
|
||||
this.oreDict = this.object.getOreDictMode();
|
||||
this.oreDictFilter = this.object.getOreDictFilter();
|
||||
}
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlotEnabled(int idx) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.IActionHost;
|
||||
import appeng.api.networking.security.PlayerSource;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.container.AEBaseContainer;
|
||||
|
||||
public class ContainerPatternMulti extends AEBaseContainer {
|
||||
|
||||
public ContainerPatternMulti(final InventoryPlayer ip, final ITerminalHost te) {
|
||||
super(ip, te);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
this.verifyPermissions(SecurityPermissions.CRAFT, false);
|
||||
}
|
||||
|
||||
public IGrid getGrid() {
|
||||
final IActionHost h = ((IActionHost) this.getTarget());
|
||||
return h.getActionableNode().getGrid();
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
return this.getPlayerInv().player.worldObj;
|
||||
}
|
||||
|
||||
public BaseActionSource getActionSrc() {
|
||||
return new PlayerSource(this.getPlayerInv().player, (IActionHost) this.getTarget());
|
||||
}
|
||||
}
|
||||
-43
@@ -1,43 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.slot.SlotInaccessible;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
|
||||
public class ContainerPatternValueAmount extends AEBaseContainer {
|
||||
|
||||
private final Slot patternValue;
|
||||
|
||||
@GuiSync(11)
|
||||
public int valueIndex;
|
||||
|
||||
public ContainerPatternValueAmount(final InventoryPlayer ip, final ITerminalHost te) {
|
||||
super(ip, te);
|
||||
this.patternValue = new SlotInaccessible(new AppEngInternalInventory(null, 1), 0, 34, 53);
|
||||
this.addSlotToContainer(patternValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
this.verifyPermissions(SecurityPermissions.CRAFT, false);
|
||||
}
|
||||
|
||||
public Slot getPatternValue() {
|
||||
return patternValue;
|
||||
}
|
||||
|
||||
public int getValueIndex() {
|
||||
return valueIndex;
|
||||
}
|
||||
|
||||
public void setValueIndex(int valueIndex) {
|
||||
this.valueIndex = valueIndex;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.container.AEBaseContainer;
|
||||
|
||||
public class ContainerRenamer extends AEBaseContainer {
|
||||
|
||||
public ContainerRenamer(InventoryPlayer ip, ITerminalHost monitorable) {
|
||||
super(ip, monitorable);
|
||||
}
|
||||
}
|
||||
+190
@@ -0,0 +1,190 @@
|
||||
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 net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.GuiFCImgButton;
|
||||
import com.glodblock.github.common.tile.TileSuperStockReplenisher;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.network.SPacketSuperStockReplenisherUpdate;
|
||||
import com.glodblock.github.util.FluidPrimaryGui;
|
||||
|
||||
import appeng.api.implementations.items.IStorageCell;
|
||||
import appeng.api.storage.StorageName;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerOpenContext;
|
||||
import appeng.container.PrimaryGui;
|
||||
import appeng.container.interfaces.IVirtualSlotSource;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.container.sync.SyncManager;
|
||||
import appeng.container.sync.handlers.AEStackInventorySyncHandler;
|
||||
import appeng.container.sync.handlers.BooleanSyncHandler;
|
||||
import appeng.tile.inventory.IAEStackInventory;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ContainerSuperStockReplenisher extends AEBaseContainer implements IVirtualSlotSource {
|
||||
|
||||
private final TileSuperStockReplenisher tile;
|
||||
|
||||
private int lastUpdated = 1337;
|
||||
|
||||
private final IAEStackInventory configFluids;
|
||||
public final AEStackInventorySyncHandler configFluidsSlots;
|
||||
|
||||
private final IAEStackInventory configItems;
|
||||
public final AEStackInventorySyncHandler configItemsSlots;
|
||||
|
||||
public final BooleanSyncHandler fullStockModeSync;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private GuiFCImgButton modeButton;
|
||||
|
||||
public ContainerSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockReplenisher tile) {
|
||||
super(ipl, tile);
|
||||
this.tile = tile;
|
||||
this.configFluids = tile.getConfigFluids();
|
||||
this.configItems = tile.getConfigItems();
|
||||
final IInventory cell = tile.getCell();
|
||||
|
||||
final SyncManager sm = this.getSyncManager();
|
||||
this.configFluidsSlots = sm.root().aeStackInventory("fluidConfig", this.configFluids);
|
||||
this.configItemsSlots = sm.root().aeStackInventory("itemConfig", this.configItems);
|
||||
this.fullStockModeSync = sm.root().booleanSync("fullstockMode").onClientChange((oldValue, newValue) -> {
|
||||
if (this.modeButton != null) {
|
||||
this.modeButton.set(newValue ? "fullstockMode" : "normalMode");
|
||||
}
|
||||
}).onServerChange((oldValue, newValue) -> this.tile.setFullStockMode(newValue));
|
||||
|
||||
this.addSlotToContainer(
|
||||
new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.WORKBENCH_CELL,
|
||||
cell,
|
||||
0,
|
||||
173,
|
||||
8,
|
||||
this.getInventoryPlayer()));
|
||||
|
||||
bindPlayerInventory(ipl, 0, 251 - 82);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setModeButton(GuiFCImgButton button) {
|
||||
this.modeButton = button;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int slotId, int clickedButton, int mode, EntityPlayer player) {
|
||||
if (slotId == 0 && player.inventory.getItemStack() == null && isConfigurated()) return null;
|
||||
return super.slotClick(slotId, clickedButton, mode, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
if (Platform.isClient()) return;
|
||||
|
||||
if (this.lastUpdated > 20) {
|
||||
this.lastUpdated = 0;
|
||||
Map<Integer, IAEStack<?>> tmp = new HashMap<>();
|
||||
|
||||
for (int i = 0; i < this.tile.getInternalFluid().getSlots(); i++) {
|
||||
tmp.put(i, this.tile.getInternalFluid().getFluidInSlot(i));
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.tile.getInternalInventory().getSizeInventory(); i++) {
|
||||
tmp.put(i + 100, AEItemStack.create(this.tile.getInternalInventory().getStackInSlot(i)));
|
||||
}
|
||||
|
||||
for (final Object g : this.crafters) {
|
||||
if (g instanceof EntityPlayer) {
|
||||
FluidCraft.proxy.netHandler.sendTo(new SPacketSuperStockReplenisherUpdate(tmp), (EntityPlayerMP) g);
|
||||
}
|
||||
}
|
||||
|
||||
if (Platform.isServer()) this.setFullStockMode(this.tile.isFullStockMode());
|
||||
|
||||
}
|
||||
|
||||
this.lastUpdated++;
|
||||
}
|
||||
|
||||
private boolean isConfigurated() {
|
||||
for (int i = 0; i < this.configItems.getSizeInventory(); i++)
|
||||
if (this.configItems.getAEStackInSlot(i) != null) return true;
|
||||
|
||||
for (int i = 0; i < this.configFluids.getSizeInventory(); i++)
|
||||
if (this.configFluids.getAEStackInSlot(i) != null) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidForSlot(Slot s, ItemStack is) {
|
||||
if (s.slotNumber == 0 && s.getHasStack() && isConfigurated()) {
|
||||
long currentBytes = 0;
|
||||
long newBytes = -1;
|
||||
|
||||
if (s.getStack().getItem() instanceof IStorageCell isc) currentBytes = isc.getBytesLong(is);
|
||||
|
||||
if (is.getItem() instanceof IStorageCell isc) newBytes = isc.getBytesLong(is);
|
||||
|
||||
if (currentBytes > newBytes) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return super.isValidForSlot(s, is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrimaryGui createPrimaryGui() {
|
||||
ContainerOpenContext context = getOpenContext();
|
||||
return new FluidPrimaryGui(
|
||||
GuiType.GUI_SUPER_STOCK_REPLENISHER,
|
||||
ItemAndBlockHolder.SUPER_STOCK_RERPLENISHER.stack(),
|
||||
context.getTile(),
|
||||
context.getSide());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateVirtualSlot(StorageName invName, int slotId, IAEStack<?> aes) {
|
||||
if (aes != null && aes.getStackSize() > Integer.MAX_VALUE) aes.setStackSize(Integer.MAX_VALUE);
|
||||
switch (invName) {
|
||||
case NONE -> {
|
||||
this.configFluids.putAEStackInSlot(slotId, aes);
|
||||
this.configFluidsSlots.markDirty();
|
||||
}
|
||||
case CONFIG -> {
|
||||
this.configItems.putAEStackInSlot(slotId, aes);
|
||||
this.configItemsSlots.markDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public TileSuperStockReplenisher getTile() {
|
||||
return this.tile;
|
||||
}
|
||||
|
||||
public boolean isFullStockMode() {
|
||||
return this.fullStockModeSync.get();
|
||||
}
|
||||
|
||||
public void setFullStockMode(final boolean fullStockMode) {
|
||||
this.fullStockModeSync.set(fullStockMode);
|
||||
}
|
||||
|
||||
public void markDirty() {
|
||||
this.fullStockModeSync.markDirty();
|
||||
}
|
||||
}
|
||||
@@ -3,33 +3,42 @@ package com.glodblock.github.client.gui.container.base;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.inventory.item.IFluidPortableCell;
|
||||
import com.glodblock.github.inventory.item.WirelessMagnet;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public abstract class FCBaseContainer extends AEBaseContainer {
|
||||
|
||||
private int ticks;
|
||||
private final double powerMultiplier = 0.5;
|
||||
private IFluidPortableCell host;
|
||||
private ITerminalHost host;
|
||||
private int slot = -1;
|
||||
private final InventoryPlayer ip;
|
||||
|
||||
@GuiSync(105)
|
||||
public boolean restock = false;
|
||||
|
||||
@GuiSync(106)
|
||||
public WirelessMagnet.Mode mode = WirelessMagnet.Mode.Off;
|
||||
|
||||
public FCBaseContainer(InventoryPlayer ip, ITerminalHost monitorable) {
|
||||
super(ip, monitorable);
|
||||
this.ip = ip;
|
||||
this.host = monitorable;
|
||||
if (isWirelessTerminal()) {
|
||||
host = (IFluidPortableCell) monitorable;
|
||||
this.slot = lockSlot();
|
||||
}
|
||||
}
|
||||
|
||||
private int lockSlot() {
|
||||
if (isWirelessTerminal()) {
|
||||
if (this.host != null) {
|
||||
final int slotIndex = this.host.getInventorySlot();
|
||||
if (Util.GuiHelper.decodeInvType(slotIndex).getLeft() == Util.GuiHelper.InvType.PLAYER_INV) {
|
||||
if (this.host instanceof IFluidPortableCell) {
|
||||
final int slotIndex = ((IFluidPortableCell) this.host).getInventorySlot();
|
||||
if (slotIndex <= Platform.baublesSlotsOffset) {
|
||||
this.lockPlayerInventorySlot(slotIndex);
|
||||
}
|
||||
return slotIndex;
|
||||
@@ -50,7 +59,7 @@ public abstract class FCBaseContainer extends AEBaseContainer {
|
||||
this.slot,
|
||||
this.ticks,
|
||||
this.getPowerMultiplier(),
|
||||
this.host);
|
||||
((IFluidPortableCell) this.host));
|
||||
}
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
@@ -59,4 +68,14 @@ public abstract class FCBaseContainer extends AEBaseContainer {
|
||||
return this.powerMultiplier;
|
||||
}
|
||||
|
||||
public ITerminalHost getHost() {
|
||||
return this.host;
|
||||
}
|
||||
|
||||
public IFluidPortableCell getPortableCell() {
|
||||
if (this.host instanceof IFluidPortableCell fpc) {
|
||||
return fpc;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
-641
@@ -1,641 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container.base;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.glodblock.github.client.gui.container.ContainerItemMonitor;
|
||||
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.inventory.IPatternConsumer;
|
||||
import com.glodblock.github.inventory.item.IItemPatternTerminal;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.FluidPatternDetails;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.definitions.IDefinitions;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.slot.IOptionalSlotHost;
|
||||
import appeng.container.slot.OptionalSlotFake;
|
||||
import appeng.container.slot.SlotFake;
|
||||
import appeng.container.slot.SlotFakeCraftingMatrix;
|
||||
import appeng.container.slot.SlotPatternTerm;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.helpers.IContainerCraftingPacket;
|
||||
import appeng.helpers.InventoryAction;
|
||||
import appeng.items.misc.ItemEncodedPattern;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.tile.inventory.IAEAppEngInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
|
||||
public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
|
||||
implements IAEAppEngInventory, IOptionalSlotHost, IContainerCraftingPacket, IPatternConsumer {
|
||||
|
||||
public static final int MULTIPLE_OF_BUTTON_CLICK = 2;
|
||||
public static final int MULTIPLE_OF_BUTTON_CLICK_ON_SHIFT = 8;
|
||||
protected final IItemPatternTerminal patternTerminal;
|
||||
protected final AppEngInternalInventory cOut = new AppEngInternalInventory(null, 1);
|
||||
protected final IInventory crafting;
|
||||
protected final SlotRestrictedInput patternSlotIN;
|
||||
protected final SlotRestrictedInput patternSlotOUT;
|
||||
protected SlotFake[] craftingSlots;
|
||||
protected OptionalSlotFake[] outputSlots;
|
||||
protected SlotPatternTerm craftSlot;
|
||||
|
||||
@GuiSync(97)
|
||||
public boolean craftingMode = true;
|
||||
|
||||
@GuiSync(96)
|
||||
public boolean substitute = false;
|
||||
|
||||
@GuiSync(95)
|
||||
public boolean combine = false;
|
||||
|
||||
@GuiSync(94)
|
||||
public boolean beSubstitute = false;
|
||||
|
||||
@GuiSync(93)
|
||||
public boolean inverted;
|
||||
|
||||
@GuiSync(92)
|
||||
public int activePage = 0;
|
||||
|
||||
@GuiSync(91)
|
||||
public boolean prioritize = false;
|
||||
|
||||
@GuiSync(90)
|
||||
public boolean autoFillPattern = false;
|
||||
|
||||
public FCContainerEncodeTerminal(final InventoryPlayer ip, final ITerminalHost monitorable) {
|
||||
super(ip, monitorable);
|
||||
this.patternTerminal = (IItemPatternTerminal) monitorable;
|
||||
this.inverted = patternTerminal.isInverted();
|
||||
final IInventory patternInv = this.patternTerminal.getInventoryByName("pattern");
|
||||
this.crafting = this.patternTerminal.getInventoryByName("crafting");
|
||||
this.addSlotToContainer(
|
||||
this.patternSlotIN = new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.BLANK_PATTERN,
|
||||
patternInv,
|
||||
0,
|
||||
147,
|
||||
-72 - 9,
|
||||
this.getInventoryPlayer()));
|
||||
this.addSlotToContainer(
|
||||
this.patternSlotOUT = new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN,
|
||||
patternInv,
|
||||
1,
|
||||
147,
|
||||
-72 + 34,
|
||||
this.getInventoryPlayer()));
|
||||
this.patternSlotOUT.setStackLimit(1);
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
if (action == InventoryAction.MOVE_REGION) {
|
||||
super.doAction(player, InventoryAction.MOVE_REGION, slotId, id);
|
||||
return;
|
||||
}
|
||||
if (action == InventoryAction.PICKUP_SINGLE) {
|
||||
super.doAction(player, InventoryAction.PICKUP_OR_SET_DOWN, slotId, id);
|
||||
return;
|
||||
}
|
||||
Slot slot = getSlot(slotId);
|
||||
ItemStack stack = player.inventory.getItemStack();
|
||||
FluidStack fluid = Util.getFluidFromItem(stack);
|
||||
|
||||
if (fluid == null || fluid.amount <= 0) {
|
||||
super.doAction(player, action, slotId, id);
|
||||
return;
|
||||
}
|
||||
|
||||
if (validPatternSlot(slot)) {
|
||||
|
||||
switch (action) {
|
||||
case PICKUP_OR_SET_DOWN -> {
|
||||
slot.putStack(ItemFluidPacket.newStack(fluid));
|
||||
return;
|
||||
}
|
||||
case SPLIT_OR_PLACE_SINGLE -> {
|
||||
fluid = Util.getFluidFromItem(Util.copyStackWithSize(stack, 1));
|
||||
FluidStack origin = ItemFluidPacket.getFluidStack(slot.getStack());
|
||||
if (fluid != null && fluid.equals(origin)) {
|
||||
fluid.amount += origin.amount;
|
||||
if (fluid.amount <= 0) fluid = null;
|
||||
}
|
||||
slot.putStack(ItemFluidPacket.newStack(fluid));
|
||||
return;
|
||||
}
|
||||
default -> {}
|
||||
}
|
||||
|
||||
}
|
||||
super.doAction(player, action, slotId, id);
|
||||
}
|
||||
|
||||
protected abstract boolean validPatternSlot(Slot slot);
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p, int idx) {
|
||||
Slot clickSlot = (Slot) this.inventorySlots.get(idx);
|
||||
ItemStack is = clickSlot.getStack();
|
||||
if (is != null && !patternSlotOUT.getHasStack()
|
||||
&& is.stackSize == 1
|
||||
&& (is.getItem() instanceof ItemFluidEncodedPattern || is.getItem() instanceof ItemEncodedPattern)) {
|
||||
ItemStack output = is.copy();
|
||||
patternSlotOUT.putStack(output);
|
||||
p.inventory.setInventorySlotContents(clickSlot.getSlotIndex(), null);
|
||||
this.detectAndSendChanges();
|
||||
return null;
|
||||
} else {
|
||||
return super.transferStackInSlot(p, idx);
|
||||
}
|
||||
}
|
||||
|
||||
public IItemPatternTerminal getPatternTerminal() {
|
||||
return this.patternTerminal;
|
||||
}
|
||||
|
||||
protected static boolean canDoubleStacks(SlotFake[] slots) {
|
||||
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
long emptySlots = enabledSlots.stream().filter(s -> s.getStack() == null).count();
|
||||
long fullSlots = enabledSlots.stream().filter(s -> s.getStack() != null && s.getStack().stackSize * 2 > 127)
|
||||
.count();
|
||||
return fullSlots <= emptySlots;
|
||||
}
|
||||
|
||||
protected static void doubleStacksInternal(SlotFake[] slots) {
|
||||
List<ItemStack> overFlowStacks = new ArrayList<>();
|
||||
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
for (final Slot s : enabledSlots) {
|
||||
ItemStack st = s.getStack();
|
||||
if (st == null) continue;
|
||||
if (Util.isFluidPacket(st)) {
|
||||
FluidStack fluidStack = ItemFluidPacket.getFluidStack(st);
|
||||
if (fluidStack != null) {
|
||||
fluidStack = ItemFluidPacket.getFluidStack(st).copy();
|
||||
if (fluidStack.amount < Integer.MAX_VALUE / 2) fluidStack.amount *= 2;
|
||||
}
|
||||
s.putStack(ItemFluidPacket.newStack(fluidStack));
|
||||
} else if (st.stackSize * 2 > 127) {
|
||||
overFlowStacks.add(st.copy());
|
||||
} else {
|
||||
st.stackSize *= 2;
|
||||
s.putStack(st);
|
||||
}
|
||||
}
|
||||
Iterator<ItemStack> ow = overFlowStacks.iterator();
|
||||
for (final Slot s : enabledSlots) {
|
||||
if (!ow.hasNext()) break;
|
||||
if (s.getStack() != null) continue;
|
||||
s.putStack(ow.next());
|
||||
}
|
||||
assert !ow.hasNext();
|
||||
}
|
||||
|
||||
protected static boolean containsItem(SlotFake[] slots) {
|
||||
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
long item = enabledSlots.stream().filter(s -> s.getStack() != null && !Util.isFluidPacket(s.getStack()))
|
||||
.count();
|
||||
return item > 0;
|
||||
}
|
||||
|
||||
protected static boolean containsFluid(SlotFake[] slots) {
|
||||
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
long fluid = enabledSlots.stream().filter(s -> Util.isFluidPacket(s.getStack())).count();
|
||||
return fluid > 0;
|
||||
}
|
||||
|
||||
protected static boolean nonNullSlot(SlotFake[] slots) {
|
||||
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
long object = enabledSlots.stream().filter(s -> s.getStack() != null).count();
|
||||
return object > 0;
|
||||
}
|
||||
|
||||
protected boolean checkHasFluidPattern() {
|
||||
if (this.craftingMode) {
|
||||
return false;
|
||||
}
|
||||
boolean hasFluid = containsFluid(this.craftingSlots);
|
||||
boolean search = nonNullSlot(this.craftingSlots);
|
||||
if (!search) { // search=false -> inputs were empty
|
||||
return false;
|
||||
}
|
||||
hasFluid |= containsFluid(this.outputSlots);
|
||||
search = nonNullSlot(this.outputSlots);
|
||||
return hasFluid && search; // search=false -> outputs were empty
|
||||
}
|
||||
|
||||
protected ItemStack stampAuthor(ItemStack patternStack) {
|
||||
if (patternStack.stackTagCompound == null) {
|
||||
patternStack.stackTagCompound = new NBTTagCompound();
|
||||
}
|
||||
patternStack.stackTagCompound.setString("author", getPlayerInv().player.getCommandSenderName());
|
||||
return patternStack;
|
||||
}
|
||||
|
||||
protected void encodeFluidPattern() {
|
||||
ItemStack patternStack = new ItemStack(ItemAndBlockHolder.PATTERN);
|
||||
FluidPatternDetails pattern = new FluidPatternDetails(patternStack);
|
||||
pattern.setInputs(collectInventory(this.craftingSlots));
|
||||
pattern.setOutputs(collectInventory(this.outputSlots));
|
||||
pattern.setCanBeSubstitute(this.beSubstitute ? 1 : 0);
|
||||
patternSlotOUT.putStack(stampAuthor(pattern.writeToStack()));
|
||||
}
|
||||
|
||||
protected static IAEItemStack[] collectInventory(Slot[] slots) {
|
||||
IAEItemStack[] stacks = new IAEItemStack[slots.length];
|
||||
for (int i = 0; i < stacks.length; i++) {
|
||||
ItemStack stack = slots[i].getStack();
|
||||
if (stack != null) {
|
||||
if (stack.getItem() instanceof ItemFluidPacket) {
|
||||
IAEItemStack dropStack = ItemFluidDrop.newAeStack(ItemFluidPacket.getFluidStack(stack));
|
||||
if (dropStack != null) {
|
||||
stacks[i] = dropStack;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
IAEItemStack aeStack = AEItemStack.create(stack);
|
||||
stacks[i] = aeStack;
|
||||
}
|
||||
return stacks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveChanges() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
for (final Slot s : this.craftingSlots) {
|
||||
s.putStack(null);
|
||||
}
|
||||
for (final Slot s : this.outputSlots) {
|
||||
s.putStack(null);
|
||||
}
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final IInventory inv, final int slot, final InvOperation mc,
|
||||
final ItemStack removedStack, final ItemStack newStack) {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
public void encodeAndMoveToInventory() {
|
||||
encode();
|
||||
ItemStack output = this.patternSlotOUT.getStack();
|
||||
if (output != null) {
|
||||
if (!getPlayerInv().addItemStackToInventory(output)) {
|
||||
getPlayerInv().player.entityDropItem(output, 0);
|
||||
}
|
||||
this.patternSlotOUT.putStack(null);
|
||||
}
|
||||
fillPattern();
|
||||
}
|
||||
|
||||
public void encodeAllItemAndMoveToInventory() {
|
||||
encode();
|
||||
ItemStack output = this.patternSlotOUT.getStack();
|
||||
if (output != null) {
|
||||
if (this.patternSlotIN.getStack() != null) output.stackSize += this.patternSlotIN.getStack().stackSize;
|
||||
if (!getPlayerInv().addItemStackToInventory(output)) {
|
||||
getPlayerInv().player.entityDropItem(output, 0);
|
||||
}
|
||||
this.patternSlotOUT.putStack(null);
|
||||
this.patternSlotIN.putStack(null);
|
||||
}
|
||||
fillPattern();
|
||||
}
|
||||
|
||||
private void fillPattern() {
|
||||
if (this.autoFillPattern && this.getHost().getItemInventory() != null) {
|
||||
// try to use me network item to fill pattern input slot
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
int fillStackSize = this.patternSlotIN.getHasStack() ? 64 - this.patternSlotIN.getStack().stackSize : 64;
|
||||
if (fillStackSize == 0) return;
|
||||
for (ItemStack blankPattern : definitions.materials().blankPattern().maybeStack(fillStackSize).asSet()) {
|
||||
IAEItemStack iBlankPattern = AEApi.instance().storage().createItemStack(blankPattern);
|
||||
if (this.patternSlotIN.getHasStack() && !iBlankPattern.isSameType(this.patternSlotIN.getStack()))
|
||||
continue;
|
||||
IAEItemStack out = this.getHost().getItemInventory()
|
||||
.extractItems(iBlankPattern, Actionable.MODULATE, this.getActionSource());
|
||||
if (out != null) {
|
||||
ItemStack outPattern;
|
||||
if (this.patternSlotIN.getHasStack()) {
|
||||
outPattern = this.patternSlotIN.getStack().copy();
|
||||
outPattern.stackSize += out.getItemStack().stackSize;
|
||||
} else {
|
||||
outPattern = out.getItemStack();
|
||||
}
|
||||
this.patternSlotIN.putStack(outPattern);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void encode() {
|
||||
fillPattern();
|
||||
if (!checkHasFluidPattern()) {
|
||||
encodeItemPattern();
|
||||
return;
|
||||
}
|
||||
ItemStack stack = this.patternSlotOUT.getStack();
|
||||
if (stack == null) {
|
||||
stack = this.patternSlotIN.getStack();
|
||||
if (notPattern(stack)) {
|
||||
return;
|
||||
}
|
||||
if (stack.stackSize == 1) {
|
||||
this.patternSlotIN.putStack(null);
|
||||
} else {
|
||||
stack.stackSize--;
|
||||
}
|
||||
encodeFluidPattern();
|
||||
} else if (!notPattern(stack)) {
|
||||
encodeFluidPattern();
|
||||
}
|
||||
}
|
||||
|
||||
public void encodeItemPattern() {
|
||||
ItemStack output = this.patternSlotOUT.getStack();
|
||||
final ItemStack[] in = this.getInputs();
|
||||
final ItemStack[] out = this.getOutputs();
|
||||
|
||||
// if there is no input, this would be silly.
|
||||
if (in == null || out == null) {
|
||||
return;
|
||||
}
|
||||
// first check the output slots, should either be null, or a pattern
|
||||
if (output != null && this.notPattern(output)) {
|
||||
return;
|
||||
} // if nothing is there we should snag a new pattern.
|
||||
else if (output == null) {
|
||||
output = this.patternSlotIN.getStack();
|
||||
if (this.notPattern(output)) {
|
||||
return; // no blanks.
|
||||
}
|
||||
|
||||
// remove one, and clear the input slot.
|
||||
output.stackSize--;
|
||||
if (output.stackSize == 0) {
|
||||
this.patternSlotIN.putStack(null);
|
||||
}
|
||||
|
||||
// add a new encoded pattern.
|
||||
for (final ItemStack encodedPatternStack : AEApi.instance().definitions().items().encodedPattern()
|
||||
.maybeStack(1).asSet()) {
|
||||
output = encodedPatternStack;
|
||||
}
|
||||
} else if (output.getItem() instanceof ItemFluidEncodedPattern) {
|
||||
for (final ItemStack encodedPatternStack : AEApi.instance().definitions().items().encodedPattern()
|
||||
.maybeStack(1).asSet()) {
|
||||
output = encodedPatternStack;
|
||||
}
|
||||
}
|
||||
|
||||
// encode the slot.
|
||||
final NBTTagCompound encodedValue = new NBTTagCompound();
|
||||
|
||||
final NBTTagList tagIn = new NBTTagList();
|
||||
final NBTTagList tagOut = new NBTTagList();
|
||||
|
||||
for (final ItemStack i : in) {
|
||||
tagIn.appendTag(this.createItemTag(i));
|
||||
}
|
||||
|
||||
for (final ItemStack i : out) {
|
||||
tagOut.appendTag(this.createItemTag(i));
|
||||
}
|
||||
|
||||
encodedValue.setTag("in", tagIn);
|
||||
encodedValue.setTag("out", tagOut);
|
||||
encodedValue.setBoolean("crafting", this.craftingMode);
|
||||
encodedValue.setBoolean("substitute", this.substitute);
|
||||
encodedValue.setBoolean("beSubstitute", this.beSubstitute);
|
||||
encodedValue.setBoolean("prioritize", this.prioritize);
|
||||
output.setTagCompound(encodedValue);
|
||||
stampAuthor(output);
|
||||
this.patternSlotOUT.putStack(output);
|
||||
}
|
||||
|
||||
protected ItemStack[] getInputs() {
|
||||
final ArrayList<ItemStack> input = new ArrayList<>();
|
||||
for (SlotFake craftingSlot : this.craftingSlots) {
|
||||
input.add(craftingSlot.getStack());
|
||||
}
|
||||
if (input.stream().anyMatch(Objects::nonNull)) {
|
||||
return input.toArray(new ItemStack[0]);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected ItemStack[] getOutputs() {
|
||||
final ArrayList<ItemStack> output = new ArrayList<>();
|
||||
for (final SlotFake outputSlot : this.outputSlots) {
|
||||
output.add(outputSlot.getStack());
|
||||
}
|
||||
if (output.stream().anyMatch(Objects::nonNull)) {
|
||||
return output.toArray(new ItemStack[0]);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected boolean notPattern(final ItemStack output) {
|
||||
if (output == null) {
|
||||
return true;
|
||||
}
|
||||
if (output.getItem() instanceof ItemFluidEncodedPattern) {
|
||||
return false;
|
||||
}
|
||||
final IDefinitions definitions = AEApi.instance().definitions();
|
||||
|
||||
boolean isPattern = definitions.items().encodedPattern().isSameAs(output);
|
||||
isPattern |= definitions.materials().blankPattern().isSameAs(output);
|
||||
|
||||
return !isPattern;
|
||||
}
|
||||
|
||||
protected NBTBase createItemTag(final ItemStack i) {
|
||||
final NBTTagCompound c = new NBTTagCompound();
|
||||
if (i != null) {
|
||||
Util.writeItemStackToNBT(i, c);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
if (Platform.isServer()) {
|
||||
this.substitute = this.patternTerminal.isSubstitution();
|
||||
this.combine = this.patternTerminal.shouldCombine();
|
||||
this.beSubstitute = this.patternTerminal.canBeSubstitute();
|
||||
this.prioritize = this.patternTerminal.isPrioritize();
|
||||
this.autoFillPattern = this.patternTerminal.isAutoFillPattern();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlotChange(final Slot s) {
|
||||
if (s == this.patternSlotOUT && Platform.isServer()) {
|
||||
for (final Object crafter : this.crafters) {
|
||||
final ICrafting icrafting = (ICrafting) crafter;
|
||||
|
||||
for (final Object g : this.inventorySlots) {
|
||||
if (g instanceof OptionalSlotFake || g instanceof SlotFakeCraftingMatrix) {
|
||||
final Slot sri = (Slot) g;
|
||||
icrafting.sendSlotContents(this, sri.slotNumber, sri.getStack());
|
||||
}
|
||||
}
|
||||
((EntityPlayerMP) icrafting).isChangingQuantityOnly = false;
|
||||
}
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName(final String name) {
|
||||
if (name.equals("player")) {
|
||||
return this.getInventoryPlayer();
|
||||
}
|
||||
return this.patternTerminal.getInventoryByName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean useRealItems() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void doubleStacks(int val) {
|
||||
multiplyOrDivideStacks(
|
||||
((val & 1) != 0 ? MULTIPLE_OF_BUTTON_CLICK_ON_SHIFT : MULTIPLE_OF_BUTTON_CLICK)
|
||||
* ((val & 2) != 0 ? -1 : 1));
|
||||
}
|
||||
|
||||
static boolean canMultiplyOrDivide(SlotFake[] slots, int mult) {
|
||||
if (mult > 0) {
|
||||
for (Slot s : slots) {
|
||||
ItemStack st = s.getStack();
|
||||
if (st == null) continue;
|
||||
final long count;
|
||||
if (st.getItem() instanceof ItemFluidPacket) {
|
||||
count = ItemFluidPacket.getFluidAmount(st);
|
||||
} else {
|
||||
count = s.getStack().stackSize;
|
||||
}
|
||||
long result = count * mult;
|
||||
if (result > Integer.MAX_VALUE) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else if (mult < 0) {
|
||||
mult = Math.abs(mult);
|
||||
for (Slot s : slots) {
|
||||
ItemStack st = s.getStack();
|
||||
if (st == null) continue;
|
||||
final int count;
|
||||
if (st.getItem() instanceof ItemFluidPacket) {
|
||||
count = ItemFluidPacket.getFluidAmount(st);
|
||||
} else {
|
||||
count = s.getStack().stackSize;
|
||||
}
|
||||
if (count % mult != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void multiplyOrDivideStacksInternal(SlotFake[] slots, int mult) {
|
||||
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
|
||||
if (mult > 0) {
|
||||
for (final Slot s : enabledSlots) {
|
||||
ItemStack st = s.getStack();
|
||||
if (st != null) {
|
||||
if (st.getItem() instanceof ItemFluidPacket) {
|
||||
ItemFluidPacket.setFluidAmount(st, ItemFluidPacket.getFluidAmount(st) * mult);
|
||||
} else {
|
||||
st.stackSize *= mult;
|
||||
s.putStack(st);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (mult < 0) {
|
||||
mult = Math.abs(mult);
|
||||
for (final Slot s : enabledSlots) {
|
||||
ItemStack st = s.getStack();
|
||||
if (st != null) {
|
||||
if (st.getItem() instanceof ItemFluidPacket) {
|
||||
ItemFluidPacket.setFluidAmount(st, ItemFluidPacket.getFluidAmount(st) / mult);
|
||||
} else {
|
||||
st.stackSize /= mult;
|
||||
s.putStack(st);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Multiply or divide a number
|
||||
*
|
||||
* @param multi Positive numbers are multiplied and negative numbers are divided
|
||||
*/
|
||||
public void multiplyOrDivideStacks(int multi) {
|
||||
if (!isCraftingMode()) {
|
||||
if (canMultiplyOrDivide(this.craftingSlots, multi) && canMultiplyOrDivide(this.outputSlots, multi)) {
|
||||
multiplyOrDivideStacksInternal(this.craftingSlots, multi);
|
||||
multiplyOrDivideStacksInternal(this.outputSlots, multi);
|
||||
}
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acceptPattern(IAEItemStack[] inputs, IAEItemStack[] outputs) {
|
||||
if (this.patternTerminal != null) {
|
||||
this.patternTerminal.onChangeCrafting(inputs, outputs);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isCraftingMode() {
|
||||
return this.craftingMode;
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -14,7 +14,6 @@ import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
|
||||
import com.glodblock.github.network.SPacketFluidUpdate;
|
||||
import com.glodblock.github.util.Ae2Reflect;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.config.Upgrades;
|
||||
@@ -64,7 +63,7 @@ public abstract class FCContainerFluidConfigurable extends ContainerUpgradeable
|
||||
protected void setupConfig() {
|
||||
this.setupUpgrades();
|
||||
|
||||
final IInventory inv = Ae2Reflect.getUpgradeList(this).getInventoryByName("config");
|
||||
final IInventory inv = getUpgradeable().getInventoryByName("config");
|
||||
final int y = 40;
|
||||
final int x = 80;
|
||||
this.addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(inv, null, this, 0, x, y, 0, 0, 0));
|
||||
@@ -84,7 +83,7 @@ public abstract class FCContainerFluidConfigurable extends ContainerUpgradeable
|
||||
protected boolean isValidForConfig(int slot, IAEFluidStack fs) {
|
||||
if (this.supportCapacity()) {
|
||||
// assumes 4 slots per upgrade
|
||||
final int upgrades = Ae2Reflect.getUpgradeList(this).getInstalledUpgrades(Upgrades.CAPACITY);
|
||||
final int upgrades = getUpgradeable().getInstalledUpgrades(Upgrades.CAPACITY);
|
||||
|
||||
if (slot > 0 && upgrades < 1) {
|
||||
return false;
|
||||
|
||||
@@ -1,237 +0,0 @@
|
||||
package com.glodblock.github.client.gui.container.base;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
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.item.ItemStack;
|
||||
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.network.SPacketMEUpdateBuffer;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SortDir;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.TypeFilter;
|
||||
import appeng.api.config.ViewItems;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigurableObject;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.helpers.WirelessTerminalGuiObject;
|
||||
import appeng.util.ConfigManager;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public abstract class FCContainerMonitor<T extends IAEStack<T>> extends FCBaseContainer
|
||||
implements IConfigManagerHost, IConfigurableObject, IMEMonitorHandlerReceiver<T> {
|
||||
|
||||
protected final SlotRestrictedInput[] cellView = new SlotRestrictedInput[5];
|
||||
protected final IConfigManager clientCM;
|
||||
protected final ITerminalHost host;
|
||||
|
||||
@GuiSync(99)
|
||||
public boolean canAccessViewCells = false;
|
||||
|
||||
@GuiSync(98)
|
||||
public boolean hasPower = false;
|
||||
|
||||
protected IConfigManagerHost gui;
|
||||
protected IConfigManager serverCM;
|
||||
protected IGridNode networkNode;
|
||||
protected IMEMonitor<T> monitor;
|
||||
|
||||
public FCContainerMonitor(final InventoryPlayer ip, final ITerminalHost monitorable) {
|
||||
this(ip, monitorable, true);
|
||||
}
|
||||
|
||||
protected FCContainerMonitor(final InventoryPlayer ip, final ITerminalHost monitorable,
|
||||
final boolean bindInventory) {
|
||||
super(ip, monitorable);
|
||||
this.host = monitorable;
|
||||
this.clientCM = new ConfigManager(this);
|
||||
this.clientCM.registerSetting(Settings.SORT_BY, SortOrder.NAME);
|
||||
this.clientCM.registerSetting(Settings.VIEW_MODE, ViewItems.ALL);
|
||||
this.clientCM.registerSetting(Settings.SORT_DIRECTION, SortDir.ASCENDING);
|
||||
this.clientCM.registerSetting(Settings.TYPE_FILTER, TypeFilter.ALL);
|
||||
}
|
||||
|
||||
public IMEMonitor<T> getMonitor() {
|
||||
return this.monitor;
|
||||
}
|
||||
|
||||
public IGridNode getNetworkNode() {
|
||||
return this.networkNode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
if (Platform.isServer()) {
|
||||
if (isInvalid()) {
|
||||
this.setValidContainer(false);
|
||||
}
|
||||
if (this.serverCM != null) {
|
||||
for (final Settings set : this.serverCM.getSettings()) {
|
||||
final Enum<?> sideLocal = this.serverCM.getSetting(set);
|
||||
final Enum<?> sideRemote = this.clientCM.getSetting(set);
|
||||
|
||||
if (sideLocal != sideRemote) {
|
||||
this.clientCM.putSetting(set, sideLocal);
|
||||
for (final Object crafter : this.crafters) {
|
||||
try {
|
||||
NetworkHandler.instance.sendTo(
|
||||
new PacketValueConfig(set.name(), sideLocal.name()),
|
||||
(EntityPlayerMP) crafter);
|
||||
} catch (final IOException e) {
|
||||
AELog.debug(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
processItemList();
|
||||
this.updatePowerStatus();
|
||||
final boolean oldAccessible = this.canAccessViewCells;
|
||||
this.canAccessViewCells = this.host instanceof WirelessTerminalGuiObject
|
||||
|| this.host instanceof IWirelessTerminal
|
||||
|| this.hasAccess(SecurityPermissions.BUILD, false);
|
||||
if (this.canAccessViewCells != oldAccessible) {
|
||||
for (int y = 0; y < 5; y++) {
|
||||
if (this.cellView[y] != null) {
|
||||
this.cellView[y].setAllowEdit(this.canAccessViewCells);
|
||||
}
|
||||
}
|
||||
}
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void processItemList();
|
||||
|
||||
protected boolean isInvalid() {
|
||||
return this.monitor == null;
|
||||
}
|
||||
|
||||
protected void updatePowerStatus() {
|
||||
try {
|
||||
if (this.networkNode != null) {
|
||||
this.setPowered(this.networkNode.isActive());
|
||||
} else if (this.getPowerSource() instanceof IEnergyGrid) {
|
||||
this.setPowered(((IEnergyGrid) this.getPowerSource()).isNetworkPowered());
|
||||
} else {
|
||||
this.setPowered(
|
||||
this.getPowerSource().extractAEPower(1, Actionable.SIMULATE, PowerMultiplier.CONFIG) > 0.8);
|
||||
}
|
||||
} catch (final Throwable ignore) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(final String field, final Object oldValue, final Object newValue) {
|
||||
if (field.equals("canAccessViewCells")) {
|
||||
for (int y = 0; y < 5; y++) {
|
||||
if (this.cellView[y] != null) {
|
||||
this.cellView[y].setAllowEdit(this.canAccessViewCells);
|
||||
}
|
||||
}
|
||||
}
|
||||
super.onUpdate(field, oldValue, newValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(final ICrafting c) {
|
||||
super.addCraftingToCrafters(c);
|
||||
this.queueInventory(c);
|
||||
}
|
||||
|
||||
protected abstract void queueInventory(final ICrafting c);
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(final EntityPlayer player) {
|
||||
super.onContainerClosed(player);
|
||||
if (this.monitor != null) {
|
||||
this.monitor.removeListener(this);
|
||||
if (player instanceof EntityPlayerMP && Platform.isServer()) {
|
||||
SPacketMEUpdateBuffer.clear((EntityPlayerMP) player);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConfigManager getConfigManager() {
|
||||
if (Platform.isServer()) {
|
||||
return this.serverCM;
|
||||
}
|
||||
return this.clientCM;
|
||||
}
|
||||
|
||||
public ItemStack[] getViewCells() {
|
||||
final ItemStack[] list = new ItemStack[this.cellView.length];
|
||||
for (int x = 0; x < this.cellView.length; x++) {
|
||||
list[x] = this.cellView[x].getStack();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public SlotRestrictedInput getCellViewSlot(final int index) {
|
||||
return this.cellView[index];
|
||||
}
|
||||
|
||||
public boolean isPowered() {
|
||||
return this.hasPower;
|
||||
}
|
||||
|
||||
protected void setPowered(final boolean isPowered) {
|
||||
this.hasPower = isPowered;
|
||||
}
|
||||
|
||||
protected IConfigManagerHost getGui() {
|
||||
return this.gui;
|
||||
}
|
||||
|
||||
public void setGui(@Nonnull final IConfigManagerHost gui) {
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(Object verificationToken) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onListUpdate() {
|
||||
for (final Object c : this.crafters) {
|
||||
if (c instanceof final ICrafting cr) {
|
||||
this.queueInventory(cr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSetting(final IConfigManager manager, @SuppressWarnings("rawtypes") final Enum settingName,
|
||||
@SuppressWarnings("rawtypes") final Enum newValue) {
|
||||
if (this.getGui() != null) {
|
||||
this.getGui().updateSetting(manager, settingName, newValue);
|
||||
}
|
||||
}
|
||||
|
||||
public ITerminalHost getHost() {
|
||||
return this.host;
|
||||
}
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
package com.glodblock.github.client.me;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.crossmod.thaumcraft.AspectUtil;
|
||||
import com.glodblock.github.util.FluidSorters;
|
||||
|
||||
import appeng.api.config.SearchBoxMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.ViewItems;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.widgets.IScrollSource;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.core.AEConfig;
|
||||
|
||||
public class EssentiaRepo extends FluidRepo {
|
||||
|
||||
public EssentiaRepo(final IScrollSource src, final ISortSource sortSrc) {
|
||||
super(src, sortSrc);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void updateView() {
|
||||
if (this.paused) {
|
||||
// Update existing view with new data
|
||||
for (int i = 0; i < this.view.size(); i++) {
|
||||
IAEItemStack entry = this.view.get(i);
|
||||
IAEItemStack serverEntry = this.list.findPrecise(entry);
|
||||
if (serverEntry == null) {
|
||||
entry.setStackSize(0);
|
||||
} else {
|
||||
this.view.set(i, serverEntry);
|
||||
}
|
||||
}
|
||||
|
||||
// Append newly added item stacks to the end of the view
|
||||
Set<IAEItemStack> viewSet = new HashSet<>(this.view);
|
||||
ArrayList<IAEItemStack> entriesToAdd = new ArrayList<>();
|
||||
for (IAEItemStack serverEntry : this.list) {
|
||||
if (!viewSet.contains(serverEntry)) {
|
||||
entriesToAdd.add(serverEntry);
|
||||
}
|
||||
}
|
||||
addEntriesToView(entriesToAdd);
|
||||
} else {
|
||||
this.view.clear();
|
||||
this.view.ensureCapacity(this.list.size());
|
||||
addEntriesToView(this.list);
|
||||
}
|
||||
|
||||
// Do not sort if paused
|
||||
if (!this.paused) {
|
||||
final Enum<?> SortBy = this.sortSrc.getSortBy();
|
||||
final Enum<?> SortDir = this.sortSrc.getSortDir();
|
||||
|
||||
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
|
||||
FluidSorters.init();
|
||||
|
||||
if (SortBy == SortOrder.MOD) {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_MOD);
|
||||
} else if (SortBy == SortOrder.AMOUNT) {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_SIZE);
|
||||
} else if (SortBy == SortOrder.INVTWEAKS) {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
|
||||
} else {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
// Update the display
|
||||
this.dsp.clear();
|
||||
this.dsp.ensureCapacity(this.list.size());
|
||||
for (final IAEItemStack is : this.view) {
|
||||
this.dsp.add(is.getItemStack());
|
||||
}
|
||||
}
|
||||
|
||||
private void addEntriesToView(Iterable<IAEItemStack> entries) {
|
||||
final Enum<?> viewMode = this.sortSrc.getSortDisplay();
|
||||
final Enum<?> searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
|
||||
if (searchMode == SearchBoxMode.NEI_AUTOSEARCH || searchMode == SearchBoxMode.NEI_MANUAL_SEARCH) {
|
||||
this.updateNEI(this.searchString);
|
||||
}
|
||||
|
||||
String innerSearch = this.searchString;
|
||||
|
||||
if (innerSearch.startsWith("@")) {
|
||||
innerSearch = innerSearch.substring(1);
|
||||
}
|
||||
|
||||
Pattern m;
|
||||
try {
|
||||
m = Pattern.compile(innerSearch.toLowerCase(), Pattern.CASE_INSENSITIVE);
|
||||
} catch (final Throwable ignore) {
|
||||
try {
|
||||
m = Pattern.compile(Pattern.quote(innerSearch.toLowerCase()), Pattern.CASE_INSENSITIVE);
|
||||
} catch (final Throwable __) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (IAEItemStack is : entries) {
|
||||
if (!AspectUtil.isEssentiaGas(ItemFluidDrop.getAeFluidStack(is))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this.myPartitionList != null) {
|
||||
if (!this.myPartitionList.isListed(is)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (viewMode == ViewItems.CRAFTABLE && !is.isCraftable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (viewMode == ViewItems.CRAFTABLE) {
|
||||
is = is.copy();
|
||||
is.setStackSize(0);
|
||||
}
|
||||
|
||||
if (viewMode == ViewItems.STORED && is.getStackSize() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Fluid fluid = ItemFluidDrop.getAeFluidStack(is).getFluid();
|
||||
if (!AspectUtil.isEssentiaGas(fluid)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m.matcher(fluid.getLocalizedName().toLowerCase()).find()) {
|
||||
this.view.add(is);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,296 +0,0 @@
|
||||
/*
|
||||
* This file is part of Applied Energistics 2. Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. Applied
|
||||
* Energistics 2 is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General
|
||||
* Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
|
||||
* later version. Applied Energistics 2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
||||
* Public License for more details. You should have received a copy of the GNU Lesser General Public License along with
|
||||
* Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||
*/
|
||||
|
||||
package com.glodblock.github.client.me;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import com.glodblock.github.api.FluidCraftAPI;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.util.FluidSorters;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.SearchBoxMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.ViewItems;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IDisplayRepo;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.client.gui.widgets.IScrollSource;
|
||||
import appeng.client.gui.widgets.ISortSource;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.items.storage.ItemViewCell;
|
||||
import appeng.util.prioitylist.IPartitionList;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
public class FluidRepo implements IDisplayRepo {
|
||||
|
||||
protected final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
||||
protected final ArrayList<IAEItemStack> view = new ArrayList<>();
|
||||
protected final ArrayList<ItemStack> dsp = new ArrayList<>();
|
||||
protected final IScrollSource src;
|
||||
protected final ISortSource sortSrc;
|
||||
|
||||
protected int rowSize = 9;
|
||||
|
||||
protected String searchString = "";
|
||||
protected IPartitionList<IAEItemStack> myPartitionList;
|
||||
protected boolean paused = false;
|
||||
private String NEIWord = null;
|
||||
private boolean hasPower;
|
||||
|
||||
public FluidRepo(final IScrollSource src, final ISortSource sortSrc) {
|
||||
this.src = src;
|
||||
this.sortSrc = sortSrc;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack getReferenceItem(int idx) {
|
||||
idx += this.src.getCurrentScroll() * this.rowSize;
|
||||
|
||||
if (idx >= this.view.size()) {
|
||||
return null;
|
||||
}
|
||||
return this.view.get(idx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItem(int idx) {
|
||||
idx += this.src.getCurrentScroll() * this.rowSize;
|
||||
|
||||
if (idx >= this.dsp.size()) {
|
||||
return null;
|
||||
}
|
||||
return this.dsp.get(idx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postUpdate(final IAEItemStack is) {
|
||||
final IAEItemStack st = this.list.findPrecise(is);
|
||||
if (st != null) {
|
||||
st.reset();
|
||||
st.add(is);
|
||||
} else {
|
||||
this.list.add(is);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setViewCell(final ItemStack[] list) {
|
||||
this.myPartitionList = ItemViewCell.createFilter(list);
|
||||
this.updateView();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void updateView() {
|
||||
if (this.paused) {
|
||||
// Update existing view with new data
|
||||
for (int i = 0; i < this.view.size(); i++) {
|
||||
IAEItemStack entry = this.view.get(i);
|
||||
IAEItemStack serverEntry = this.list.findPrecise(entry);
|
||||
if (serverEntry == null) {
|
||||
entry.setStackSize(0);
|
||||
} else {
|
||||
this.view.set(i, serverEntry);
|
||||
}
|
||||
}
|
||||
|
||||
// Append newly added item stacks to the end of the view
|
||||
Set<IAEItemStack> viewSet = new HashSet<>(this.view);
|
||||
ArrayList<IAEItemStack> entriesToAdd = new ArrayList<>();
|
||||
for (IAEItemStack serverEntry : this.list) {
|
||||
if (!viewSet.contains(serverEntry)) {
|
||||
entriesToAdd.add(serverEntry);
|
||||
}
|
||||
}
|
||||
addEntriesToView(entriesToAdd);
|
||||
} else {
|
||||
this.view.clear();
|
||||
this.view.ensureCapacity(this.list.size());
|
||||
addEntriesToView(this.list);
|
||||
}
|
||||
|
||||
// Do not sort if paused
|
||||
if (!paused) {
|
||||
final Enum<?> SortBy = this.sortSrc.getSortBy();
|
||||
final Enum<?> SortDir = this.sortSrc.getSortDir();
|
||||
|
||||
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
|
||||
FluidSorters.init();
|
||||
|
||||
if (SortBy == SortOrder.MOD) {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_MOD);
|
||||
} else if (SortBy == SortOrder.AMOUNT) {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_SIZE);
|
||||
} else if (SortBy == SortOrder.INVTWEAKS) {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
|
||||
} else {
|
||||
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
this.dsp.clear();
|
||||
this.dsp.ensureCapacity(this.list.size());
|
||||
for (final IAEItemStack is : this.view) {
|
||||
this.dsp.add(is.getItemStack());
|
||||
}
|
||||
}
|
||||
|
||||
private void addEntriesToView(Iterable<IAEItemStack> entries) {
|
||||
final Enum<?> viewMode = this.sortSrc.getSortDisplay();
|
||||
final Enum<?> searchMode = AEConfig.instance.settings.getSetting(Settings.SEARCH_MODE);
|
||||
if (searchMode == SearchBoxMode.NEI_AUTOSEARCH || searchMode == SearchBoxMode.NEI_MANUAL_SEARCH) {
|
||||
this.updateNEI(this.searchString);
|
||||
}
|
||||
|
||||
String innerSearch = this.searchString;
|
||||
|
||||
boolean searchMod = false;
|
||||
if (innerSearch.startsWith("@")) {
|
||||
searchMod = true;
|
||||
innerSearch = innerSearch.substring(1);
|
||||
}
|
||||
|
||||
Pattern m;
|
||||
try {
|
||||
m = Pattern.compile(innerSearch.toLowerCase(), Pattern.CASE_INSENSITIVE);
|
||||
} catch (final Throwable ignore) {
|
||||
try {
|
||||
m = Pattern.compile(Pattern.quote(innerSearch.toLowerCase()), Pattern.CASE_INSENSITIVE);
|
||||
} catch (final Throwable __) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (IAEItemStack is : entries) {
|
||||
if (this.myPartitionList != null) {
|
||||
if (!this.myPartitionList.isListed(is)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (viewMode == ViewItems.CRAFTABLE && !is.isCraftable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (viewMode == ViewItems.CRAFTABLE) {
|
||||
is = is.copy();
|
||||
is.setStackSize(0);
|
||||
}
|
||||
|
||||
if (viewMode == ViewItems.STORED && is.getStackSize() == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Fluid fluid = ItemFluidDrop.getAeFluidStack(is).getFluid();
|
||||
|
||||
if (FluidCraftAPI.instance().isBlacklistedInDisplay(fluid.getClass())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (searchMod) {
|
||||
if (m.matcher(Util.getFluidModID(fluid).toLowerCase()).find()
|
||||
|| m.matcher(Util.getFluidModName(fluid).toLowerCase()).find()) {
|
||||
this.view.add(is);
|
||||
}
|
||||
} else {
|
||||
if (m.matcher(fluid.getLocalizedName().toLowerCase()).find()) {
|
||||
this.view.add(is);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateNEI(final String filter) {
|
||||
try {
|
||||
if (this.NEIWord == null || !this.NEIWord.equals(filter)) {
|
||||
final Class<?> c = ReflectionHelper
|
||||
.getClass(this.getClass().getClassLoader(), "codechicken.nei.LayoutManager");
|
||||
final Field fldSearchField = c.getField("searchField");
|
||||
final Object searchField = fldSearchField.get(c);
|
||||
|
||||
final Method a = searchField.getClass().getMethod("setText", String.class);
|
||||
final Method b = searchField.getClass().getMethod("onTextChange", String.class);
|
||||
|
||||
this.NEIWord = filter;
|
||||
a.invoke(searchField, filter);
|
||||
b.invoke(searchField, "");
|
||||
}
|
||||
} catch (final Throwable ignore) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return this.view.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
this.list.resetStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPower() {
|
||||
return this.hasPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPowered(final boolean hasPower) {
|
||||
this.hasPower = hasPower;
|
||||
}
|
||||
|
||||
public int getRowSize() {
|
||||
return this.rowSize;
|
||||
}
|
||||
|
||||
public void setRowSize(final int rowSize) {
|
||||
this.rowSize = rowSize;
|
||||
}
|
||||
|
||||
public String getSearchString() {
|
||||
return this.searchString;
|
||||
}
|
||||
|
||||
public void setSearchString(@Nonnull final String searchString) {
|
||||
this.searchString = searchString;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPaused() {
|
||||
return this.paused;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPaused(boolean paused) {
|
||||
if (this.paused != paused) {
|
||||
this.paused = paused;
|
||||
|
||||
// Update view when un-paused
|
||||
if (!paused) {
|
||||
updateView();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,10 +17,9 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.render.tank.ModelCertusTank;
|
||||
import com.glodblock.github.common.item.ItemCertusQuartzTank;
|
||||
import com.glodblock.github.common.tile.TileCertusQuartzTank;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.mitchej123.hodgepodge.textures.IPatchedTextureAtlasSprite;
|
||||
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
|
||||
@@ -35,7 +34,7 @@ public class ItemCertusQuartzTankRender implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type != ItemRenderType.EQUIPPED_FIRST_PERSON;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -49,31 +48,32 @@ public class ItemCertusQuartzTankRender implements IItemRenderer {
|
||||
.bindTexture(FluidCraft.resource("textures/blocks/certus_quartz_tank/map.png"));
|
||||
GL11.glPushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
GL11.glScalef(1, -1, -1);
|
||||
this.model.render(0.0625f);
|
||||
GL11.glScalef(1, -1, 1);
|
||||
this.model.render(0.0625f);
|
||||
if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
|
||||
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
if (item != null && item.hasTagCompound()) {
|
||||
FluidStack storedFluid = FluidStack
|
||||
.loadFluidStackFromNBT(item.getTagCompound().getCompoundTag("tileEntity"));
|
||||
int tankCapacity = 32000;
|
||||
GL11.glRotatef(180F, 1F, 0F, 0F);
|
||||
this.model.render(0.0625f);
|
||||
GL11.glRotatef(180F, 1F, 0F, 0F);
|
||||
|
||||
if (item.getItem() instanceof ItemCertusQuartzTank itemCertusQuartzTank) {
|
||||
FluidStack storedFluid = itemCertusQuartzTank.getFluid(item);
|
||||
int tankCapacity = itemCertusQuartzTank.getCapacity(item);
|
||||
|
||||
if (storedFluid != null && storedFluid.getFluid() != null) {
|
||||
IIcon fluidIcon = storedFluid.getFluid().getIcon();
|
||||
if (fluidIcon == null) fluidIcon = FluidRegistry.LAVA.getIcon();
|
||||
if (ModAndClassUtil.HODGEPODGE && fluidIcon instanceof IPatchedTextureAtlasSprite) {
|
||||
((IPatchedTextureAtlasSprite) fluidIcon).markNeedsAnimationUpdate();
|
||||
}
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
RenderBlocks renderer = new RenderBlocks();
|
||||
GL11.glScalef(1, 1, -1);
|
||||
Block waterBlock = FluidRegistry.WATER.getBlock();
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
renderer.setRenderBounds(
|
||||
0.08F,
|
||||
0.001F,
|
||||
@@ -81,9 +81,12 @@ public class ItemCertusQuartzTankRender implements IItemRenderer {
|
||||
0.92F,
|
||||
(float) storedFluid.amount / (float) tankCapacity * 0.999F,
|
||||
0.92F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
Block waterBlock = FluidRegistry.WATER.getBlock();
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA_F(
|
||||
(storedFluid.getFluid().getColor() >> 16 & 0xFF) / 255.0F,
|
||||
|
||||
@@ -13,9 +13,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.RenderUtil;
|
||||
import com.mitchej123.hodgepodge.textures.IPatchedTextureAtlasSprite;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -44,18 +42,17 @@ public class ItemPacketRender implements IItemRenderer {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
final boolean entity = type.equals(ItemRenderType.ENTITY);
|
||||
if (entity) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotated(90.0D, 0.0D, 1.0D, 0.0D);
|
||||
GL11.glTranslated(-0.5D, -0.6D, 0.0D);
|
||||
}
|
||||
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(item);
|
||||
int RGB = 0xFFFFFF;
|
||||
if (fluid != null) {
|
||||
RGB = fluid.getFluid().getColor(fluid);
|
||||
}
|
||||
int RGB = fluid == null ? 0xFFFFFF : fluid.getFluid().getColor(fluid);
|
||||
IIcon icon = fluid == null ? FluidRegistry.WATER.getStillIcon() : fluid.getFluid().getStillIcon();
|
||||
|
||||
if (ModAndClassUtil.HODGEPODGE && icon instanceof IPatchedTextureAtlasSprite) {
|
||||
((IPatchedTextureAtlasSprite) icon).markNeedsAnimationUpdate();
|
||||
}
|
||||
|
||||
if (RGB != 0xFFFFFF) {
|
||||
GL11.glColor3f((RGB >> 16 & 0xFF) / 255.0F, (RGB >> 8 & 0xFF) / 255.0F, (RGB & 0xFF) / 255.0F);
|
||||
}
|
||||
@@ -74,6 +71,9 @@ public class ItemPacketRender implements IItemRenderer {
|
||||
0.0625F);
|
||||
}
|
||||
|
||||
if (entity) {
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
package com.glodblock.github.client.render;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.tile.TileWalrus;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
|
||||
@@ -19,9 +14,6 @@ import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
|
||||
public class ItemWalrusRender implements IItemRenderer {
|
||||
|
||||
IModelCustom modelWalrus = AdvancedModelLoader.loadModel(FluidCraft.resource("models/walrus.obj"));
|
||||
ResourceLocation textureWalrus = FluidCraft.resource("textures/blocks/walrus.png");
|
||||
|
||||
public ItemWalrusRender() {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileWalrus.class, new RenderBlockWalrus());
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ItemAndBlockHolder.WALRUS), this);
|
||||
@@ -34,7 +26,6 @@ public class ItemWalrusRender implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(this.textureWalrus);
|
||||
GL11.glPushMatrix();
|
||||
switch (type) {
|
||||
case EQUIPPED_FIRST_PERSON -> {
|
||||
@@ -44,7 +35,7 @@ public class ItemWalrusRender implements IItemRenderer {
|
||||
case INVENTORY -> GL11.glTranslatef(-0.5F, -0.5F, -0.1F);
|
||||
default -> {}
|
||||
}
|
||||
this.modelWalrus.renderAll();
|
||||
WalrusRenderer.render();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
import com.glodblock.github.common.block.BlockFluidInterface;
|
||||
import com.glodblock.github.common.tile.TileFluidInterface;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.BlockRenderInfo;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
@@ -25,15 +26,18 @@ public class RenderBlockFluidInterface extends BaseBlockRender<BlockFluidInterfa
|
||||
final TileInterface ti = block.getTileEntity(world, x, y, z);
|
||||
final BlockRenderInfo info = block.getRendererInstance();
|
||||
|
||||
if (ti != null && ti.getForward() != ForgeDirection.UNKNOWN) {
|
||||
final IIcon side = FCPartsTexture.BlockFluidInterfaceAlternate_Arrow.getIcon();
|
||||
info.setTemporaryRenderIcons(
|
||||
FCPartsTexture.BlockInterfaceAlternate.getIcon(),
|
||||
block.getIcon(0, 0),
|
||||
side,
|
||||
side,
|
||||
side,
|
||||
side);
|
||||
if (ti != null) {
|
||||
final AEColor color = ti.getProxy().getColor();
|
||||
if (ti.getForward() != ForgeDirection.UNKNOWN) {
|
||||
final IIcon face = color == AEColor.Transparent ? block.getIcon(0, 0)
|
||||
: block.getColoredTexture(0, color);
|
||||
final IIcon alternate = color == AEColor.Transparent ? FCPartsTexture.BlockInterfaceAlternate.getIcon()
|
||||
: block.getColoredTexture(1, color);
|
||||
final IIcon side = color == AEColor.Transparent
|
||||
? FCPartsTexture.BlockFluidInterfaceAlternate_Arrow.getIcon()
|
||||
: block.getColoredTexture(2, color);
|
||||
info.setTemporaryRenderIcons(alternate, face, side, side, side, side);
|
||||
}
|
||||
}
|
||||
|
||||
final boolean fz = super.renderInWorld(block, world, x, y, z, renderer);
|
||||
|
||||
@@ -1,25 +1,16 @@
|
||||
package com.glodblock.github.client.render;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.tile.TileWalrus;
|
||||
|
||||
public class RenderBlockWalrus extends TileEntitySpecialRenderer {
|
||||
|
||||
IModelCustom modelWalrus = AdvancedModelLoader.loadModel(FluidCraft.resource("models/walrus.obj"));
|
||||
ResourceLocation textureWalrus = FluidCraft.resource("textures/blocks/walrus.png");
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTickTime) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(this.textureWalrus);
|
||||
if (!(tileentity instanceof TileWalrus Tile)) return;
|
||||
float scale = Tile.getWalrusScale();
|
||||
GL11.glPushMatrix();
|
||||
@@ -42,7 +33,7 @@ public class RenderBlockWalrus extends TileEntitySpecialRenderer {
|
||||
break;
|
||||
}
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
this.modelWalrus.renderAll();
|
||||
WalrusRenderer.render();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.glodblock.github.client.render;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.gtnewhorizon.gtnhlib.client.model.wavefront.WavefrontVBOBuilder;
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.vao.IVertexArrayObject;
|
||||
|
||||
public final class WalrusRenderer {
|
||||
|
||||
private static IVertexArrayObject walrus;
|
||||
private static final ResourceLocation textureWalrus = FluidCraft.resource("textures/blocks/walrus.png");
|
||||
|
||||
public static void load() {
|
||||
walrus = WavefrontVBOBuilder.compileToVBO(FluidCraft.resource("models/walrus.obj"));
|
||||
}
|
||||
|
||||
public static void render() {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(textureWalrus);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
walrus.render();
|
||||
}
|
||||
}
|
||||
@@ -25,8 +25,7 @@ public class ModelCertusTank extends ModelBase {
|
||||
this.textureHeight = 64;
|
||||
|
||||
this.Shape1 = new ModelRenderer(this, 0, 0);
|
||||
this.Shape1.addBox(0F, 0F, 0F, 14, 16, 14);
|
||||
this.Shape1.setRotationPoint(-7F, -8F, -7F);
|
||||
this.Shape1.addBox(-7F, -8F, -7F, 14, 16, 14);
|
||||
this.Shape1.setTextureSize(this.textureWidth, this.textureHeight);
|
||||
this.Shape1.mirror = true;
|
||||
setRotation(this.Shape1, 0F, 0F, 0F);
|
||||
|
||||
@@ -12,12 +12,6 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public enum FCPartsTexture {
|
||||
|
||||
PartFluidTerminal_Bright("fluid_terminal_bright"),
|
||||
PartFluidTerminal_Dark("fluid_terminal_dark"),
|
||||
PartFluidTerminal_Colored("fluid_terminal_medium"),
|
||||
PartFluidPatternTerminal_Bright("pattern_terminal_bright"),
|
||||
PartFluidPatternTerminal_Dark("pattern_terminal_dark"),
|
||||
PartFluidPatternTerminal_Colored("pattern_terminal_medium"),
|
||||
PartLevelTerminal_Bright("level_terminal_bright"),
|
||||
PartLevelTerminal_Dark("level_terminal_dark"),
|
||||
PartLevelTerminal_Colored("level_terminal_medium"),
|
||||
@@ -28,9 +22,15 @@ public enum FCPartsTexture {
|
||||
BlockFluidInterfaceAlternate_Arrow("fluid_interface_arrow"),
|
||||
BlockInterfaceAlternate("fluid_interface_a"),
|
||||
BlockInterface_Face("fluid_interface"),
|
||||
PartFluidLevelEmitter("fluid_level_emitter"),
|
||||
BlockLevelMaintainer("level_maintainer"),
|
||||
BlockLevelMaintainer_Active("level_maintainer_active");
|
||||
BlockLevelMaintainer_Active("level_maintainer_active"),
|
||||
PartFluidFormationPlane("fluid_formation_plane"),
|
||||
PartFluidAnnihilationPlane("fluid_annihilation_plane"),
|
||||
PartFluidFormationPlaneOn("fluid_formation_plane_on"),
|
||||
PartFluidAnnihilationPlaneOn("fluid_annihilation_plane_on"),
|
||||
BlockMEChestFluid_Bright("fluid_terminal_light"),
|
||||
BlockMEChestFluid_Dark("fluid_terminal_dark"),
|
||||
BlockMEChestFluid_Medium("fluid_terminal_medium");
|
||||
|
||||
private final String name;
|
||||
public net.minecraft.util.IIcon IIcon;
|
||||
|
||||
Loaded 100 of 508 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user