Compare commits

..
Author SHA1 Message Date
Martin Robertz b3ad356dd7 update deps 2024-02-02 15:39:55 +01:00
Martin Robertz b95a67c89a Merge remote-tracking branch 'origin/master' into dev 2024-02-02 15:39:10 +01:00
Martin Robertz 0b27c4ff69 update bs+deps 2024-01-31 22:46:00 +01:00
Martin Robertz 379de42623 Merge remote-tracking branch 'slprime/use_gt_and_ae2fc_fluids' into dev 2024-01-31 22:44:09 +01:00
slprime c7495607fb remove unused imports 2024-01-31 21:39:00 +02:00
slprime 1a5ce06c3f use of GT and ae2fс fluids in inputs/outputs and storagе 2024-01-31 18:59:10 +02:00
Martin Robertz d7f21107e7 Merge branch 'master' into dev 2024-01-12 23:20:26 +01:00
Martin Robertz fea6255058 Merge remote-tracking branch 'Cardinalstars/master' into dev 2024-01-10 08:43:04 +01:00
Martin Robertz 1d020bad7b Merge remote-tracking branch 'asdflj/master' into dev 2024-01-10 08:41:40 +01:00
Martin Robertz cea6679eb6 Merge branch 'master' into dev 2024-01-10 08:41:33 +01:00
rjnasers fa4830ac08 Spotless whoopsies 2024-01-09 19:44:57 -06:00
rjnasers a9591a031e Merge remote-tracking branch 'upstream/master' 2024-01-09 17:52:11 -06:00
zy 453147f6ef update code style 2024-01-09 00:05:46 +08:00
zy 7912a35083 update code style 2024-01-05 11:13:48 +08:00
zy 1e6ed66244 update code style 2024-01-04 23:57:03 +08:00
zy 2c005e13d6 add infinity water cell
add infinity lava cell
2024-01-04 18:21:46 +08:00
zy d2c645524b Merge remote-tracking branch 'origin/master' 2024-01-04 14:42:04 +08:00
zy 6b7c53879a add gzip support
fix terminal sometime drop network packet
2024-01-04 14:41:52 +08:00
asdflj 158703bd67 Merge branch 'master' into master 2024-01-03 22:40:59 +08:00
zy 8331159519 add magnet card
add energy card
add quantum bridge card
fluid terminal display potion effect support
all terminal add data sync button
ultra terminal add automatic stock item
2024-01-03 22:34:25 +08:00
zy 429687af07 hold the shift to stop sort items 2024-01-01 23:53:43 +08:00
rjnasers 4fd5053559 Adding sticky support for AE2-FC 2023-11-06 19:57:44 -06:00
123 changed files with 4721 additions and 1918 deletions

No files matched your search

+1622 -3
View File
File diff suppressed because it is too large. Load diff
+13 -19
View File
@@ -34,31 +34,25 @@
* 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.6.45-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-476-GTNH:dev')
api('com.github.GTNewHorizons:NotEnoughItems:2.5.4-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-312-GTNH:dev')
api('curse.maven:cofh-core-69162:2388751')
api('com.github.GTNewHorizons:waila:1.8.2:dev')
api('com.github.GTNewHorizons:waila:1.7.0:dev')
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.11.7:dev") {
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
}
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.11.0:dev")
compileOnly("com.github.GTNewHorizons:GTNHLib:0.5.20:dev") { transitive = false }
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.0.3:dev')
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.35:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ForestryMC:4.9.17:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.8.22:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.50.69:dev') {
compileOnly('com.github.GTNewHorizons:Baubles:1.0.4:dev')
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.34:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ForestryMC:4.8.2:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.6.4:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.58:dev') {
exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework'
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
}
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
compileOnly('com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:OpenComputers:1.10.27-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.6.27-GTNH:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.5.78:dev") { transitive = false }
compileOnly('com.github.GTNewHorizons:OpenComputers:1.10.6-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.6.2-GTNH:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.4.19:dev") { transitive = false }
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.3.4:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:0.5.20:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.2.0:dev")
}
+28 -160
View File
@@ -1,203 +1,71 @@
# ExampleMod tag to use as Blowdryer (Spotless, etc.) settings version, leave empty to disable.
# LOCAL to test local config updates.
gtnh.settings.blowdryerTag = 0.2.0
# Human-readable mod name, available for mcmod.info population.
modName = Fluid Craft For AE2
# Case-sensitive identifier string, available for mcmod.info population and used for automatic mixin JSON generation.
# Conventionally lowercase.
# This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId = ae2fc
# Root package of the mod, used to find various classes in other properties,
# mcmod.info substitution, enabling assertions in run tasks, etc.
modGroup = com.glodblock.github
# Whether to use modGroup as the maven publishing group.
# Due to a history of using JitPack, the default is com.github.GTNewHorizons for all mods.
useModGroupForPublishing = false
# WHY is there no version field?
# The build script relies on git to provide a version via tags. It is super easy and will enable you to always know the
# code base or your binary. Check out this tutorial: https://blog.mattclemente.com/2017/10/13/versioning-with-git-tags/
# Updates your build.gradle and settings.gradle automatically whenever an update is available.
# Will update your build.gradle automatically whenever an update is available
autoUpdateBuildScript = false
# Version of Minecraft to target
minecraftVersion = 1.7.10
# Version of Minecraft Forge to target
forgeVersion = 10.13.4.1614
# Specify an MCP channel for dependency deobfuscation and the deobfParams task.
channel = stable
# Specify an MCP mappings version for dependency deobfuscation and the deobfParams task.
mappingsVersion = 12
# Defines other MCP mappings for dependency deobfuscation.
remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/
# Select a default username for testing your mod. You can always override this per-run by running
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
# Select a username for testing your mod with breakpoints. You may leave this empty for a random user name each time you
# restart Minecraft in development. Choose this dependent on your mod:
# Do you need consistent player progressing (for example Thaumcraft)? -> Select a name
# Do you need to test how your custom blocks interacts with a player that is not the owner? -> leave name empty
developmentEnvironmentUserName = Developer
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# Enables using modern java syntax (up to version 17) via Jabel, while still targetting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
enableModernJavaSyntax = true
# Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
enableGenericInjection = false
# Generate a class with a String field for the mod version named as defined below.
# If generateGradleTokenClass is empty or not missing, no such class will be generated.
# If gradleTokenVersion is empty or missing, the field will not be present in the class.
generateGradleTokenClass =
# Name of the token containing the project's current version to generate/replace.
gradleTokenVersion = GRADLETOKEN_VERSION
# [DEPRECATED] Mod ID replacement token.
gradleTokenModId = GRADLETOKEN_MODID
# [DEPRECATED] Mod name replacement token.
gradleTokenModName = GRADLETOKEN_MODNAME
# [DEPRECATED] Mod Group replacement token.
gradleTokenGroupName = GRADLETOKEN_GROUPNAME
# [DEPRECATED]
# Multiple source files can be defined here by providing a comma-separated list: Class1.java,Class2.java,Class3.java
# Define a source file of your project with:
# public static final String VERSION = "GRADLETOKEN_VERSION";
# The string's content will be replaced with your mod's version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...]).
# Leave these properties empty to skip individual token replacements.
# The string's content will be replaced with your mods version when compiled. You should use this to specify your mod's
# version in @Mod([...], version = VERSION, [...])
# Leave these properties empty to skip individual token replacements
replaceGradleTokenInFile = FluidCraft.java
gradleTokenModId = GRADLETOKEN_MODID
gradleTokenModName = GRADLETOKEN_MODNAME
gradleTokenVersion = GRADLETOKEN_VERSION
gradleTokenGroupName = GRADLETOKEN_GROUPNAME
# In case your mod provides an API for other mods to implement you may declare its package here. Otherwise, you can
# leave this property empty.
# Example value: (apiPackage = api) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.api
# Example value: apiPackage = api + modGroup = com.myname.mymodid -> com.myname.mymodid.api
apiPackage = api
# Specify the configuration file for Forge's access transformers here. It must be placed into /src/main/resources/META-INF/
# There can be multiple files in a space-separated list.
# Example value: mymodid_at.cfg nei_at.cfg
# Specify the configuration file for Forge's access transformers here. I must be placed into /src/main/resources/META-INF/
# Example value: mymodid_at.cfg
accessTransformersFile = ae2fc_at.cfg
# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
# Set to a non-empty string to configure mixins in a separate source set under src/VALUE, instead of src/main.
# This can speed up compile times thanks to not running the mixin annotation processor on all input sources.
# Mixin classes will have access to "main" classes, but not the other way around.
separateMixinSourceSet =
# Adds some debug arguments like verbose output and class export.
usesMixinDebug = false
# Specify the location of your implementation of IMixinConfigPlugin. Leave it empty otherwise.
mixinPlugin =
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage =
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
# This parameter is for legacy compatibility only
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
# Example value: coreModClass = asm.FMLPlugin + modGroup = com.myname.mymodid -> com.myname.mymodid.asm.FMLPlugin
coreModClass = coremod.FluidCraftCore
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
containsMixinsAndOrCoreModOnly = false
# Enables Mixins even if this mod doesn't use them, useful if one of the dependencies uses mixins.
forceEnableMixins = false
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated into your jar. It is your
# responsibility to check the license and request permission for distribution if required.
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required.
usesShadowedDependencies = false
# If disabled, won't remove unused classes from shadowed dependencies. Some libraries use reflection to access
# their own classes, making the minimization unreliable.
minimizeShadowedDependencies = true
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = true
# Adds CurseMaven, Modrinth, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true
# A list of repositories to exclude from the includeWellKnownRepositories setting. Should be a space separated
# list of strings, with the acceptable keys being(case does not matter):
# cursemaven
# modrinth
excludeWellKnownRepositories =
# Change these to your Maven coordinates if you want to publish to a custom Maven repository instead of the default GTNH Maven.
# Authenticate with the MAVEN_USER and MAVEN_PASSWORD environment variables.
# If you need a more complex setup disable maven publishing here and add a publishing repository to addon.gradle.
usesMavenPublishing = true
# Maven repository to publish the mod to.
# mavenPublishUrl = https\://nexus.gtnewhorizons.com/repository/releases/
# Publishing to Modrinth requires you to set the MODRINTH_TOKEN environment variable to your current Modrinth API token.
#
# The project's ID on Modrinth. Can be either the slug or the ID.
# Leave this empty if you don't want to publish to Modrinth.
modrinthProjectId =
# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
# Syntax: scope1-type1:name1;scope2-type2:name2;...
# Where scope can be one of [required, optional, incompatible, embedded],
# type can be one of [project, version],
# and the name is the Modrinth project or version slug/id of the other mod.
# Example: required-project:fplib;optional-project:gasstation;incompatible-project:gregtech
# Note: GTNH Mixins is automatically set as a required dependency if usesMixins = true
modrinthRelations =
# Publishing to CurseForge requires you to set the CURSEFORGE_TOKEN environment variable to one of your CurseForge API tokens.
#
# The project's numeric ID on CurseForge. You can find this in the About Project box.
# Leave this empty if you don't want to publish on CurseForge.
curseForgeProjectId =
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
# Syntax: type1:name1;type2:name2;...
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
# and the name is the CurseForge project slug of the other mod.
# Example: requiredDependency:railcraft;embeddedLibrary:cofhlib;incompatible:buildcraft
# Note: UniMixins is automatically set as a required dependency if usesMixins = true.
curseForgeRelations =
# Optional parameter to customize the produced artifacts. Use this to preserve artifact naming when migrating older
# Optional parameter to customize the produced artifacts. Use this to preserver artifact naming when migrating older
# projects. New projects should not use this parameter.
# customArchiveBaseName =
# Optional parameter to have the build automatically fail if an illegal version is used.
# This can be useful if you e.g. only want to allow versions in the form of '1.1.xxx'.
# The check is ONLY performed if the version is a git tag.
# Note: the specified string must be escaped, so e.g. 1\\.1\\.\\d+ instead of 1\.1\.\d+
# versionPattern =
# Uncomment to prevent the source code from being published.
# noPublishedSources = true
# Uncomment this to disable Spotless checks.
# This should only be uncommented to keep it easier to sync with upstream/other forks.
# That is, if there is no other active fork/upstream, NEVER change this.
# disableSpotless = true
# Uncomment this to disable Checkstyle checks (currently wildcard import check).
# disableCheckstyle = true
# Override the IDEA build type. Valid values are: "" (leave blank, do not override), "idea" (force use native IDEA build), "gradle"
# (force use delegated build).
# This is meant to be set in $HOME/.gradle/gradle.properties.
# e.g. add "systemProp.org.gradle.project.ideaOverrideBuildType=idea" will override the build type to be native build.
# WARNING: If you do use this option, it will overwrite whatever you have in your existing projects. This might not be what you want!
# Usually there is no need to uncomment this here as other developers do not necessarily use the same build type as you.
# ideaOverrideBuildType = idea
# Whether IDEA should run spotless checks when pressing the Build button.
# This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true
#customArchiveBaseName =
# Optional parameter to prevent the source code from being published
# noPublishedSources =
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+2 -5
View File
@@ -15,8 +15,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
@@ -57,7 +55,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/HEAD/subprojects/plugins/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 +84,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 "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Vendored
+10 -12
View File
@@ -13,8 +13,6 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@@ -45,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
@@ -59,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
+7 -3
View File
@@ -6,7 +6,6 @@ pluginManagement {
name "GTNH Maven"
url "https://nexus.gtnewhorizons.com/repository/public/"
mavenContent {
includeGroup("com.gtnewhorizons")
includeGroupByRegex("com\\.gtnewhorizons\\..+")
}
}
@@ -17,7 +16,12 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.29'
id 'com.diffplug.blowdryerSetup' version '1.7.1'
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' // Provides java toolchains
}
blowdryerSetup {
repoSubfolder 'gtnhShared'
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
//devLocal '.' // Use this when testing config updates locally
}
@@ -13,7 +13,6 @@ 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.ModAndClassUtil;
@@ -25,8 +24,6 @@ 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(
@@ -76,9 +73,8 @@ public class FluidCraft {
if (!Config.removeRecipe) {
RecipeLoader.INSTANCE.run();
}
if (!ModAndClassUtil.NEW_HORIZONS_CORE_MOD) {
RecipeLoader.addTerminalCards();
RecipeLoader.addInfiniteWaterCell();
if (Config.testItemRecipe) {
RecipeLoader.addTestItem();
}
RecipeLoader.runTerminalRecipe();
@@ -97,16 +93,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) {
@@ -4,7 +4,6 @@ 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;
@@ -25,16 +24,12 @@ 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 {
@@ -42,12 +37,9 @@ 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;
@@ -78,77 +70,45 @@ public class GuiDualInterface extends GuiUpgradeable {
itemRender);
this.buttonList.add(this.switcher);
int offset = 8;
this.BlockMode = new GuiImgButton(this.guiLeft - 18, this.guiTop + offset, Settings.BLOCK, YesNo.NO);
this.BlockMode = new GuiImgButton(this.guiLeft - 18, this.guiTop + 8, 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,
this.guiTop + 26,
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,
this.guiTop + 44,
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,
this.guiTop + 62,
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,
this.guiTop + 80,
Settings.SIDELESS_MODE,
SidelessMode.SIDELESS);
this.buttonList.add(this.sidelessMode);
offset += 18;
}
this.lockCraftingMode = new GuiImgButton(
this.guiLeft - 18,
this.guiTop + offset,
this.guiTop + 98,
Settings.LOCK_CRAFTING_MODE,
LockCraftingMode.NONE);
this.lockCraftingMode.visible = this.bc.getInstalledUpgrades(Upgrades.LOCK_CRAFTING) > 0;
@@ -160,25 +120,13 @@ public class GuiDualInterface extends GuiUpgradeable {
if (this.BlockMode != null) {
this.BlockMode.set(((ContainerInterface) this.cvb).getBlockingMode());
}
if (this.SmartBlockMode != null) {
this.SmartBlockMode.set(((ContainerInterface) this.cvb).getSmartBlockingMode());
}
if (this.interfaceMode != null) {
this.interfaceMode.setState(((ContainerInterface) this.cvb).getInterfaceTerminalMode() == YesNo.YES);
}
if (this.insertionMode != null) {
this.insertionMode.set(((ContainerInterface) this.cvb).getInsertionMode());
}
if (this.doublePatterns != null) {
this.doublePatterns.enabled = ((ContainerInterface) this.cvb).isAllowedToMultiplyPatterns;
if (this.doublePatterns.enabled) this.doublePatterns.setTooltip(
ButtonToolTips.DoublePatterns.getLocal() + "\n" + ButtonToolTips.DoublePatternsHint.getLocal());
else this.doublePatterns.setTooltip(
ButtonToolTips.DoublePatterns.getLocal() + "\n" + ButtonToolTips.OptimizePatternsNoReq.getLocal());
}
if (this.patternOptimization != null) {
this.patternOptimization.setState(((ContainerInterface) this.cvb).getPatternOptimization() == YesNo.YES);
}
if (this.sidelessMode != null) {
this.sidelessMode.set(((ContainerDualInterface) this.cvb).getSidelessMode());
}
@@ -219,21 +167,8 @@ public class GuiDualInterface extends GuiUpgradeable {
NetworkHandler.instance.sendToServer(new PacketConfigButton(Settings.INTERFACE_TERMINAL, backwards));
} else if (btn == this.BlockMode) {
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.BlockMode.getSetting(), backwards));
} else if (btn == this.SmartBlockMode) {
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.SmartBlockMode.getSetting(), backwards));
} else if (btn == this.insertionMode) {
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.insertionMode.getSetting(), backwards));
} else if (btn == this.doublePatterns) {
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) {
@@ -11,7 +11,6 @@ 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;
@@ -35,11 +34,6 @@ public class GuiFCPriority extends FCGuiAmount {
((ContainerPriority) this.inventorySlots).setTextField(this.amountBox);
}
@Override
protected int getIncrementQuantity(int i) {
return AEConfig.instance.priorityByStacksAmounts(i);
}
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.fontRendererObj.drawString(GuiText.Priority.getLocal(), 8, 6, 0x404040);
@@ -3,8 +3,6 @@ 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;
@@ -19,18 +17,12 @@ 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));
}
@@ -38,14 +30,6 @@ public class GuiFluidCraftAmount extends FCGuiAmount {
@Override
public void initGui() {
super.initGui();
this.buttonList.add(
this.craftingMode = new GuiImgButton(
this.guiLeft + 10,
this.guiTop + 53,
Settings.CRAFTING_MODE,
CraftingMode.STANDARD));
this.amountBox.setText("1");
this.amountBox.setSelectionPos(0);
}
@@ -71,20 +55,8 @@ public class GuiFluidCraftAmount extends FCGuiAmount {
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())));
if (btn == this.submit && this.submit.enabled) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketCraftRequest(getAmount(), isShiftKeyDown()));
}
} catch (final NumberFormatException e) {
this.amountBox.setText("1");
@@ -28,15 +28,13 @@ public class GuiFluidMonitor extends FCGuiMonitor<IAEFluidStack> {
}
@Override
public void postUpdate(final List<IAEFluidStack> list, boolean resort) {
public void postUpdate(final List<IAEFluidStack> list) {
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.repo.updateView();
this.setScrollBar();
}
@@ -44,6 +42,7 @@ public class GuiFluidMonitor extends FCGuiMonitor<IAEFluidStack> {
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.fontRendererObj.drawString(this.getGuiDisplayName(GuiText.Terminal.getLocal()), 8, 6, 4210752);
this.fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
super.drawFG(offsetX, offsetY, mouseX, mouseY);
}
@Override
@@ -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);
}
}
@@ -9,6 +9,7 @@ import net.minecraft.util.StatCollector;
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.client.gui.widget.GuiFCImgButton;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.NameConst;
@@ -9,8 +9,9 @@ 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.client.gui.widget.GuiFCImgButton;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
import com.glodblock.github.network.CPacketFluidTerminalBtns;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.NameConst;
@@ -219,7 +220,7 @@ public class GuiFluidPatternTerminalEx extends FCGuiEncodeTerminal {
private void changeActivePage() {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidPatternTermBtns(
new CPacketFluidTerminalBtns(
"PatternTerminal.ActivePage",
String.valueOf(this.processingScrollBar.getCurrentScroll())));
}
@@ -27,4 +27,9 @@ public class GuiFluidPortableCell extends GuiFluidTerminal {
return 3;
}
}
@Override
protected boolean isPortableCell() {
return true;
}
}
@@ -11,7 +11,7 @@ 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.network.CPacketFluidTerminalBtns;
import com.glodblock.github.util.NameConst;
import appeng.api.config.AccessRestriction;
@@ -89,9 +89,9 @@ public class GuiFluidStorageBus extends GuiUpgradeable {
super.actionPerformed(btn);
final boolean backwards = Mouse.isButtonDown(1);
if (btn == this.partition) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("StorageBus.Action", "Partition"));
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidTerminalBtns("StorageBus.Action", "Partition"));
} else if (btn == this.clear) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("StorageBus.Action", "Clear"));
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidTerminalBtns("StorageBus.Action", "Clear"));
} else if (btn == this.priority) {
InventoryHandler.switchGui(GuiType.PRIORITY);
} else if (btn == this.rwMode) {
@@ -2,7 +2,6 @@ package com.glodblock.github.client.gui;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
@@ -20,6 +19,7 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
@@ -34,6 +34,7 @@ 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.ContainerInterfaceWireless;
import com.glodblock.github.client.gui.widget.GuiFCImgButton;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.network.CPacketRenamer;
@@ -43,6 +44,7 @@ import appeng.api.config.Settings;
import appeng.api.config.TerminalStyle;
import appeng.api.config.YesNo;
import appeng.api.util.DimensionalCoord;
import appeng.api.util.WorldCoord;
import appeng.client.gui.IInterfaceTerminalPostUpdate;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiScrollbar;
@@ -70,7 +72,6 @@ import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import cpw.mods.fml.common.Loader;
// TODO why is this copy pasting all the UI code from AE2 instead of reusing it ???
public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillTextField, IInterfaceTerminalPostUpdate {
public static final int HEADER_HEIGHT = 52;
@@ -220,7 +221,9 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
offsetY = guiButtonAssemblersOnly.yPosition + 18;
setSearchString();
if (AEConfig.instance.preserveSearchBar || isSubGui()) {
setSearchString();
}
this.setScrollBar();
this.repositionSlots();
@@ -321,7 +324,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
if (btn == this.terminalStyleBox) {
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
super.scheduleGuiResize();
initGui();
} else if (btn == searchStringSave) {
AEConfig.instance.preserveSearchBar = next == YesNo.YES;
}
@@ -342,16 +345,9 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
}
public void setSearchString() {
boolean setString = AEConfig.instance.preserveSearchBar || isSubGui();
if (searchFieldInputs.getText().isEmpty() && setString) {
searchFieldInputs.setText(searchFieldInputsText);
}
if (searchFieldOutputs.getText().isEmpty() && setString) {
searchFieldOutputs.setText(searchFieldOutputsText);
}
if (searchFieldNames.getText().isEmpty() && setString) {
searchFieldNames.setText(searchFieldNamesText);
}
searchFieldInputs.setText(searchFieldInputsText);
searchFieldOutputs.setText(searchFieldOutputsText);
searchFieldNames.setText(searchFieldNamesText);
}
@Override
@@ -465,20 +461,19 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
GL11.glTranslatef(0.0f, 0.0f, -(ITEM_STACK_OVERLAY_Z + ITEM_STACK_Z + STEP_Z));
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
Iterator<InterfaceWirelessEntry> visible = section.getVisible();
Iterator<InerfaceWirelessEntry> visible = section.getVisible();
while (visible.hasNext()) {
InterfaceWirelessEntry entry = visible.next();
if (viewY + renderY + entry.rows * 18 + 1 > 0 && viewY + renderY < viewHeight) {
if (viewY < viewHeight) {
renderY += drawEntry(
entry,
visible.next(),
viewY + InterfaceWirelessSection.TITLE_HEIGHT + renderY,
title,
relMouseX,
relMouseY);
} else {
InerfaceWirelessEntry entry = visible.next();
entry.dispY = -9999;
entry.optionsButton.yPosition = -1;
renderY += entry.rows * 18 + 1;
}
}
bindTexture(BACKGROUND);
@@ -522,7 +517,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
*
* @param viewY the gui coordinate z
*/
private int drawEntry(InterfaceWirelessEntry entry, int viewY, int titleBottom, int relMouseX, int relMouseY) {
private int drawEntry(InerfaceWirelessEntry entry, int viewY, int titleBottom, int relMouseX, int relMouseY) {
bindTexture(BACKGROUND);
Tessellator.instance.startDrawingQuads();
int relY = 0;
@@ -613,7 +608,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
aeRenderItem.zLevel = 0.0f;
RenderHelper.disableStandardItemLighting();
if (!tooltip) {
if (entry.slotIsBroken(slotIdx)) {
if (entry.brokenRecipes[slotIdx]) {
GL11.glTranslatef(0.0f, 0.0f, SLOT_Z - ITEM_STACK_OVERLAY_Z);
drawRect(0, 0, 16, 16, GuiColors.ItemSlotOverlayInvalid.getColor());
} else if (entry.filteredRecipes[slotIdx]) {
@@ -840,19 +835,18 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
private void parsePacketCmd(PacketInterfaceTerminalUpdate.PacketEntry cmd) {
long id = cmd.entryId;
if (cmd instanceof PacketInterfaceTerminalUpdate.PacketAdd addCmd) {
InterfaceWirelessEntry entry = new InterfaceWirelessEntry(
InerfaceWirelessEntry entry = new InerfaceWirelessEntry(
id,
addCmd.name,
addCmd.rows,
addCmd.rowSize,
addCmd.online,
addCmd.p2pOutput).setLocation(addCmd.x, addCmd.y, addCmd.z, addCmd.dim, addCmd.side)
addCmd.online).setLocation(addCmd.x, addCmd.y, addCmd.z, addCmd.dim, addCmd.side)
.setIcons(addCmd.selfRep, addCmd.dispRep).setItems(addCmd.items);
masterList.addEntry(entry);
} else if (cmd instanceof PacketInterfaceTerminalUpdate.PacketRemove) {
masterList.removeEntry(id);
} else if (cmd instanceof PacketInterfaceTerminalUpdate.PacketOverwrite owCmd) {
InterfaceWirelessEntry entry = masterList.list.get(id);
InerfaceWirelessEntry entry = masterList.list.get(id);
if (entry == null) {
return;
@@ -871,7 +865,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
}
masterList.isDirty = true;
} else if (cmd instanceof PacketInterfaceTerminalUpdate.PacketRename renameCmd) {
InterfaceWirelessEntry entry = masterList.list.get(id);
InerfaceWirelessEntry entry = masterList.list.get(id);
if (entry != null) {
if (StatCollector.canTranslate(renameCmd.newName)) {
@@ -966,12 +960,12 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
*/
private class InterfaceWirelessList {
private final Map<Long, InterfaceWirelessEntry> list = new HashMap<>();
private final Map<Long, InerfaceWirelessEntry> list = new HashMap<>();
private final Map<String, InterfaceWirelessSection> sections = new TreeMap<>();
private final List<InterfaceWirelessSection> visibleSections = new ArrayList<>();
private boolean isDirty;
private int height;
private InterfaceWirelessEntry hoveredEntry;
private InerfaceWirelessEntry hoveredEntry;
InterfaceWirelessList() {
this.isDirty = true;
@@ -1048,7 +1042,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
return result;
}
public void addEntry(InterfaceWirelessEntry entry) {
public void addEntry(InerfaceWirelessEntry entry) {
InterfaceWirelessSection section = sections.get(entry.dispName);
if (section == null) {
@@ -1061,7 +1055,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
}
public void removeEntry(long id) {
InterfaceWirelessEntry entry = list.remove(id);
InerfaceWirelessEntry entry = list.remove(id);
if (entry != null) {
entry.section.removeEntry(entry);
@@ -1103,8 +1097,8 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
public static final int TITLE_HEIGHT = 12;
String name;
List<InterfaceWirelessEntry> entries = new ArrayList<>();
Set<InterfaceWirelessEntry> visibleEntries = new TreeSet<>(Comparator.comparing(e -> {
List<InerfaceWirelessEntry> entries = new ArrayList<>();
Set<InerfaceWirelessEntry> visibleEntries = new TreeSet<>(Comparator.comparing(e -> {
if (e.dispRep != null) {
return e.dispRep.getDisplayName() + e.id;
} else {
@@ -1135,7 +1129,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
height = 0;
} else {
height = TITLE_HEIGHT;
for (InterfaceWirelessEntry entry : visibleEntries) {
for (InerfaceWirelessEntry entry : visibleEntries) {
height += entry.guiHeight;
}
}
@@ -1147,9 +1141,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
String input = GuiInterfaceWireless.this.searchFieldInputs.getText().toLowerCase();
String output = GuiInterfaceWireless.this.searchFieldOutputs.getText().toLowerCase();
for (InterfaceWirelessEntry entry : entries) {
if (!entry.online || entry.p2pOutput) continue;
for (InerfaceWirelessEntry entry : entries) {
var moleAss = AEApi.instance().definitions().blocks().molecularAssembler().maybeStack(1);
entry.dispY = -9999;
if (onlyMolecularAssemblers
@@ -1160,7 +1152,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
&& entry.numItems == entry.rows * entry.rowSize) {
continue;
}
if (onlyBrokenRecipes && !entry.hasBrokenSlot()) {
if (onlyBrokenRecipes && entry.numBrokenRecipes == 0) {
continue;
}
// Find search terms
@@ -1188,19 +1180,19 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
}
}
public void addEntry(InterfaceWirelessEntry entry) {
public void addEntry(InerfaceWirelessEntry entry) {
this.entries.add(entry);
entry.section = this;
this.isDirty = true;
}
public void removeEntry(InterfaceWirelessEntry entry) {
public void removeEntry(InerfaceWirelessEntry entry) {
this.entries.remove(entry);
entry.section = null;
this.isDirty = true;
}
public Iterator<InterfaceWirelessEntry> getVisible() {
public Iterator<InerfaceWirelessEntry> getVisible() {
if (isDirty) {
update();
}
@@ -1208,7 +1200,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
}
public boolean mouseClicked(int relMouseX, int relMouseY, int btn) {
Iterator<InterfaceWirelessEntry> it = getVisible();
Iterator<InerfaceWirelessEntry> it = getVisible();
boolean ret = false;
while (it.hasNext() && !ret) {
@@ -1222,7 +1214,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
/**
* This class keeps track of an entry and its widgets.
*/
private class InterfaceWirelessEntry {
private class InerfaceWirelessEntry {
String dispName;
AppEngInternalInventory inv;
@@ -1240,14 +1232,14 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
int guiHeight;
int dispY = -9999;
boolean online;
boolean p2pOutput;
private Boolean[] brokenRecipes;
int numBrokenRecipes;
boolean[] brokenRecipes;
int numItems = 0;
/** Should recipe be filtered out/grayed out? */
boolean[] filteredRecipes;
private int hoveredSlotIdx = -1;
InterfaceWirelessEntry(long id, String name, int rows, int rowSize, boolean online, boolean p2pOutput) {
InerfaceWirelessEntry(long id, String name, int rows, int rowSize, boolean online) {
this.id = id;
if (StatCollector.canTranslate(name)) {
this.dispName = StatCollector.translateToLocal(name);
@@ -1263,17 +1255,16 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
this.rows = rows;
this.rowSize = rowSize;
this.online = online;
this.p2pOutput = p2pOutput;
this.optionsButton = new GuiFCImgButton(2, 0, "HIGHLIGHT", "YES");
this.optionsButton.setHalfSize(true);
this.renameButton = new GuiFCImgButton(2, 0, "EDIT", "YES");
this.renameButton.setHalfSize(true);
this.guiHeight = 18 * rows + 1;
this.brokenRecipes = new Boolean[rows * rowSize];
this.brokenRecipes = new boolean[rows * rowSize];
this.filteredRecipes = new boolean[rows * rowSize];
}
InterfaceWirelessEntry setLocation(int x, int y, int z, int dim, int side) {
InerfaceWirelessEntry setLocation(int x, int y, int z, int dim, int side) {
this.x = x;
this.y = y;
this.z = z;
@@ -1283,7 +1274,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
return this;
}
InterfaceWirelessEntry setIcons(ItemStack selfRep, ItemStack dispRep) {
InerfaceWirelessEntry setIcons(ItemStack selfRep, ItemStack dispRep) {
// Kotlin would make this pretty easy :(
this.selfRep = selfRep;
this.dispRep = dispRep;
@@ -1294,7 +1285,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
public void fullItemUpdate(NBTTagList items, int newSize) {
inv = new AppEngInternalInventory(null, newSize);
rows = newSize / rowSize;
brokenRecipes = new Boolean[newSize];
brokenRecipes = new boolean[newSize];
numItems = 0;
for (int i = 0; i < inv.getSizeInventory(); ++i) {
@@ -1303,7 +1294,7 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
this.guiHeight = 18 * rows + 4;
}
InterfaceWirelessEntry setItems(NBTTagList items) {
InerfaceWirelessEntry setItems(NBTTagList items) {
assert items.tagCount() == inv.getSizeInventory();
for (int i = 0; i < items.tagCount(); ++i) {
@@ -1319,46 +1310,21 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
}
private void setItemInSlot(ItemStack stack, int idx) {
final int oldBroke = brokenRecipes[idx] ? 1 : 0;
final int newBroke = recipeIsBroken(stack) ? 1 : 0;
final int oldHasItem = inv.getStackInSlot(idx) != null ? 1 : 0;
final int newHasItem = stack != null ? 1 : 0;
// Update broken recipe count
numBrokenRecipes += newBroke - oldBroke;
brokenRecipes[idx] = newBroke == 1;
inv.setInventorySlotContents(idx, stack);
assert numBrokenRecipes >= 0;
// Update item count
numItems += newHasItem - oldHasItem;
assert numItems >= 0;
}
public boolean hasBrokenSlot() {
boolean existsUnknown = false;
for (int idx = 0; idx < brokenRecipes.length; idx++) {
if (brokenRecipes[idx] == null) {
existsUnknown = true;
} else if (brokenRecipes[idx] == true) {
return true;
}
}
if (existsUnknown) {
for (int idx = 0; idx < brokenRecipes.length; idx++) {
if (slotIsBroken(idx)) {
return true;
}
}
}
return false;
}
public boolean slotIsBroken(int idx) {
if (brokenRecipes[idx] == null) {
brokenRecipes[idx] = recipeIsBroken(inv.getStackInSlot(idx));
}
return brokenRecipes[idx];
}
public AppEngInternalInventory getInventory() {
return inv;
}
@@ -1382,11 +1348,25 @@ public class GuiInterfaceWireless extends FCBaseMEGui implements IDropToFillText
blockPos.getDimension(),
ForgeDirection.getOrientation(side)));
} else {
BlockPosHighlighter.highlightBlocks(
mc.thePlayer,
Collections.singletonList(blockPos),
PlayerMessages.InterfaceHighlighted.getName(),
PlayerMessages.InterfaceInOtherDim.getName());
/* View in world */
WorldCoord blockPos2 = new WorldCoord(
(int) mc.thePlayer.posX,
(int) mc.thePlayer.posY,
(int) mc.thePlayer.posZ);
if (mc.theWorld.provider.dimensionId != dim) {
mc.thePlayer.addChatMessage(
new ChatComponentTranslation(PlayerMessages.InterfaceInOtherDim.getName(), dim));
} else {
BlockPosHighlighter.highlightBlock(
blockPos,
System.currentTimeMillis() + 500 * WorldCoord.getTaxicabDistance(blockPos, blockPos2));
mc.thePlayer.addChatMessage(
new ChatComponentTranslation(
PlayerMessages.InterfaceHighlighted.getName(),
blockPos.x,
blockPos.y,
blockPos.z));
}
mc.thePlayer.closeScreen();
}
return true;
@@ -23,13 +23,11 @@ public class GuiItemMonitor extends FCGuiMonitor<IAEItemStack> {
}
@Override
public void postUpdate(final List<IAEItemStack> list, boolean resort) {
public void postUpdate(final List<IAEItemStack> list) {
for (final IAEItemStack is : list) {
this.repo.postUpdate(is);
}
if (resort) {
this.repo.updateView();
}
this.repo.updateView();
this.setScrollBar();
}
@@ -37,6 +35,7 @@ public class GuiItemMonitor extends FCGuiMonitor<IAEItemStack> {
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.fontRendererObj.drawString(this.getGuiDisplayName(GuiText.Terminal.getLocal()), 8, 6, 4210752);
this.fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
super.drawFG(offsetX, offsetY, mouseX, mouseY);
}
@Override
@@ -2,10 +2,10 @@ package com.glodblock.github.client.gui;
import static com.glodblock.github.client.gui.container.ContainerLevelMaintainer.createLevelValues;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Pattern;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
@@ -22,6 +22,9 @@ import org.lwjgl.opengl.GL11;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerLevelMaintainer;
import com.glodblock.github.client.gui.widget.FCGuiLineField;
import com.glodblock.github.client.gui.widget.FCGuiTextField;
import com.glodblock.github.client.gui.widget.GuiFCImgButton;
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
import com.glodblock.github.common.parts.PartLevelTerminal;
import com.glodblock.github.common.tile.TileLevelMaintainer;
@@ -40,7 +43,6 @@ import com.glodblock.github.network.CPacketLevelTerminalCommands;
import com.glodblock.github.util.FCGuiColors;
import com.glodblock.github.util.NameConst;
import com.glodblock.github.util.Util;
import com.gtnewhorizon.gtnhlib.util.parsing.MathExpressionParser;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.DimensionalCoord;
@@ -57,7 +59,6 @@ import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cofh.core.render.CoFHFontRenderer;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Optional;
@Optional.Interface(modid = "NotEnoughItems", iface = "codechicken.nei.api.INEIGuiHandler")
@@ -77,10 +78,6 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
protected Util.DimensionalCoordSide originalBlockPos;
protected GuiTabButton originalGuiBtn;
protected static final boolean isGTNHLibLoaded = Loader.isModLoaded("gtnhlib");
protected static final Pattern numberPattern = isGTNHLibLoaded ? MathExpressionParser.EXPRESSION_PATTERN
: Pattern.compile("^[0-9]+");
public GuiLevelMaintainer(InventoryPlayer ipl, TileLevelMaintainer tile) {
super(new ContainerLevelMaintainer(ipl, tile));
this.cont = (ContainerLevelMaintainer) inventorySlots;
@@ -284,7 +281,7 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
this.input.textboxKeyTyped(character, key);
}
super.keyTyped(character, key);
if (!numberPattern.matcher(this.input.getText()).matches()) {
if (!this.input.getText().matches("^[0-9]+")) {
this.input.setTextColor(0xFF0000);
} else {
this.input.setTextColor(0xFFFFFF);
@@ -353,21 +350,18 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
return null;
}
private Rectangle getSlotArea(SlotFake slot) {
return new Rectangle(guiLeft + slot.getX(), guiTop + slot.getY(), 16, 16);
}
@Override
public boolean handleDragNDrop(GuiContainer gui, int mouseX, int mouseY, ItemStack draggedStack, int button) {
if (draggedStack == null) {
return false;
if (draggedStack != null) {
draggedStack.stackSize = 0;
}
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)) {
if (getSlotArea(slot).contains(mouseX, mouseY) && draggedStack != null) {
ItemStack itemStack = createLevelValues(draggedStack.copy());
itemStack.getTagCompound().setInteger(TLMTags.Index.tagName, i);
slot.putStack(itemStack);
@@ -420,12 +414,7 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
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()) {
if (!widget.textField.getText().isEmpty() && widget.textField.getText().matches("^[0-9]+")) {
String str = widget.textField.getText().replaceAll("^(0+)", "");
widget.textField.setText(str.isEmpty() ? "0" : str);
FluidCraft.proxy.netHandler.sendToServer(
@@ -9,15 +9,12 @@ import static com.glodblock.github.network.SPacketLevelTerminalUpdate.PacketOver
import static com.glodblock.github.network.SPacketLevelTerminalUpdate.PacketRemove;
import static com.glodblock.github.network.SPacketLevelTerminalUpdate.PacketRename;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
@@ -28,13 +25,13 @@ import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
@@ -46,6 +43,7 @@ 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.client.gui.widget.GuiFCImgButton;
import com.glodblock.github.common.tile.TileLevelMaintainer.State;
import com.glodblock.github.common.tile.TileLevelMaintainer.TLMTags;
import com.glodblock.github.inventory.InventoryHandler;
@@ -60,11 +58,11 @@ import com.glodblock.github.util.NameConst;
import com.glodblock.github.util.Util;
import appeng.api.config.Settings;
import appeng.api.config.TerminalFontSize;
import appeng.api.config.TerminalStyle;
import appeng.api.config.YesNo;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.WorldCoord;
import appeng.client.gui.IGuiTooltipHandler;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiScrollbar;
@@ -348,7 +346,8 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
if (btn == terminalStyleBox) {
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
super.scheduleGuiResize();
reinitialize();
}
iBtn.set(next);
@@ -357,6 +356,11 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
super.actionPerformed(btn);
}
private void reinitialize() {
buttonList.clear();
initGui();
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
mc.getTextureManager().bindTexture(TEX_BG);
@@ -581,6 +585,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
&& relMouseY < Math.min(viewY + rowYBot, viewHeight);
if (stack != null) {
AEItemStack aeItemStack = AEItemStack.create(stack);
NBTTagCompound data = stack.getTagCompound();
ItemStack itemStack = data.hasKey(TLMTags.Stack.tagName)
? ItemStack.loadItemStackFromNBT(data.getCompoundTag(TLMTags.Stack.tagName))
@@ -594,8 +599,9 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
GL11.glTranslatef(colLeft, viewY + rowYTop + 1, ITEM_STACK_Z);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
RenderHelper.enableGUIStandardItemLighting();
itemStack.stackSize = 0;
aeRenderItem.setAeStack(null);
itemStack.stackSize = 1;
aeItemStack.setStackSize(quantity);
aeRenderItem.setAeStack(aeItemStack);
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);
@@ -611,9 +617,9 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
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);
this.drawReadableAmount(fontRendererObj, quantity, 16.0f, 12f, 16777215);
if (batch > 0) {
this.drawReadableAmount(fontRendererObj, batch, false, 16777215);
this.drawReadableAmount(fontRendererObj, batch, 16.0f, 1f, 16777215);
}
RenderHelper.disableStandardItemLighting();
@@ -652,21 +658,13 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
return relY + 1;
}
public void drawReadableAmount(final FontRenderer fontRenderer, long amount, boolean alignBottom, int color) {
final TerminalFontSize fontSize = AEConfig.instance.getTerminalFontSize();
final String stackSize = this.getToBeRenderedStackSize(amount, fontSize);
final boolean unicodeFlag = fontRenderer.getUnicodeFlag();
float scaleFactor = 0.85f;
float shiftX = 0f;
float shiftY = 0f;
if (fontSize == TerminalFontSize.SMALL) {
scaleFactor = 0.5f;
shiftX = -2.0f;
shiftY = -1.0f;
}
public void drawReadableAmount(final FontRenderer fontRenderer, long amount, float x, float y, int color) {
final float scaleFactor = AEConfig.instance.useTerminalUseLargeFont() ? 0.85f : 0.5f;
final float inverseScaleFactor = 1.0f / scaleFactor;
final int offset = AEConfig.instance.useTerminalUseLargeFont() ? 0 : -1;
final boolean unicodeFlag = fontRenderer.getUnicodeFlag();
final String stackSize = this.getToBeRenderedStackSize(amount);
fontRenderer.setUnicodeFlag(false);
@@ -674,9 +672,9 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
GL11.glPushMatrix();
GL11.glScaled(scaleFactor, scaleFactor, scaleFactor);
final int X = (int) ((shiftX + 16.0f + 1.0f - fontRenderer.getStringWidth(stackSize) * scaleFactor)
final int X = (int) (((float) x + offset - fontRenderer.getStringWidth(stackSize) * scaleFactor)
* inverseScaleFactor);
final int Y = (int) (alignBottom ? (shiftY + 16.0f - 7.0f * scaleFactor) * inverseScaleFactor : 1);
final int Y = (int) (((float) y + offset * scaleFactor) * inverseScaleFactor);
fontRenderer.drawString(stackSize, X + 1, Y, 0);
fontRenderer.drawString(stackSize, X - 1, Y, 0);
@@ -691,11 +689,11 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
fontRenderer.setUnicodeFlag(unicodeFlag);
}
private String getToBeRenderedStackSize(final long originalSize, TerminalFontSize fontSize) {
if (fontSize == TerminalFontSize.SMALL) {
return ReadableNumberConverter.INSTANCE.toWideReadableForm(originalSize);
} else {
private String getToBeRenderedStackSize(final long originalSize) {
if (AEConfig.instance.useTerminalUseLargeFont()) {
return ReadableNumberConverter.INSTANCE.toSlimReadableForm(originalSize);
} else {
return ReadableNumberConverter.INSTANCE.toWideReadableForm(originalSize);
}
}
@@ -943,26 +941,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
@Override
public List<String> handleItemTooltip(ItemStack stack, int mouseX, int mouseY, List<String> currentToolTip) {
if (stack != null && isShiftKeyDown() && stack.hasTagCompound()) {
NBTTagCompound data = stack.getTagCompound();
if (data.hasKey(TLMTags.Quantity.tagName)) {
long quantity = data.getLong(TLMTags.Quantity.tagName);
long batch = data.getLong(TLMTags.Batch.tagName);
currentToolTip.add(
I18n.format(NameConst.TT_LEVEL_MAINTAINER_REQUEST_SIZE, "\n", false) + ": "
+ NumberFormat.getNumberInstance(Locale.US).format(quantity));
if (batch > 0) {
currentToolTip.add(
I18n.format(NameConst.TT_LEVEL_MAINTAINER_BATCH_SIZE, "\n", false) + ": "
+ NumberFormat.getNumberInstance(Locale.US).format(batch));
}
}
}
return currentToolTip;
}
@@ -1320,6 +1298,8 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
}
public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) {
final EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (!section.visible || mouseButton < 0 || mouseButton > 2) {
return false;
}
@@ -1334,7 +1314,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
dim,
ForgeDirection.getOrientation(side),
"");
if (isCtrlKeyDown() && isShiftKeyDown() && hasInfinityBoosterCard(mc.thePlayer)) {
if (isCtrlKeyDown() && isShiftKeyDown() && hasInfinityBoosterCard(player)) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketLevelTerminalCommands(
Action.EDIT,
@@ -1352,12 +1332,23 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
blockPos.getDimension(),
blockPos.getSide()));
} else {
BlockPosHighlighter.highlightBlocks(
mc.thePlayer,
Collections.singletonList(blockPos),
PlayerMessages.LevelEmitterHighlighted.getName(),
PlayerMessages.LevelEmitterInAnotherDim.getName());
mc.thePlayer.closeScreen();
/* View in world */
WorldCoord blockPos2 = new WorldCoord((int) player.posX, (int) player.posY, (int) player.posZ);
if (mc.theWorld.provider.dimensionId != dim) {
player.addChatMessage(
new ChatComponentTranslation(PlayerMessages.InterfaceInOtherDim.getName(), dim));
} else {
BlockPosHighlighter.highlightBlock(
blockPos,
System.currentTimeMillis() + 500 * WorldCoord.getTaxicabDistance(blockPos, blockPos2));
player.addChatMessage(
new ChatComponentTranslation(
PlayerMessages.InterfaceHighlighted.getName(),
blockPos.x,
blockPos.y,
blockPos.z));
}
player.closeScreen();
}
return true;
}
@@ -1373,17 +1364,25 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
// send packet to server, request an update
InventoryAction action = switch (mouseButton) {
case 0 -> null; // pickup / set-down.
case 1 -> null;
case 0 -> {
// pickup / set-down.
yield null;
}
case 1 -> {
yield null;
}
case 2 -> {
// creative dupe:
if (mc.thePlayer.capabilities.isCreativeMode) {
if (player.capabilities.isCreativeMode) {
yield InventoryAction.CREATIVE_DUPLICATE;
} else {
yield InventoryAction.AUTO_CRAFT;
}
}
default -> null;// drop item:
default -> {
// drop item:
yield null;
}
};
if (action != null) {
@@ -0,0 +1,180 @@
package com.glodblock.github.client.gui;
import java.util.List;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerMagnet;
import com.glodblock.github.client.gui.widget.FCGuiBaseButton;
import com.glodblock.github.client.gui.widget.GuiFCImgButton;
import com.glodblock.github.common.item.ItemMagnetCard;
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.network.CPacketFluidTerminalBtns;
import com.glodblock.github.util.NameConst;
import appeng.api.config.ActionItems;
import appeng.api.config.Settings;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.AEBaseMEGui;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiTabButton;
public class GuiMagnet extends AEBaseMEGui {
protected FCGuiBaseButton listModeBtn;
protected ContainerMagnet container;
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/magnet_filter.png");
protected Component[] components = new Component[3];
protected GuiTabButton originalGuiBtn;
protected GuiImgButton clearBtn;
public GuiMagnet(InventoryPlayer ip, ITerminalHost container) {
super(new ContainerMagnet(ip, container));
this.xSize = 195;
this.ySize = 214;
this.container = (ContainerMagnet) this.inventorySlots;
}
private static class Component {
private final GuiFCImgButton enable;
private final GuiFCImgButton disable;
private final String action;
private boolean value;
public Component(int x, int y, boolean value, String action, List<GuiButton> buttons) {
this.enable = new GuiFCImgButton(x, y, "ENABLE_12x", "ENABLE", false);
this.disable = new GuiFCImgButton(x, y, "DISABLE_12x", "DISABLE", false);
this.value = value;
this.action = action;
buttons.add(this.enable);
buttons.add(this.disable);
}
public boolean sameBtn(GuiButton btn) {
return btn == this.enable || btn == this.disable;
}
public boolean getValue() {
return this.value;
}
public void setValue(boolean value) {
this.value = value;
}
public void send() {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidTerminalBtns(this.action, !this.getValue()));
}
public void draw() {
this.enable.visible = value;
this.disable.visible = !value;
}
}
@Override
@SuppressWarnings("unchecked")
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.container.listMode == ItemMagnetCard.ListMode.WhiteList
? NameConst.GUI_MAGNET_CARD_WhiteList
: NameConst.GUI_MAGNET_CARD_BlackList)));
this.components[0] = new Component(
this.guiLeft + 156,
this.guiTop + 18,
this.container.nbt,
"WirelessTerminal.magnet.NBT",
this.buttonList);
this.components[1] = new Component(
this.guiLeft + 156,
this.guiTop + 31,
this.container.meta,
"WirelessTerminal.magnet.Meta",
this.buttonList);
this.components[2] = new Component(
this.guiLeft + 156,
this.guiTop + 44,
this.container.ore,
"WirelessTerminal.magnet.Ore",
this.buttonList);
this.buttonList.add(
this.originalGuiBtn = new GuiTabButton(
this.guiLeft + this.xSize - 44,
this.guiTop - 4,
this.container.getPortableCell().getItemStack(),
this.container.getPortableCell().getItemStack().getDisplayName(),
itemRender));
this.originalGuiBtn.setHideEdge(13); // GuiTabButton implementation //
this.clearBtn = new GuiImgButton(this.guiLeft + 8, this.guiTop + 48, Settings.ACTIONS, ActionItems.CLOSE);
this.clearBtn.setHalfSize(true);
this.buttonList.add(this.clearBtn);
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
this.fontRendererObj.drawString(getGuiDisplayName(NameConst.i18n(NameConst.GUI_MAGNET_CARD)), 8, 6, 0x404040);
this.fontRendererObj
.drawString(getGuiDisplayName(NameConst.i18n(NameConst.GUI_MAGNET_CARD_NBT)), 61, 22, 0x404040);
this.fontRendererObj
.drawString(getGuiDisplayName(NameConst.i18n(NameConst.GUI_MAGNET_CARD_META)), 61, 34, 0x404040);
this.fontRendererObj
.drawString(getGuiDisplayName(NameConst.i18n(NameConst.GUI_MAGNET_CARD_ORE)), 61, 46, 0x404040);
this.components[0].setValue(this.container.nbt);
this.components[1].setValue(this.container.meta);
this.components[2].setValue(this.container.ore);
for (Component c : components) {
c.draw();
}
this.listModeBtn.displayString = NameConst.i18n(
this.container.listMode == ItemMagnetCard.ListMode.WhiteList ? NameConst.GUI_MAGNET_CARD_WhiteList
: NameConst.GUI_MAGNET_CARD_BlackList);
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
mc.getTextureManager().bindTexture(TEX_BG);
drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, ySize);
}
@Override
protected void actionPerformed(GuiButton btn) {
for (Component c : components) {
if (c.sameBtn(btn)) {
c.send();
break;
}
}
if (btn == this.listModeBtn) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidTerminalBtns(
"WirelessTerminal.magnet.FilterMode",
this.container.listMode != ItemMagnetCard.ListMode.WhiteList));
} else if (btn == this.originalGuiBtn) {
InventoryHandler
.switchGui(ItemWirelessUltraTerminal.readMode(this.container.getPortableCell().getItemStack()));
} else if (btn == this.clearBtn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidTerminalBtns("WirelessTerminal.magnet.clear", 1));
}
super.actionPerformed(btn);
}
}
@@ -1,27 +1,46 @@
package com.glodblock.github.client.gui.base;
import static com.glodblock.github.util.NameConst.TT_FLUID_TERMINAL_AMOUNT;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.GuiEssentiaTerminal;
import com.glodblock.github.client.gui.GuiFCImgButton;
import com.glodblock.github.client.gui.GuiFluidCraftingWireless;
import com.glodblock.github.client.gui.GuiFluidMonitor;
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.client.gui.container.base.FCContainerMonitor;
import com.glodblock.github.client.gui.widget.GuiFCImgButton;
import com.glodblock.github.common.item.ItemMagnetCard;
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.network.CPacketFluidTerminalBtns;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.Util;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.AEBaseMEGui;
import appeng.client.me.SlotME;
import appeng.container.slot.SlotFake;
import appeng.core.AEConfig;
import appeng.util.Platform;
public abstract class FCBaseMEGui extends AEBaseMEGui {
@@ -32,26 +51,104 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
protected GuiFCImgButton InterfaceTerminal;
protected GuiFCImgButton LevelTerminal;
protected GuiFCImgButton PatternTerminalEx;
protected GuiFCImgButton magnetOff;
protected GuiFCImgButton magnetInv;
protected GuiFCImgButton magnetME;
protected GuiFCImgButton magnetFilter;
protected GuiFCImgButton restockEnableBtn;
protected GuiFCImgButton restockDisableBtn;
protected GuiFCImgButton dataSyncEnableBtn;
protected GuiFCImgButton dataSyncDisableBtn;
protected List<GuiFCImgButton> termBtns = new ArrayList<>();
protected boolean drawSwitchGuiBtn;
private boolean hasMagnetCard = false;
private StorageChannel channel = null;
private final FCBaseContainer container;
protected final int buttonOffset = 18;
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;
}
this.container = (FCBaseContainer) container;
if (this.container.getTarget() instanceof IWirelessTerminal iwt
&& iwt.getItemStack().getItem() instanceof ItemWirelessUltraTerminal) {
this.drawSwitchGuiBtn = true;
this.hasMagnetCard = Util.Wireless.hasMagnetCard(iwt.getItemStack());
this.channel = iwt.getChannel();
}
}
@Override
public List<String> handleItemTooltip(final ItemStack stack, final int mouseX, final int mouseY,
final List<String> currentToolTip) {
if (this instanceof GuiFluidMonitor) {
if (stack != null && !isShiftKeyDown()) {
final Slot s = this.getSlot(mouseX, mouseY);
final boolean isSlotME = s instanceof SlotME;
if (isSlotME || s instanceof SlotFake) {
final int BigNumber = AEConfig.instance.useTerminalUseLargeFont() ? 999 : 9999;
IAEItemStack myStack = null;
try {
myStack = Platform.getAEStackInSlot(s);
} catch (final Throwable ignore) {}
if (myStack != null) {
if (myStack.getStackSize() > BigNumber || (myStack.getStackSize() > 1)) {
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US)
.format(myStack.getStackSize());
final String format = I18n.format(TT_FLUID_TERMINAL_AMOUNT, formattedAmount);
currentToolTip.add("\u00a77" + format);
}
}
}
}
return currentToolTip;
} else {
return super.handleItemTooltip(stack, mouseX, mouseY, currentToolTip);
}
}
protected ItemMagnetCard.Mode getMagnetMode() {
if (this.hasMagnetCard) {
return this.container.mode;
}
return null;
}
protected boolean isRestock() {
return this.container.restock;
}
protected boolean isSyncData() {
return this.container.sync;
}
@Override
public void onGuiClosed() {
super.onGuiClosed();
}
protected void setSyncState() {
if (this.container instanceof FCContainerMonitor && !isPortableCell()) {
this.buttonList.add(
this.dataSyncEnableBtn = new GuiFCImgButton(
this.guiLeft + this.xSize - buttonOffset,
this.guiTop + this.ySize - 44,
"DATA_SYNC",
"ENABLE"));
this.buttonList.add(
this.dataSyncDisableBtn = new GuiFCImgButton(
this.guiLeft + this.xSize - buttonOffset,
this.guiTop + this.ySize - 44,
"DATA_SYNC",
"DISABLE"));
}
}
protected void initGuiDone() {
this.setSyncState();
if (drawSwitchGuiBtn) {
drawSwitchGuiBtns();
}
@@ -67,10 +164,50 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
if (!termBtns.isEmpty()) {
this.termBtns.clear();
}
if (this.getMagnetMode() != null && this.channel == StorageChannel.ITEMS) {
this.buttonList.add(
this.magnetOff = new GuiFCImgButton(
this.guiLeft + this.xSize - buttonOffset,
this.guiTop + this.ySize - 124,
"MAGNET_CARD",
"OFF"));
this.buttonList.add(
this.magnetInv = new GuiFCImgButton(
this.guiLeft + this.xSize - buttonOffset,
this.guiTop + this.ySize - 124,
"MAGNET_CARD",
"INV"));
this.buttonList.add(
this.magnetME = new GuiFCImgButton(
this.guiLeft + this.xSize - buttonOffset,
this.guiTop + this.ySize - 124,
"MAGNET_CARD",
"ME"));
this.buttonList.add(
this.magnetFilter = new GuiFCImgButton(
this.guiLeft + this.xSize - buttonOffset,
this.guiTop + this.ySize - 104,
"MAGNET_CARD",
"FILTER"));
}
if (this.channel == StorageChannel.ITEMS) {
this.buttonList.add(
this.restockEnableBtn = new GuiFCImgButton(
this.guiLeft + this.xSize - buttonOffset,
this.guiTop + this.ySize - 84,
"RESTOCK",
"ENABLE"));
this.buttonList.add(
this.restockDisableBtn = new GuiFCImgButton(
this.guiLeft + this.xSize - buttonOffset,
this.guiTop + this.ySize - 84,
"RESTOCK",
"DISABLE"));
}
if (!(this instanceof GuiFluidCraftingWireless)) {
this.buttonList.add(
this.CraftingTerminal = new GuiFCImgButton(
this.guiLeft - 18,
this.guiLeft - buttonOffset,
this.getOffsetY(),
"CRAFT_TEM",
"YES"));
@@ -80,7 +217,7 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
if (!(this instanceof GuiFluidPatternWireless)) {
this.buttonList.add(
this.PatternTerminal = new GuiFCImgButton(
this.guiLeft - 18,
this.guiLeft - buttonOffset,
this.getOffsetY(),
"PATTERN_TEM",
"YES"));
@@ -90,7 +227,7 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
if (!(this instanceof GuiFluidPatternExWireless)) {
this.buttonList.add(
this.PatternTerminalEx = new GuiFCImgButton(
this.guiLeft - 18,
this.guiLeft - buttonOffset,
this.getOffsetY(),
"PATTERN_EX_TEM",
"YES"));
@@ -99,14 +236,18 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
}
if (!(this instanceof GuiFluidPortableCell)) {
this.buttonList.add(
this.FluidTerminal = new GuiFCImgButton(this.guiLeft - 18, this.getOffsetY(), "FLUID_TEM", "YES"));
this.FluidTerminal = new GuiFCImgButton(
this.guiLeft - buttonOffset,
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.guiLeft - buttonOffset,
this.getOffsetY(),
"INTERFACE_TEM",
"YES"));
@@ -115,14 +256,18 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
}
if (!(this instanceof GuiLevelWireless)) {
this.buttonList.add(
this.LevelTerminal = new GuiFCImgButton(this.guiLeft - 18, this.getOffsetY(), "LEVEL_TEM", "YES"));
this.LevelTerminal = new GuiFCImgButton(
this.guiLeft - buttonOffset,
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.guiLeft - buttonOffset,
this.getOffsetY(),
"ESSENTIA_TEM",
"YES"));
@@ -137,26 +282,21 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
this.buttonList.addAll(termBtns);
}
private boolean scheduleGuiResize;
@Override
protected void mouseClicked(int xCoord, int yCoord, int btn) {
super.mouseClicked(xCoord, yCoord, btn);
if (scheduleGuiResize) {
// in the GuiScreen class, the implementation of super.mouseClicked
// ends up looping on the button list and execute the action for any
// button below the mouse.
// Therefore, if we initGui() the terminal in the actionPerformed method below
// it will run the actionPerformed a second time for the new button
// that will end up being below the mouse (if any) after the initGui()
buttonList.clear();
initGui();
scheduleGuiResize = false;
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
if (isPortableCell()) return;
if (getMagnetMode() != null && this.channel == StorageChannel.ITEMS) {
GuiFCImgButton[] magnetButtons = { this.magnetOff, this.magnetInv, this.magnetME };
for (int i = 0; i < magnetButtons.length; i++) {
magnetButtons[i].visible = getMagnetMode().ordinal() == i;
}
}
this.dataSyncDisableBtn.visible = !isSyncData();
this.dataSyncEnableBtn.visible = isSyncData();
if (this.drawSwitchGuiBtn && this.channel == StorageChannel.ITEMS) { // Only ultra terminal
this.restockDisableBtn.visible = !this.isRestock();
this.restockEnableBtn.visible = this.isRestock();
}
}
protected final void scheduleGuiResize() {
scheduleGuiResize = true;
}
@Override
@@ -177,7 +317,22 @@ public abstract class FCBaseMEGui extends AEBaseMEGui {
} else if (btn == this.PatternTerminalEx) {
ItemWirelessUltraTerminal.switchTerminal(this.mc.thePlayer, GuiType.WIRELESS_FLUID_PATTERN_TERMINAL_EX);
}
if (btn == this.magnetOff || btn == this.magnetME || btn == this.magnetInv) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidTerminalBtns("WirelessTerminal.MagnetMode", this.getMagnetMode().ordinal()));
} else if (btn == this.magnetFilter) {
FluidCraft.proxy.netHandler
.sendToServer(new CPacketFluidTerminalBtns("WirelessTerminal.OpenMagnet", 0));
} else if (btn == this.restockDisableBtn || btn == this.restockEnableBtn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidTerminalBtns("WirelessTerminal.Stock", 1));
} else if (btn == this.dataSyncDisableBtn || btn == this.dataSyncEnableBtn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidTerminalBtns("Terminal.Sync", !isSyncData()));
}
}
super.actionPerformed(btn);
}
protected boolean isPortableCell() {
return false;
}
}
@@ -42,11 +42,10 @@ public abstract class FCGuiAmount extends AEBaseGui {
@SuppressWarnings("unchecked")
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);
final int a = AEConfig.instance.craftItemsByStackAmounts(0);
final int b = AEConfig.instance.craftItemsByStackAmounts(1);
final int c = AEConfig.instance.craftItemsByStackAmounts(2);
final int d = AEConfig.instance.craftItemsByStackAmounts(3);
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));
@@ -86,10 +85,6 @@ public abstract class FCGuiAmount extends AEBaseGui {
this.amountBox.setFocused(true);
}
protected int getIncrementQuantity(int i) {
return AEConfig.instance.craftItemsByStackAmounts(i);
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.bindTexture(getBackground());
@@ -8,14 +8,14 @@ import org.lwjgl.input.Keyboard;
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.client.gui.widget.GuiFCImgButton;
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.network.CPacketFluidTerminalBtns;
import com.glodblock.github.util.ModAndClassUtil;
import appeng.api.storage.ITerminalHost;
@@ -67,17 +67,16 @@ public abstract class FCGuiEncodeTerminal extends GuiItemMonitor {
super.initGui();
this.buttonList.add(
this.autoFillPatternEnableBtn = new GuiFCImgButton(
this.guiLeft - 18,
this.offsetY,
this.guiLeft + this.xSize - 18,
this.guiTop + this.ySize - 64,
"FILL_PATTERN",
"DO_FILL"));
this.buttonList.add(
this.autoFillPatternDisableBtn = new GuiFCImgButton(
this.guiLeft - 18,
this.offsetY,
this.guiLeft + this.xSize - 18,
this.guiTop + this.ySize - 64,
"NOT_FILL_PATTERN",
"DONT_FILL"));
this.offsetY += 20;
}
@Override
@@ -87,48 +86,44 @@ public abstract class FCGuiEncodeTerminal extends GuiItemMonitor {
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
} else if (this.tabCraftButton == btn || this.tabProcessButton == btn) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidPatternTermBtns(
new CPacketFluidTerminalBtns(
"PatternTerminal.CraftMode",
this.tabProcessButton == btn ? MODE_CRAFTING : MODE_PROCESSING));
} else if (this.encodeBtn == btn) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidPatternTermBtns(
new CPacketFluidTerminalBtns(
"PatternTerminal.Encode",
(isCtrlKeyDown() ? 1 : 0) << 1 | (isShiftKeyDown() ? 1 : 0)));
} else if (this.clearBtn == btn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.Clear", "1"));
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidTerminalBtns("PatternTerminal.Clear", "1"));
} else if (this.substitutionsEnabledBtn == btn || this.substitutionsDisabledBtn == btn) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidPatternTermBtns(
new CPacketFluidTerminalBtns(
"PatternTerminal.Substitute",
this.substitutionsEnabledBtn == btn ? SUBSTITUTION_DISABLE : SUBSTITUTION_ENABLE));
} else if (this.fluidPrioritizedEnabledBtn == btn || this.fluidPrioritizedDisabledBtn == btn) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidPatternTermBtns(
new CPacketFluidTerminalBtns(
"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"));
new CPacketFluidTerminalBtns("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"));
new CPacketFluidTerminalBtns("PatternTerminal.Combine", this.combineDisableBtn == btn ? "1" : "0"));
} else if (ModAndClassUtil.isDoubleButton && doubleBtn == btn) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidPatternTermBtns(
new CPacketFluidTerminalBtns(
"PatternTerminal.Double",
Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? "1" : "0"));
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsDisabledBtn == btn) {
FluidCraft.proxy.netHandler
.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "1"));
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidTerminalBtns("PatternTerminal.beSubstitute", "1"));
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsEnabledBtn == btn) {
FluidCraft.proxy.netHandler
.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "0"));
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidTerminalBtns("PatternTerminal.beSubstitute", "0"));
} else if (this.autoFillPatternDisableBtn == btn || this.autoFillPatternEnableBtn == btn) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidPatternTermBtns(
new CPacketFluidTerminalBtns(
"PatternTerminal.AutoFillerPattern",
this.autoFillPatternDisableBtn == btn ? "1" : "0"));
}
@@ -16,9 +16,9 @@ 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.client.gui.widget.FCGuiTextField;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.network.CPacketInventoryAction;
@@ -70,7 +70,6 @@ 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 {
@@ -125,7 +124,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
offsetY = y;
}
public abstract void postUpdate(final List<T> list, boolean resort);
public abstract void postUpdate(final List<T> list);
protected void setScrollBar() {
this.getScrollBar().setTop(18).setLeft(175).setHeight(this.rows * 18 - 2);
@@ -161,14 +160,18 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
}
iBtn.set(next);
if (next.getClass() == SearchBoxMode.class || next.getClass() == TerminalStyle.class) {
memoryText = this.searchField.getText();
super.scheduleGuiResize();
this.reInitalize();
}
}
}
super.actionPerformed(btn);
}
protected void reInitalize() {
this.buttonList.clear();
this.initGui();
}
@Override
@SuppressWarnings("unchecked")
public void initGui() {
@@ -180,7 +183,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
final boolean hasNEI = IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.NEI);
final int NEI = hasNEI ? 1 : 0;
final int NEI = 0;
int top = hasNEI ? 22 : 0;
final int magicNumber = 114 + 1;
@@ -214,7 +217,6 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
}
super.initGui();
this.setScrollBar();
// full size : 204
// extra slots : 72
// slot 18
@@ -771,4 +773,18 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
public boolean isOverTextField(int mousex, int mousey) {
return searchField.isMouseIn(mousex, mousey);
}
@Override
public void handleKeyboardInput() {
super.handleKeyboardInput();
hasShiftKeyDown |= isShiftKeyDown();
if (hasShiftKeyDown && !Keyboard.getEventKeyState()) { // keyup
this.repo.updateView();
hasShiftKeyDown = false;
}
}
public IDisplayRepo getRepo() {
return this.repo;
}
}
@@ -13,17 +13,11 @@ 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 {
@@ -67,34 +61,4 @@ public class ContainerFluidCraftConfirm extends ContainerCraftConfirm {
originalGui);
}
}
@Override
public void optimizePatterns() {
// only V2 supported
IGrid grid = Ae2Reflect.getGrid(this);
ICraftingJob result = Ae2Reflect.getResult(this);
if (result instanceof CraftingJobV2 && !this.isSimulation()
&& grid != null
&& !grid.getMachines(TilePatternOptimizationMatrix.class).isEmpty()) {
final IActionHost ah = this.getActionHost();
if (ah instanceof IWirelessTerminal) {
InventoryHandler.openGui(
this.getInventoryPlayer().player,
getWorld(),
new BlockPos(((IWirelessTerminal) ah).getInventorySlot(), 0, 0),
ForgeDirection.UNKNOWN,
GuiType.FLUID_OPTIMIZE_PATTERNS_ITEM);
} else if (this.getOpenContext() != null) {
InventoryHandler.openGui(
this.getInventoryPlayer().player,
getWorld(),
new BlockPos(this.getOpenContext().getTile()),
Objects.requireNonNull(this.getOpenContext().getSide()),
GuiType.FLUID_OPTIMIZE_PATTERNS);
}
if (this.getPlayerInv().player.openContainer instanceof ContainerOptimizePatterns cop) {
cop.setResult(result);
}
}
}
}
@@ -20,7 +20,7 @@ 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.network.SPacketMEFluidInvUpdate;
import com.glodblock.github.util.Util;
import appeng.api.AEApi;
@@ -143,9 +143,11 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
toSend.add(is);
}
}
SPacketMEFluidInvUpdate piu = new SPacketMEFluidInvUpdate();
piu.addAll(toSend);
for (final Object c : this.crafters) {
if (c instanceof EntityPlayerMP) {
SPacketMEUpdateBuffer.scheduleFluidUpdate((EntityPlayerMP) c, toSend);
FluidCraft.proxy.netHandler.sendTo(piu, (EntityPlayerMP) c);
}
}
this.fluids.resetStatus();
@@ -160,7 +162,9 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
for (final IAEFluidStack is : monitorCache) {
toSend.add(is);
}
SPacketMEUpdateBuffer.scheduleFluidUpdate((EntityPlayerMP) c, toSend);
SPacketMEFluidInvUpdate piu = new SPacketMEFluidInvUpdate();
piu.addAll(toSend);
FluidCraft.proxy.netHandler.sendTo(piu, (EntityPlayerMP) c);
}
}
@@ -314,15 +318,8 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
}
// 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 emptiedTanks = (int) (totalInserted / fluidPerContainer);
final int partialDrain = (int) (totalInserted % fluidPerContainer);
final int partialTanks = partialDrain > 0 && partialInsertSupported ? 1 : 0;
final int usedTanks = emptiedTanks + partialTanks;
final int untouchedTanks = targetStack.stackSize - usedTanks;
@@ -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);
}
}
}
@@ -23,7 +23,6 @@ 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;
@@ -157,7 +156,7 @@ public class ContainerFluidStorageBus extends FCContainerFluidConfigurable {
Iterator<IAEFluidStack> i = new NullIterator<>();
if (cellInv != null) {
final IItemList<IAEFluidStack> list = cellInv
.getAvailableItems(AEApi.instance().storage().createFluidList(), IterationCounter.fetchNewId());
.getAvailableItems(AEApi.instance().storage().createFluidList());
i = list.iterator();
}
@@ -9,8 +9,9 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraftforge.common.util.ForgeDirection;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.base.FCContainerMonitor;
import com.glodblock.github.network.SPacketMEUpdateBuffer;
import com.glodblock.github.network.SPacketMEItemInvUpdate;
import appeng.api.AEApi;
import appeng.api.implementations.tiles.IViewCellStorage;
@@ -105,9 +106,11 @@ public class ContainerItemMonitor extends FCContainerMonitor<IAEItemStack> {
toSend.add(is);
}
}
SPacketMEItemInvUpdate piu = new SPacketMEItemInvUpdate();
piu.addAll(toSend);
for (final Object c : this.crafters) {
if (c instanceof EntityPlayer) {
SPacketMEUpdateBuffer.scheduleItemUpdate((EntityPlayerMP) c, toSend);
FluidCraft.proxy.netHandler.sendTo(piu, (EntityPlayerMP) c);
}
}
this.items.resetStatus();
@@ -122,7 +125,9 @@ public class ContainerItemMonitor extends FCContainerMonitor<IAEItemStack> {
for (final IAEItemStack is : monitorCache) {
toSend.add(is);
}
SPacketMEUpdateBuffer.scheduleItemUpdate((EntityPlayerMP) c, toSend);
SPacketMEItemInvUpdate piu = new SPacketMEItemInvUpdate();
piu.addAll(toSend);
FluidCraft.proxy.netHandler.sendTo(piu, (EntityPlayerMP) c);
}
}
@@ -131,9 +136,6 @@ public class ContainerItemMonitor extends FCContainerMonitor<IAEItemStack> {
super.removeCraftingFromCrafters(c);
if (this.crafters.isEmpty() && this.monitor != null) {
this.monitor.removeListener(this);
if (c instanceof EntityPlayerMP) {
SPacketMEUpdateBuffer.clear((EntityPlayerMP) c);
}
}
}
@@ -0,0 +1,94 @@
package com.glodblock.github.client.gui.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import com.glodblock.github.client.gui.container.base.FCBaseContainer;
import com.glodblock.github.common.item.ItemMagnetCard;
import com.glodblock.github.inventory.item.IItemTerminal;
import com.glodblock.github.inventory.item.IWirelessMagnetCardFilter;
import appeng.api.storage.ITerminalHost;
import appeng.container.guisync.GuiSync;
import appeng.container.slot.AppEngSlot;
import appeng.container.slot.IOptionalSlotHost;
import appeng.container.slot.SlotFake;
import appeng.container.slot.SlotPatternOutputs;
import appeng.util.Platform;
public class ContainerMagnet extends FCBaseContainer implements IOptionalSlotHost {
@GuiSync(101)
public ItemMagnetCard.ListMode listMode;
@GuiSync(102)
public boolean nbt;
@GuiSync(103)
public boolean meta;
@GuiSync(104)
public boolean ore;
protected SlotFake[] filterSlots;
protected final IInventory filter;
public ContainerMagnet(InventoryPlayer ip, ITerminalHost monitorable) {
super(ip, monitorable);
this.filter = ((IItemTerminal) monitorable).getInventoryByName("config");
this.filterSlots = new SlotFake[27];
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));
}
}
bindPlayerInventory(ip, 0, 126);
}
@Override
protected boolean isWirelessTerminal() {
return true;
}
@Override
public ItemStack transferStackInSlot(EntityPlayer p, int idx) {
AppEngSlot clickSlot = (AppEngSlot) this.inventorySlots.get(idx);
if (clickSlot == null || !clickSlot.getHasStack()) return null;
ItemStack tis = clickSlot.getStack();
for (SlotFake slot : this.filterSlots) {
if (!slot.getHasStack()) {
slot.putStack(tis);
detectAndSendChanges();
break;
}
}
return super.transferStackInSlot(p, idx);
}
@Override
public void detectAndSendChanges() {
if (Platform.isServer() && this.getPortableCell() instanceof IWirelessMagnetCardFilter) {
IWirelessMagnetCardFilter host = (IWirelessMagnetCardFilter) this.getHost();
this.listMode = host.getListMode();
this.meta = host.getMetaMode();
this.nbt = host.getNBTMode();
this.ore = host.getOreMode();
}
super.detectAndSendChanges();
}
@Override
public boolean isSlotEnabled(int idx) {
return true;
}
}
@@ -2,33 +2,46 @@ package com.glodblock.github.client.gui.container.base;
import net.minecraft.entity.player.InventoryPlayer;
import com.glodblock.github.common.item.ItemMagnetCard;
import com.glodblock.github.inventory.item.IFluidPortableCell;
import com.glodblock.github.inventory.item.IItemTerminal;
import com.glodblock.github.inventory.item.IWirelessExtendCard;
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;
protected ITerminalHost host;
private int slot = -1;
private final InventoryPlayer ip;
@GuiSync(105)
public boolean restock = false;
@GuiSync(106)
public ItemMagnetCard.Mode mode = ItemMagnetCard.Mode.Off;
@GuiSync(107)
public boolean sync = true;
public FCBaseContainer(InventoryPlayer ip, ITerminalHost monitorable) {
super(ip, monitorable);
this.ip = ip;
this.host = monitorable;
if (isWirelessTerminal()) {
host = (IFluidPortableCell) monitorable;
this.slot = lockSlot();
}
}
private int lockSlot() {
if (isWirelessTerminal()) {
if (this.host != null) {
final int slotIndex = this.host.getInventorySlot();
if (this.host instanceof IFluidPortableCell ifpc) {
final int slotIndex = ifpc.getInventorySlot();
if (Util.GuiHelper.decodeInvType(slotIndex).getLeft() == Util.GuiHelper.InvType.PLAYER_INV) {
this.lockPlayerInventorySlot(slotIndex);
}
@@ -44,13 +57,22 @@ public abstract class FCBaseContainer extends AEBaseContainer {
public void detectAndSendChanges() {
if (isWirelessTerminal()) {
this.ticks = Util.drainItemPower(
this.ticks = Util.Wireless.drainItemPower(
this,
this.getPlayerInv(),
this.slot,
this.ticks,
this.getPowerMultiplier(),
this.host);
((IFluidPortableCell) this.host));
}
if (Platform.isServer()) {
if (this.host instanceof IWirelessExtendCard iwec) {
this.mode = iwec.getMagnetCardMode();
this.restock = iwec.isRestock();
}
if (this.host != null && this.host instanceof IItemTerminal iwt) {
this.sync = iwt.getSyncData();
}
}
super.detectAndSendChanges();
}
@@ -59,4 +81,15 @@ public abstract class FCBaseContainer extends AEBaseContainer {
return this.powerMultiplier;
}
public ITerminalHost getHost() {
return this.host;
}
public IFluidPortableCell getPortableCell() {
if (this.host instanceof IFluidPortableCell ifpc) {
return ifpc;
} else {
return null;
}
}
}
@@ -11,7 +11,6 @@ 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;
@@ -44,13 +43,13 @@ public abstract class FCContainerMonitor<T extends IAEStack<T>> extends FCBaseCo
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 boolean forceSync = true;
protected IConfigManagerHost gui;
protected IConfigManager serverCM;
@@ -105,7 +104,10 @@ public abstract class FCContainerMonitor<T extends IAEStack<T>> extends FCBaseCo
}
}
}
processItemList();
if (sync || forceSync) {
forceSync = false;
processItemList();
}
this.updatePowerStatus();
final boolean oldAccessible = this.canAccessViewCells;
this.canAccessViewCells = this.host instanceof WirelessTerminalGuiObject
@@ -166,10 +168,6 @@ public abstract class FCContainerMonitor<T extends IAEStack<T>> extends FCBaseCo
super.onContainerClosed(player);
if (this.monitor != null) {
this.monitor.removeListener(this);
if (player instanceof EntityPlayerMP && Platform.isServer()) {
SPacketMEUpdateBuffer.clear((EntityPlayerMP) player);
}
}
}
@@ -230,7 +228,4 @@ public abstract class FCContainerMonitor<T extends IAEStack<T>> extends FCBaseCo
}
}
public ITerminalHost getHost() {
return this.host;
}
}
@@ -0,0 +1,85 @@
package com.glodblock.github.client.gui.widget;
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;
public class FCGuiBaseButton extends GuiButton {
// copy from wct button
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,4 +1,4 @@
package com.glodblock.github.client.gui;
package com.glodblock.github.client.gui.widget;
import net.minecraft.client.gui.FontRenderer;
@@ -1,4 +1,4 @@
package com.glodblock.github.client.gui;
package com.glodblock.github.client.gui.widget;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiTextField;
@@ -1,4 +1,4 @@
package com.glodblock.github.client.gui;
package com.glodblock.github.client.gui.widget;
import java.util.HashMap;
import java.util.Map;
@@ -66,6 +66,16 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
this.registerApp(22, "SWITCH", "DISABLE", "disable");
this.registerApp(23, "CONFIG", "YES", "open_configuration");
this.registerApp(24, "HIGHLIGHT", "YES", "block_highlight");
this.registerApp(30, "MAGNET_CARD", "INV", "magnet_card.inv");
this.registerApp(30, "MAGNET_CARD", "ME", "magnet_card.me");
this.registerApp(30, "MAGNET_CARD", "FILTER", "magnet_card.filter");
this.registerApp(31, "MAGNET_CARD", "OFF", "magnet_card.off");
this.registerApp(32, "DATA_SYNC", "ENABLE", "data_sync.enable");
this.registerApp(33, "ENABLE_12x", "ENABLE", "enable");
this.registerApp(34, "DISABLE_12x", "DISABLE", "disable");
this.registerApp(35, "DATA_SYNC", "DISABLE", "data_sync.disable");
this.registerApp(36, "RESTOCK", "ENABLE", "restock.on");
this.registerApp(37, "RESTOCK", "DISABLE", "restock.off");
}
}
@@ -29,7 +29,7 @@ public class EssentiaRepo extends FluidRepo {
@Override
public void updateView() {
this.view.clear();
if (needUpdateView()) this.view.clear();
this.dsp.clear();
this.view.ensureCapacity(this.list.size());
@@ -58,7 +58,7 @@ public class EssentiaRepo extends FluidRepo {
}
}
for (IAEItemStack is : this.list) {
for (IAEItemStack is : needUpdateView() ? this.list : this.cache) {
if (this.myPartitionList != null) {
if (!this.myPartitionList.isListed(is)) {
continue;
@@ -87,26 +87,30 @@ public class EssentiaRepo extends FluidRepo {
this.view.add(is);
}
}
if (needUpdateView()) {
final Enum<?> SortBy = this.sortSrc.getSortBy();
final Enum<?> SortDir = this.sortSrc.getSortDir();
final Enum<?> SortBy = this.sortSrc.getSortBy();
final Enum<?> SortDir = this.sortSrc.getSortDir();
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
FluidSorters.init();
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);
if (SortBy == SortOrder.MOD) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_MOD);
} else if (SortBy == SortOrder.AMOUNT) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_SIZE);
} else if (SortBy == SortOrder.INVTWEAKS) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
} else {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_NAME);
}
} else {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_NAME);
this.cache.clear();
}
for (final IAEItemStack is : this.view) {
this.dsp.add(is.getItemStack());
}
this.lastSearchString = this.searchString;
Iterator<IAEItemStack> it1 = this.view.iterator();
while (it1.hasNext()) {
IAEFluidStack fluid = ItemFluidDrop.getAeFluidStack(it1.next());
@@ -10,6 +10,8 @@
package com.glodblock.github.client.me;
import static net.minecraft.client.gui.GuiScreen.isShiftKeyDown;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
@@ -45,12 +47,14 @@ public class FluidRepo implements IDisplayRepo {
protected final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
protected final ArrayList<IAEItemStack> view = new ArrayList<>();
protected final ArrayList<ItemStack> dsp = new ArrayList<>();
protected final ArrayList<IAEItemStack> cache = new ArrayList<>();
protected final IScrollSource src;
protected final ISortSource sortSrc;
protected int rowSize = 9;
protected String searchString = "";
protected String lastSearchString = "";
protected IPartitionList<IAEItemStack> myPartitionList;
private String NEIWord = null;
private boolean hasPower;
@@ -86,11 +90,19 @@ public class FluidRepo implements IDisplayRepo {
if (st != null) {
st.reset();
st.add(is);
if (isShiftKeyDown() && this.view.contains(st)) {
this.view.get(this.view.indexOf(st)).setStackSize(st.getStackSize());
}
} else {
if (isShiftKeyDown()) this.cache.add(is);
this.list.add(is);
}
}
protected boolean needUpdateView() {
return !isShiftKeyDown() || !this.lastSearchString.equals(this.searchString);
}
@Override
public void setViewCell(final ItemStack[] list) {
this.myPartitionList = ItemViewCell.createFilter(list);
@@ -99,7 +111,7 @@ public class FluidRepo implements IDisplayRepo {
@Override
public void updateView() {
this.view.clear();
if (needUpdateView()) this.view.clear();
this.dsp.clear();
this.view.ensureCapacity(this.list.size());
@@ -130,7 +142,7 @@ public class FluidRepo implements IDisplayRepo {
}
}
for (IAEItemStack is : this.list) {
for (IAEItemStack is : needUpdateView() ? this.list : this.cache) {
if (this.myPartitionList != null) {
if (!this.myPartitionList.isListed(is)) {
continue;
@@ -167,26 +179,30 @@ public class FluidRepo implements IDisplayRepo {
}
}
}
if (needUpdateView()) {
final Enum<?> SortBy = this.sortSrc.getSortBy();
final Enum<?> SortDir = this.sortSrc.getSortDir();
final Enum<?> SortBy = this.sortSrc.getSortBy();
final Enum<?> SortDir = this.sortSrc.getSortDir();
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
FluidSorters.init();
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);
if (SortBy == SortOrder.MOD) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_MOD);
} else if (SortBy == SortOrder.AMOUNT) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_SIZE);
} else if (SortBy == SortOrder.INVTWEAKS) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
} else {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_NAME);
}
} else {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_NAME);
this.cache.clear();
}
for (final IAEItemStack is : this.view) {
this.dsp.add(is.getItemStack());
}
this.lastSearchString = this.searchString;
}
protected void updateNEI(final String filter) {
@@ -8,6 +8,8 @@ import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import org.lwjgl.opengl.GL11;
import com.glodblock.github.common.block.BlockFluidBuffer;
import com.glodblock.github.common.tile.TileFluidBuffer;
@@ -36,6 +38,8 @@ public class RenderBlockFluidBuffer extends BaseBlockRender<BlockFluidBuffer, Ti
if (tileEntity != null && tileEntity.getFluidStack() != null) {
Fluid storedFluid = tileEntity.getFluidStack().getFluid();
if (storedFluid != null) {
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
Block id = Block.getBlockById(FluidRegistry.WATER.getID());
IIcon fluidIcon = storedFluid.getIcon();
if (fluidIcon == null) fluidIcon = FluidRegistry.LAVA.getIcon();
@@ -56,6 +60,7 @@ public class RenderBlockFluidBuffer extends BaseBlockRender<BlockFluidBuffer, Ti
renderer.renderFaceXNeg(id, x, y, z, fluidIcon);
tessellator.setNormal(1.0F, 0.0F, 0.0F);
renderer.renderFaceXPos(id, x, y, z, fluidIcon);
GL11.glDisable(GL11.GL_BLEND);
}
}
}
@@ -15,10 +15,9 @@ public class Config {
public static boolean noFluidPacket;
public static boolean fluidIOBus;
public static boolean removeRecipe;
public static boolean testItemRecipe;
public static double portableCellBattery;
public static boolean fluidP2PInterface;
public static int packetSize;
public static int packetRate;
public static boolean replaceEC2;
public static int levelMaintainerMinTicks;
public static int levelMaintainerMaxTicks;
@@ -56,13 +55,8 @@ public class Config {
"Disable all recipes, for quick tweaker.");
portableCellBattery = Config.get("Fluid Craft for AE2", "Portable Fluid Cell Battery Capacity", 20000D)
.getDouble();
packetSize = Config.get("Fluid Craft for AE2", "packetSize", 256, "Number of items to be sent per packet")
.getInt();
if (packetSize <= 0) packetSize = 256;
packetRate = Config
.get("Fluid Craft for AE2", "packetRate", 50, "Period at which packets are dispatched, in ms.")
.getInt();
if (packetRate <= 0) packetRate = 50;
testItemRecipe = Config.get("Fluid Craft for AE2", "Experimental items", true, "Experimental items")
.getBoolean();
replaceEC2 = Config.getBoolean(
"replaceEC2",
"Fluid Craft for AE2",
@@ -37,7 +37,6 @@ import appeng.items.AEBaseItem;
import appeng.items.contents.CellConfig;
import appeng.items.contents.CellUpgrades;
import appeng.util.InventoryAdaptor;
import appeng.util.IterationCounter;
import appeng.util.Platform;
import appeng.util.ReadableNumberConverter;
@@ -225,8 +224,7 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
.getCellInventory(stack, null, StorageChannel.FLUIDS);
if (inv != null && playerInventory.getCurrentItem() == stack) {
final InventoryAdaptor ia = InventoryAdaptor.getAdaptor(player, ForgeDirection.UNKNOWN);
final IItemList<IAEFluidStack> list = inv
.getAvailableItems(StorageChannel.FLUIDS.createList(), IterationCounter.fetchNewId());
final IItemList<IAEFluidStack> list = inv.getAvailableItems(StorageChannel.FLUIDS.createList());
if (list.isEmpty() && ia != null) {
playerInventory.setInventorySlotContents(playerInventory.currentItem, null);
@@ -15,22 +15,35 @@ import com.glodblock.github.common.storage.IStorageFluidCell;
import com.glodblock.github.util.NameConst;
import appeng.api.AEApi;
import appeng.api.config.FuzzyMode;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.items.AEBaseItem;
import appeng.items.contents.CellUpgrades;
import appeng.tile.inventory.AppEngInternalInventory;
public abstract class ItemBaseInfinityStorageCell extends AEBaseItem implements IStorageFluidCell {
protected static class InfinityConfig extends AppEngInternalInventory {
public InfinityConfig(final ItemStack is) {
super(null, 1);
this.setInventorySlotContents(0, is);
}
@Override
public void markDirty() {}
}
@Override
public long getBytes(ItemStack cellItem) {
return 0;
return Integer.MAX_VALUE;
}
@Override
public int getBytesPerType(ItemStack cellItem) {
return 0;
return 1;
}
@Override
@@ -39,6 +52,9 @@ public abstract class ItemBaseInfinityStorageCell extends AEBaseItem implements
|| FluidCraftAPI.instance().isBlacklistedInStorage(requestedAddition.getFluid().getClass());
}
@Override
public abstract IInventory getConfigInventory(ItemStack is);
@Override
public boolean storableInStorageCell() {
return false;
@@ -59,11 +75,26 @@ public abstract class ItemBaseInfinityStorageCell extends AEBaseItem implements
return 0;
}
@Override
public boolean isEditable(ItemStack is) {
return false;
}
@Override
public IInventory getUpgradesInventory(ItemStack is) {
return new CellUpgrades(is, 0);
}
@Override
public FuzzyMode getFuzzyMode(ItemStack is) {
return null;
}
@Override
public void setFuzzyMode(ItemStack is, FuzzyMode fzMode) {
}
@Override
public void addCheckedInformation(final ItemStack stack, final EntityPlayer player, final List<String> lines,
final boolean displayMoreInfo) {
@@ -78,7 +109,7 @@ public abstract class ItemBaseInfinityStorageCell extends AEBaseItem implements
lines.add(StatCollector.translateToLocal(NameConst.TT_CELL_CONTENTS));
for (IAEFluidStack fluid : cellInventory.getContents()) {
if (fluid != null) {
lines.add(String.format(" %s %s", StatCollector.translateToLocal(NameConst.TT_INFINITY_FLUID_STORAGE_TIPS), fluid.getFluidStack().getLocalizedName()));
lines.add(String.format(" %s", fluid.getFluidStack().getLocalizedName()));
}
}
} else {
@@ -89,5 +120,4 @@ public abstract class ItemBaseInfinityStorageCell extends AEBaseItem implements
}
}
}
}
@@ -1,15 +1,18 @@
package com.glodblock.github.common.item;
import static com.glodblock.github.loader.recipe.WirelessTerminalEnergyRecipe.getEnergyCard;
import static com.glodblock.github.loader.recipe.WirelessTerminalRecipe.getInfinityBoosterCard;
import static com.glodblock.github.util.Util.DimensionalCoordSide.hasEnergyCard;
import static com.glodblock.github.util.Util.hasInfinityBoosterCard;
import static com.glodblock.github.loader.recipe.WirelessTerminalInfinityBoosterRecipe.getInfinityBoosterCard;
import static com.glodblock.github.loader.recipe.WirelessTerminalMagnetRecipe.getMagnetCard;
import static com.glodblock.github.util.Util.Wireless.hasEnergyCard;
import static com.glodblock.github.util.Util.Wireless.hasInfinityBoosterCard;
import static com.glodblock.github.util.Util.Wireless.hasMagnetCard;
import java.util.List;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@@ -35,19 +38,39 @@ public class ItemBaseWirelessTerminal extends ToolWirelessTerminal implements II
protected GuiType type;
public static String infinityBoosterCard = "infinityBoosterCard";
public static String magnetCard = "magnetCard";
public static String restockItems = "restock";
public static String infinityEnergyCard = "InfinityEnergyCard";
public static String syncData = "syncData";
private static boolean effect = false;
public ItemBaseWirelessTerminal(GuiType t) {
super();
this.type = t;
}
public static void setEffect(boolean e) {
effect = e;
}
public static boolean getEffect() {
return effect;
}
@Override
public boolean hasEffect(ItemStack par1ItemStack, int pass) {
if (Platform.isClient()) {
return getEffect();
}
return super.hasEffect(par1ItemStack, pass);
}
@Override
public ItemStack onItemRightClick(final ItemStack item, final World w, final EntityPlayer player) {
if (player.isSneaking()) return removeInfinityBoosterCard(player, item); // todo: doesn't work in universal
// terminal
if (player.isSneaking()) return removeInfinityBoosterCard(player, item);
if (ForgeEventFactory.onItemUseStart(player, item, 1) > 0) {
if (Platform.isClient()) {
setEffect(false);
return item;
}
IWirelessTermRegistry term = AEApi.instance().registries().wireless();
@@ -92,6 +115,21 @@ public class ItemBaseWirelessTerminal extends ToolWirelessTerminal implements II
return is;
}
private ItemStack removeMagnetCard(final EntityPlayer player, ItemStack is) {
if (hasMagnetCard(is)) {
if (!player.inventory.addItemStackToInventory(getMagnetCard())) {
player.entityDropItem(getMagnetCard(), 0);
}
is.getTagCompound().setBoolean(magnetCard, false);
}
return is;
}
public static void toggleRestockItemsMode(ItemStack is, boolean state) {
NBTTagCompound data = Platform.openNbtData(is);
data.setBoolean(restockItems, state);
}
@SideOnly(Side.CLIENT)
@Override
public void addCheckedInformation(ItemStack stack, EntityPlayer player, List<String> lines,
@@ -102,6 +140,9 @@ public class ItemBaseWirelessTerminal extends ToolWirelessTerminal implements II
if (hasInfinityBoosterCard(stack)) {
lines.add(" " + EnumChatFormatting.GOLD + getInfinityBoosterCard().getDisplayName());
}
if (hasMagnetCard(stack)) {
lines.add(" " + EnumChatFormatting.GOLD + getMagnetCard().getDisplayName());
}
if (hasEnergyCard(stack)) {
lines.add(" " + EnumChatFormatting.GOLD + getEnergyCard().getDisplayName());
}
@@ -0,0 +1,41 @@
package com.glodblock.github.common.item;
import static com.glodblock.github.util.Util.FluidUtil.lava_bucket;
import java.util.EnumSet;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.storage.IStorageFluidCell;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.loader.IRegister;
import com.glodblock.github.util.NameConst;
import appeng.core.features.AEFeature;
import cpw.mods.fml.common.registry.GameRegistry;
public class ItemInfinityLavaStorageCell extends ItemBaseInfinityStorageCell
implements IStorageFluidCell, IRegister<ItemInfinityLavaStorageCell> {
@Override
public IInventory getConfigInventory(ItemStack is) {
return new InfinityConfig(lava_bucket);
}
public ItemInfinityLavaStorageCell() {
super();
setUnlocalizedName(NameConst.ITEM_INFINITY_LAVA_FLUID_STORAGE);
setTextureName(FluidCraft.resource(NameConst.ITEM_INFINITY_FLUID_STORAGE).toString());
this.setFeature(EnumSet.of(AEFeature.StorageCells));
this.setMaxStackSize(1);
}
@Override
public ItemInfinityLavaStorageCell register() {
GameRegistry.registerItem(this, NameConst.ITEM_INFINITY_LAVA_FLUID_STORAGE, FluidCraft.MODID);
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
}
@@ -13,9 +13,7 @@ import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.loader.IRegister;
import com.glodblock.github.util.NameConst;
import appeng.api.config.FuzzyMode;
import appeng.core.features.AEFeature;
import appeng.tile.inventory.AppEngInternalInventory;
import cpw.mods.fml.common.registry.GameRegistry;
public class ItemInfinityWaterStorageCell extends ItemBaseInfinityStorageCell
@@ -26,17 +24,6 @@ public class ItemInfinityWaterStorageCell extends ItemBaseInfinityStorageCell
return new InfinityConfig(water_bucket);
}
public static class InfinityConfig extends AppEngInternalInventory {
public InfinityConfig(final ItemStack is) {
super(null, 1);
this.setInventorySlotContents(0, is);
}
@Override
public void markDirty() {}
}
public ItemInfinityWaterStorageCell() {
super();
setUnlocalizedName(NameConst.ITEM_INFINITY_WATER_FLUID_STORAGE);
@@ -51,18 +38,4 @@ public class ItemInfinityWaterStorageCell extends ItemBaseInfinityStorageCell
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
@Override
public boolean isEditable(ItemStack is) {
return false;
}
@Override
public FuzzyMode getFuzzyMode(ItemStack is) {
return FuzzyMode.IGNORE_ALL;
}
@Override
public void setFuzzyMode(ItemStack is, FuzzyMode fzMode) {}
}
@@ -0,0 +1,204 @@
package com.glodblock.github.common.item;
import static net.minecraft.client.gui.GuiScreen.isShiftKeyDown;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.tabs.FluidCraftingTabs;
import com.glodblock.github.inventory.ItemBiggerAppEngInventory;
import com.glodblock.github.inventory.item.WirelessMagnetCardFilterInventory;
import com.glodblock.github.util.NameConst;
import com.glodblock.github.util.RenderUtil;
import com.glodblock.github.util.Util;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.util.Platform;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemMagnetCard extends FCBaseItem {
public static String modeKey = "MagnetMode";
public static String filterKey = "MagnetFilter";
public static String filterConfigKey = "MagnetConfig";
public static final int distanceFromPlayer = 16;
public ItemMagnetCard() {
super();
this.setMaxStackSize(64);
this.setUnlocalizedName(NameConst.ITEM_MAGNET_CARD);
this.setTextureName(FluidCraft.resource(NameConst.ITEM_MAGNET_CARD).toString());
}
public static List<? extends Entity> getEntitiesInRange(Class<?> entityType, World world, int x, int y, int z,
int distance) {
return world.getEntitiesWithinAABB(
entityType,
AxisAlignedBB.getBoundingBox(
x - distance,
y - distance,
z - distance,
x + distance,
y + distance,
z + distance));
}
@SuppressWarnings("unchecked")
public static List<ItemStack> getFilteredItems(ItemStack wirelessTerm) {
if (wirelessTerm == null) {
return null;
}
if (wirelessTerm.getItem() instanceof ItemWirelessUltraTerminal) {
if (wirelessTerm.hasTagCompound()) {
NBTTagCompound data = Platform.openNbtData(wirelessTerm);
if (!data.hasKey(filterKey)) {
return Collections.emptyList();
}
AppEngInternalInventory filterList = new ItemBiggerAppEngInventory(wirelessTerm, filterKey, 27);
ArrayList<ItemStack> list = new ArrayList<>();
filterList.iterator().forEachRemaining(list::add);
return list;
}
}
return Collections.emptyList();
}
public static boolean isConfigured(ItemStack wirelessTerm) {
NBTTagCompound data = Platform.openNbtData(wirelessTerm);
return data.hasKey(modeKey);
}
public static void doMagnet(ItemStack wirelessTerm, World world, EntityPlayer player,
WirelessMagnetCardFilterInventory inv) {
if (Platform.isClient() || wirelessTerm == null
|| ItemMagnetCard.getMode(wirelessTerm) == Mode.Off
|| player == null
|| player.isSneaking()
|| !isConfigured(wirelessTerm))
return;
Iterator<? extends Entity> iterator = getEntitiesInRange(
EntityItem.class,
world,
(int) player.posX,
(int) player.posY,
(int) player.posZ,
distanceFromPlayer).iterator();
IItemList<IAEItemStack> filteredList = inv.getAEFilteredItems();
while (iterator.hasNext()) {
EntityItem itemToGet = (EntityItem) iterator.next();
if (itemToGet.func_145800_j() != null && itemToGet.func_145800_j().equals(player.getCommandSenderName())) {
continue;
}
EntityPlayer closestPlayer = world.getClosestPlayerToEntity(itemToGet, distanceFromPlayer);
if (closestPlayer != null && closestPlayer != player) {
continue;
}
ItemStack stack = itemToGet.getEntityItem();
if ((inv.getListMode() == ListMode.WhiteList && !filteredList.isEmpty()
&& inv.isItemFiltered(stack, filteredList))
|| (inv.getListMode() == ListMode.BlackList && !inv.isItemFiltered(stack, filteredList))) {
if (itemToGet.delayBeforeCanPickup > 0) {
itemToGet.delayBeforeCanPickup = 0;
}
itemToGet.motionX = itemToGet.motionY = itemToGet.motionZ = 0;
itemToGet.setPosition(
player.posX - 0.2 + (world.rand.nextDouble() * 0.4),
player.posY - 0.6,
player.posZ - 0.2 + (world.rand.nextDouble() * 0.4));
}
}
// xp
iterator = getEntitiesInRange(
EntityXPOrb.class,
world,
(int) player.posX,
(int) player.posY,
(int) player.posZ,
distanceFromPlayer).iterator();
while (iterator.hasNext()) {
EntityXPOrb xpToGet = (EntityXPOrb) iterator.next();
if (xpToGet.isDead || xpToGet.isInvisible()) {
continue;
}
int xpAmount = xpToGet.xpValue;
xpToGet.xpValue = 0;
player.xpCooldown = 0;
player.addExperience(xpAmount);
xpToGet.setDead();
xpToGet.setInvisible(true);
world.playSoundAtEntity(
player,
"random.orb",
0.08F,
0.5F * ((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.8F));
}
}
@Override
public ItemMagnetCard register() {
GameRegistry.registerItem(this, NameConst.ITEM_MAGNET_CARD, FluidCraft.MODID);
setCreativeTab(FluidCraftingTabs.INSTANCE);
return this;
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List toolTip, boolean flag) {
if (isShiftKeyDown()) {
toolTip.addAll(RenderUtil.listFormattedStringToWidth(NameConst.i18n(NameConst.TT_MAGNET_CARD_DESC)));
} else {
toolTip.add(NameConst.i18n(NameConst.TT_SHIFT_FOR_MORE));
}
}
public enum Mode {
Off,
Inv,
ME
}
public enum ListMode {
WhiteList,
BlackList
}
public static Mode getMode(ItemStack is) {
if (is != null && Util.Wireless.hasMagnetCard(is) && is.getItem() instanceof ItemWirelessUltraTerminal) {
NBTTagCompound data = Platform.openNbtData(is);
if (data.hasKey(modeKey)) {
return Mode.values()[data.getInteger(modeKey)];
}
setMode(is, Mode.Off);
}
return Mode.Off;
}
public static void setMode(ItemStack is, Mode mode) {
if (is != null && Util.Wireless.hasMagnetCard(is) && is.getItem() instanceof ItemWirelessUltraTerminal) {
NBTTagCompound data = Platform.openNbtData(is);
data.setInteger(modeKey, mode.ordinal());
}
}
}
@@ -41,7 +41,7 @@ public class ItemWirelessFluidTerminal extends ItemBaseWirelessTerminal
@Override
public Object getInventory(ItemStack stack, World world, int x, int y, int z, EntityPlayer player) {
try {
IGridNode gridNode = Util.getWirelessGrid(stack);
IGridNode gridNode = Util.Wireless.getWirelessGrid(stack);
return new WirelessFluidTerminalInventory(stack, x, gridNode, player);
} catch (Exception e) {
player.addChatMessage(PlayerMessages.OutOfRange.get());
@@ -41,7 +41,7 @@ public class ItemWirelessInterfaceTerminal extends ItemBaseWirelessTerminal
@Override
public Object getInventory(ItemStack stack, World world, int x, int y, int z, EntityPlayer player) {
try {
IGridNode gridNode = Util.getWirelessGrid(stack);
IGridNode gridNode = Util.Wireless.getWirelessGrid(stack);
return new WirelessInterfaceTerminalInventory(stack, x, gridNode, player);
} catch (Exception e) {
player.addChatMessage(PlayerMessages.OutOfRange.get());
@@ -41,7 +41,7 @@ public class ItemWirelessLevelTerminal extends ItemBaseWirelessTerminal
@Override
public Object getInventory(ItemStack stack, World world, int x, int y, int z, EntityPlayer player) {
try {
IGridNode gridNode = Util.getWirelessGrid(stack);
IGridNode gridNode = Util.Wireless.getWirelessGrid(stack);
return new WirelessLevelTerminalInventory(stack, x, gridNode, player);
} catch (Exception e) {
player.addChatMessage(PlayerMessages.OutOfRange.get());
@@ -41,7 +41,7 @@ public class ItemWirelessPatternTerminal extends ItemBaseWirelessTerminal
@Override
public Object getInventory(ItemStack stack, World world, int x, int y, int z, EntityPlayer player) {
try {
IGridNode gridNode = Util.getWirelessGrid(stack);
IGridNode gridNode = Util.Wireless.getWirelessGrid(stack);
return new WirelessPatternTerminalInventory(stack, x, gridNode, player);
} catch (Exception e) {
player.addChatMessage(PlayerMessages.OutOfRange.get());
@@ -25,6 +25,7 @@ import com.glodblock.github.inventory.item.WirelessCraftingTerminalInventory;
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.WirelessMagnetCardFilterInventory;
import com.glodblock.github.inventory.item.WirelessPatternTerminalExInventory;
import com.glodblock.github.inventory.item.WirelessPatternTerminalInventory;
import com.glodblock.github.loader.IRegister;
@@ -100,9 +101,11 @@ public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
@Override
public Object getInventory(ItemStack stack, World world, int x, int y, int z, EntityPlayer player) {
try {
IGridNode gridNode = Util.getWirelessGrid(stack);
IGridNode gridNode = Util.Wireless.getWirelessGrid(stack);
final GuiType gui;
if (Util.GuiHelper.decodeType(y).getLeft() == Util.GuiHelper.GuiType.ITEM && z > 0) {
if (Util.GuiHelper.decodeType(y).getLeft() == Util.GuiHelper.GuiType.ITEM && z == -1) {
gui = GuiType.WIRELESS_MAGNET_CARD_FILTER;
} else if (Util.GuiHelper.decodeType(y).getLeft() == Util.GuiHelper.GuiType.ITEM && z > 0) {
gui = getGuis().get(Util.GuiHelper.decodeType(y).getRight());
} else {
gui = readMode(stack);
@@ -121,6 +124,8 @@ public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
return new WirelessLevelTerminalInventory(stack, x, gridNode, player);
} else if (gui == GuiType.WIRELESS_FLUID_PATTERN_TERMINAL_EX) {
return new WirelessPatternTerminalExInventory(stack, x, gridNode, player);
} else if (gui == GuiType.WIRELESS_MAGNET_CARD_FILTER) {
return new WirelessMagnetCardFilterInventory(stack, x, gridNode, player);
} else {
this.setMode(GuiType.WIRELESS_FLUID_TERMINAL, stack); // set as default mode
return new WirelessFluidTerminalInventory(stack, x, gridNode, player);
@@ -179,7 +184,7 @@ public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
}
public static void switchTerminal(EntityPlayer player, GuiType guiType) {
ImmutablePair<Integer, ItemStack> term = Util.getUltraWirelessTerm(player);
ImmutablePair<Integer, ItemStack> term = Util.Wireless.getUltraWirelessTerm(player);
if (term == null) return;
if (term.getRight().getItem() instanceof ItemWirelessUltraTerminal) {
((ItemWirelessUltraTerminal) term.getRight().getItem()).setMode(guiType, term.getRight());
@@ -202,10 +207,10 @@ public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
}
public static boolean hasInfinityBoosterCard(EntityPlayer player) {
ImmutablePair<Integer, ItemStack> term = Util.getUltraWirelessTerm(player);
ImmutablePair<Integer, ItemStack> term = Util.Wireless.getUltraWirelessTerm(player);
if (term == null) return false;
if (term.getRight().getItem() instanceof ItemWirelessUltraTerminal) {
return Util.hasInfinityBoosterCard(term.getRight());
return Util.Wireless.hasInfinityBoosterCard(term.getRight());
}
return false;
}
@@ -190,11 +190,6 @@ public class PartFluidLevelEmitter extends PartUpgradeable implements IStackWatc
if (this.myWatcher != null && myStack != null) {
this.myWatcher.add(myStack);
}
if (myStack == null) {
this.getProxy().getStorage().getFluidInventory().addListener(this, this.getProxy().getGrid());
}
this.updateReportingValue(this.getProxy().getStorage().getFluidInventory());
} catch (final GridAccessException ignored) {}
}
@@ -1,12 +1,8 @@
package com.glodblock.github.common.parts;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.function.Predicate;
import javax.annotation.Nullable;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.entity.player.EntityPlayer;
@@ -15,13 +11,16 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Vec3;
import net.minecraftforge.fluids.IFluidHandler;
import com.glodblock.github.client.textures.FCPartsTexture;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.common.tile.TileFluidInterface;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.MEMonitorIFluidHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.util.BlockPos;
import com.glodblock.github.util.ModAndClassUtil;
import appeng.api.AEApi;
import appeng.api.config.AccessRestriction;
@@ -30,7 +29,6 @@ import appeng.api.config.IncludeExclude;
import appeng.api.config.Settings;
import appeng.api.config.StorageFilter;
import appeng.api.config.Upgrades;
import appeng.api.config.YesNo;
import appeng.api.networking.IGridNode;
import appeng.api.networking.events.MENetworkCellArrayUpdate;
import appeng.api.networking.events.MENetworkChannelsChanged;
@@ -44,6 +42,7 @@ import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.ITickManager;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPart;
import appeng.api.parts.IPartCollisionHelper;
import appeng.api.parts.IPartRenderHelper;
import appeng.api.storage.ICellContainer;
@@ -66,12 +65,13 @@ import appeng.me.storage.MEInventoryHandler;
import appeng.parts.automation.PartUpgradeable;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.tile.inventory.InvOperation;
import appeng.util.IterationCounter;
import appeng.tile.networking.TileCableBus;
import appeng.util.Platform;
import appeng.util.item.AEFluidStack;
import appeng.util.prioitylist.PrecisePriorityList;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import extracells.tileentity.TileEntityFluidInterface;
public class PartFluidStorageBus extends PartUpgradeable
implements IGridTickable, ICellContainer, IMEMonitorHandlerReceiver<IAEFluidStack>, IPriorityHost {
@@ -85,17 +85,14 @@ public class PartFluidStorageBus extends PartUpgradeable
private int handlerHash = 0;
private boolean wasActive = false;
private byte resetCacheLogic = 0;
/**
* used to read changes once when the list of extractable items was changed
*/
private boolean readOncePass = false;
private boolean accessChanged;
private boolean readOncePass;
public PartFluidStorageBus(ItemStack is) {
super(is);
this.getConfigManager().registerSetting(Settings.ACCESS, AccessRestriction.READ_WRITE);
this.getConfigManager().registerSetting(Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL);
this.getConfigManager().registerSetting(Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY);
this.getConfigManager().registerSetting(Settings.STICKY_MODE, YesNo.NO);
this.source = new MachineSource(this);
}
@@ -131,6 +128,9 @@ public class PartFluidStorageBus extends PartUpgradeable
@Override
public void updateSetting(final IConfigManager manager, final Enum settingName, final Enum newValue) {
if (settingName.name().equals("ACCESS")) {
this.accessChanged = true;
}
this.resetCache(true);
this.getHost().markForSave();
}
@@ -146,6 +146,7 @@ public class PartFluidStorageBus extends PartUpgradeable
super.readFromNBT(data);
this.config.readFromNBT(data, "config");
this.priority = data.getInteger("priority");
this.accessChanged = false;
}
@Override
@@ -198,7 +199,18 @@ public class PartFluidStorageBus extends PartUpgradeable
final MEInventoryHandler<IAEFluidStack> in = this.getInternalHandler();
IItemList<IAEFluidStack> before = AEApi.instance().storage().createFluidList();
if (in != null) {
before = in.getAvailableItems(before, IterationCounter.fetchNewId());
if (accessChanged) {
AccessRestriction currentAccess = (AccessRestriction) this.getConfigManager()
.getSetting(Settings.ACCESS);
if (!currentAccess.hasPermission(AccessRestriction.READ)) {
readOncePass = true;
}
before = in.getAvailableItems(before);
in.setBaseAccess(currentAccess);
accessChanged = false;
} else {
before = in.getAvailableItems(before);
}
}
this.cached = false;
@@ -207,15 +219,11 @@ public class PartFluidStorageBus extends PartUpgradeable
}
final MEInventoryHandler<IAEFluidStack> out = this.getInternalHandler();
if (this.monitor != null) {
this.monitor.onTick();
}
IItemList<IAEFluidStack> after = AEApi.instance().storage().createFluidList();
if (in != out) {
if (out != null) {
after = out.getAvailableItems(after, IterationCounter.fetchNewId());
after = out.getAvailableItems(after);
}
Platform.postListChanges(before, after, this, this.source);
}
@@ -229,46 +237,23 @@ public class PartFluidStorageBus extends PartUpgradeable
@Override
public void postChange(final IBaseMonitor<IAEFluidStack> monitor, final Iterable<IAEFluidStack> change,
final BaseActionSource source) {
try {
if (this.getProxy().isActive()) {
if (!this.readOncePass) {
AccessRestriction currentAccess = (AccessRestriction) this.getConfigManager()
.getSetting(Settings.ACCESS);
if (!currentAccess.hasPermission(AccessRestriction.READ)) {
return;
}
}
Iterable<IAEFluidStack> filteredChanges = this.filterChanges(change, this.readOncePass);
this.readOncePass = false;
if (filteredChanges == null) return;
this.getProxy().getStorage()
.postAlterationOfStoredItems(StorageChannel.FLUIDS, filteredChanges, this.source);
if (this.getProxy().isActive()) {
AccessRestriction currentAccess = (AccessRestriction) this.getConfigManager().getSetting(Settings.ACCESS);
if (readOncePass) {
readOncePass = false;
try {
this.getProxy().getStorage()
.postAlterationOfStoredItems(StorageChannel.FLUIDS, change, this.source);
} catch (final GridAccessException ignore) {}
return;
}
} catch (final GridAccessException ignore) {}
}
/**
* Filters the changes to only include fluids that pass the handlers extract filter. Will return null if none of the
* changes match the filter.
*/
@Nullable
private Iterable<IAEFluidStack> filterChanges(final Iterable<IAEFluidStack> change, final boolean readOncePass) {
if (readOncePass) {
return change;
}
if (this.handler != null && this.handler.isExtractFilterActive()
&& !this.handler.getExtractPartitionList().isEmpty()) {
List<IAEFluidStack> filteredChanges = new ArrayList<>();
Predicate<IAEFluidStack> extractFilterCondition = this.handler.getExtractFilterCondition();
for (final IAEFluidStack changedFluid : change) {
if (extractFilterCondition.test(changedFluid)) {
filteredChanges.add(changedFluid);
}
if (!currentAccess.hasPermission(AccessRestriction.READ)) {
return;
}
return filteredChanges.isEmpty() ? null : Collections.unmodifiableList(filteredChanges);
try {
this.getProxy().getStorage().postAlterationOfStoredItems(StorageChannel.FLUIDS, change, source);
} catch (final GridAccessException ignore) {}
}
return change;
}
@Override
@@ -285,7 +270,38 @@ public class PartFluidStorageBus extends PartUpgradeable
@Override
public void onNeighborChanged() {
this.resetCache(false);
TileEntity tile = this.getTile();
if (tile == null || this.getProxy() == null || !this.getProxy().isActive()) return;
BlockPos neighbor = new BlockPos(tile).getOffSet(this.getSide());
final TileEntity te = neighbor.getTileEntity();
// In case the TE was destroyed, we have to do a full reset immediately.
if (te instanceof TileCableBus) {
IPart iPart = ((TileCableBus) te).getPart(this.getSide().getOpposite());
if (iPart == null || iPart instanceof PartFluidInterface) {
this.resetCache(true);
this.resetCache();
}
if (ModAndClassUtil.EC2) {
if (iPart == null || iPart instanceof extracells.part.PartFluidInterface) {
this.resetCache(true);
this.resetCache();
}
}
} else if (te == null || te instanceof TileFluidInterface) {
this.resetCache(true);
this.resetCache();
} else if (ModAndClassUtil.EC2) {
if (te instanceof TileEntityFluidInterface) {
this.resetCache(true);
this.resetCache();
}
} else if (te instanceof IFluidHandler) {
this.resetCache(true);
this.resetCache();
} else {
this.resetCache(false);
}
}
@Override
@@ -338,7 +354,6 @@ public class PartFluidStorageBus extends PartUpgradeable
this.handlerHash = newHandlerHash;
this.handler = null;
this.monitor = null;
this.readOncePass = true;
if (target != null) {
final IExternalStorageHandler esh = AEApi.instance().registries().externalStorage()
.getHandler(target, this.getSide().getOpposite(), StorageChannel.FLUIDS, this.source);
@@ -348,21 +363,15 @@ public class PartFluidStorageBus extends PartUpgradeable
if (inv instanceof final MEMonitorIFluidHandler h) {
h.setMode((StorageFilter) this.getConfigManager().getSetting(Settings.STORAGE_FILTER));
h.setActionSource(new MachineSource(this));
this.monitor = h;
this.monitor = (MEMonitorIFluidHandler) inv;
}
if (inv != null) {
this.handler = new MEInventoryHandler(inv, StorageChannel.FLUIDS);
AccessRestriction currentAccess = (AccessRestriction) this.getConfigManager().getSetting(Settings.ACCESS);
this.handler.setBaseAccess(currentAccess);
this.handler.setBaseAccess((AccessRestriction) this.getConfigManager().getSetting(Settings.ACCESS));
this.handler.setWhitelist(
this.getInstalledUpgrades(Upgrades.INVERTER) > 0 ? IncludeExclude.BLACKLIST
: IncludeExclude.WHITELIST);
this.handler.setSticky(this.getInstalledUpgrades(Upgrades.STICKY) > 0);
this.handler.setPriority(this.priority);
// only READ since READ_WRITE would break compat of existing storage buses
// could use a new setting that is applied via button or a card too
this.handler.setIsExtractFilterActive(currentAccess == AccessRestriction.READ);
if (inv instanceof IMEMonitor) {
((IBaseMonitor) inv).addListener(this, this.handler);
}
@@ -373,9 +382,7 @@ public class PartFluidStorageBus extends PartUpgradeable
final IAEItemStack is = this.config.getAEStackInSlot(x);
if (is != null) priorityList.add(AEFluidStack.create(ItemFluidPacket.getFluidStack(is)));
}
PrecisePriorityList partitionList = new PrecisePriorityList(priorityList);
this.handler.setPartitionList(partitionList);
this.handler.setExtractPartitionList(partitionList);
this.handler.setPartitionList(new PrecisePriorityList(priorityList));
}
}
}
@@ -424,6 +431,11 @@ public class PartFluidStorageBus extends PartUpgradeable
this.resetCache(true);
}
@Override
public void blinkCell(int slot) {
// NO-OP
}
@Override
public void saveChanges(final IMEInventory cellInventory) {
// NO-OP
@@ -3,10 +3,11 @@ package com.glodblock.github.common.parts;
import net.minecraft.item.ItemStack;
import com.glodblock.github.client.textures.FCPartsTexture;
import com.glodblock.github.common.parts.base.FCPart;
import com.glodblock.github.common.parts.base.FCPartBaseMonitorTerminal;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IItemTerminal;
public class PartFluidTerminal extends FCPart {
public class PartFluidTerminal extends FCPartBaseMonitorTerminal implements IItemTerminal {
private static final FCPartsTexture FRONT_BRIGHT_ICON = FCPartsTexture.PartFluidTerminal_Bright;
private static final FCPartsTexture FRONT_DARK_ICON = FCPartsTexture.PartFluidTerminal_Colored;
@@ -13,7 +13,7 @@ import com.glodblock.github.inventory.item.IItemPatternTerminal;
import appeng.api.storage.data.IAEItemStack;
import appeng.tile.inventory.AppEngInternalInventory;
public abstract class FCFluidEncodeTerminal extends FCPart implements IItemPatternTerminal {
public abstract class FCFluidEncodeTerminal extends FCPartBaseMonitorTerminal implements IItemPatternTerminal {
protected AppEngInternalInventory crafting;
protected AppEngInternalInventory output;
@@ -0,0 +1,42 @@
package com.glodblock.github.common.parts.base;
import static com.glodblock.github.common.item.ItemBaseWirelessTerminal.syncData;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import com.glodblock.github.inventory.item.IItemTerminal;
public abstract class FCPartBaseMonitorTerminal extends FCPart implements IItemTerminal {
protected boolean sync = true;
public FCPartBaseMonitorTerminal(ItemStack is) {
super(is);
}
public FCPartBaseMonitorTerminal(final ItemStack is, final boolean requireChannel) {
super(is, requireChannel);
}
@Override
public void readFromNBT(final NBTTagCompound data) {
super.readFromNBT(data);
this.setSyncData(data.getBoolean(syncData));
}
@Override
public void writeToNBT(final NBTTagCompound data) {
super.writeToNBT(data);
data.setBoolean(syncData, this.sync);
}
public void setSyncData(boolean sync) {
this.sync = sync;
}
public boolean getSyncData() {
return this.sync;
}
}
@@ -61,7 +61,7 @@ public class CreativeFluidCellInventory extends FluidCellInventory {
if (fs == null) continue;
IAEFluidStack iaeFluidStack = Util.FluidUtil.createAEFluidStack(fs);
if (this.cellFluids.findPrecise(iaeFluidStack) == null) {
iaeFluidStack.setStackSize(Integer.MAX_VALUE * 1_000_000L);
iaeFluidStack.setStackSize(Integer.MAX_VALUE * 1000L);
this.cellFluids.add(iaeFluidStack);
}
}
@@ -188,16 +188,13 @@ public class FluidCellInventory implements IFluidCellInventory {
@Override
public int getStatusForCell() {
if (this.getUsedBytes() == 0) {
if (this.canHoldNewFluid()) {
return 1;
}
if (this.canHoldNewFluid()) {
if (this.getRemainingFluidCount() > 0) {
return 2;
}
if (this.getRemainingFluidCount() > 0) {
return 3;
}
return 4;
return 3;
}
protected void loadCellFluids() {
@@ -383,7 +380,7 @@ public class FluidCellInventory implements IFluidCellInventory {
}
@Override
public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out, int iteration) {
public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out) {
for (final IAEFluidStack i : this.getCellFluids()) {
out.add(i);
}
@@ -391,7 +388,7 @@ public class FluidCellInventory implements IFluidCellInventory {
}
@Override
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request, int iteration) {
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request) {
return this.getCellFluids().findPrecise(request);
}
@@ -92,8 +92,8 @@ public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack>
public int getStatusForCell() {
int val = this.getCellInv().getStatusForCell();
if ((val == 1 || val == 2) && this.isPreformatted()) {
val = 3;
if (val == 1 && this.isPreformatted()) {
val = 2;
}
return val;
@@ -80,6 +80,11 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
// do nothing
}
@Override
public void blinkCell(int slot) {
// do nothing
}
@Override
public void gridChanged() {
IMEMonitor<IAEFluidStack> fluidGrid = getFluidGrid();
@@ -189,7 +194,7 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
}
@Override
public IItemList<IAEItemStack> getAvailableItems(IItemList<IAEItemStack> out, int iteration) {
public IItemList<IAEItemStack> getAvailableItems(IItemList<IAEItemStack> out) {
if (itemCache == null) {
itemCache = AEApi.instance().storage().createItemList();
IMEMonitor<IAEFluidStack> fluidGrid = getFluidGrid();
@@ -210,7 +215,7 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
}
@Override
public IAEItemStack getAvailableItem(@Nonnull IAEItemStack request, int iteration) {
public IAEItemStack getAvailableItem(@Nonnull IAEItemStack request) {
IMEMonitor<IAEFluidStack> fluidGrid = getFluidGrid();
if (fluidGrid == null) {
return null;
@@ -219,7 +224,7 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
if (fluidRequest == null) {
return null;
}
IAEFluidStack availableFluid = fluidGrid.getAvailableItem(fluidRequest, iteration);
IAEFluidStack availableFluid = fluidGrid.getAvailableItem(fluidRequest);
if (availableFluid == null || availableFluid.getFluid() == null
|| FluidCraftAPI.instance().isBlacklistedInDisplay(availableFluid.getFluid().getClass())) {
return null;
@@ -264,42 +269,9 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
}
}
private class FluidCraftingInventoryHandler extends MEInventoryHandler<IAEFluidStack> {
public FluidCraftingInventoryHandler(IMEInventory<IAEFluidStack> i, StorageChannel channel) {
super(i, channel);
}
@Override
public boolean isPrioritized(IAEFluidStack input) {
return true;
}
@Override
public boolean canAccept(IAEFluidStack input) {
ICraftingGrid craftingGrid;
try {
craftingGrid = getProxy().getGrid().getCache(ICraftingGrid.class);
} catch (GridAccessException e) {
return false;
}
if (craftingGrid instanceof CraftingGridCache craftingGridCache) {
return craftingGridCache.canAccept(ItemFluidDrop.newAeStack(input));
}
return false;
}
@Override
public boolean isAutoCraftingInventory() {
return true;
}
}
private class FluidCraftingInventory implements IMEInventory<IAEFluidStack> {
private final MEInventoryHandler<IAEFluidStack> invHandler = new FluidCraftingInventoryHandler(
this,
getChannel());
private final MEInventoryHandler<IAEFluidStack> invHandler = new MEInventoryHandler<>(this, getChannel());
FluidCraftingInventory() {
invHandler.setPriority(Integer.MAX_VALUE);
@@ -330,12 +302,12 @@ public class TileFluidDiscretizer extends AENetworkTile implements IPriorityHost
}
@Override
public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out, int iteration) {
public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out) {
return out;
}
@Override
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request, int iteration) {
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request) {
return null;
}
@@ -26,7 +26,6 @@ import appeng.api.implementations.IPowerChannelState;
import appeng.api.networking.GridFlags;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridNode;
import appeng.api.networking.crafting.ICraftingCPU;
import appeng.api.networking.crafting.ICraftingGrid;
import appeng.api.networking.crafting.ICraftingJob;
import appeng.api.networking.crafting.ICraftingLink;
@@ -142,17 +141,6 @@ public class TileLevelMaintainer extends AENetworkTile
final IGrid grid = getProxy().getGrid();
final IItemList<IAEItemStack> inv = getProxy().getStorage().getItemInventory().getStorageList();
// Check there are available crafting CPUs before doing any work.
// This hopefully stops level maintainers busy-looping calculating
// crafting tasks that cannot be successfully submitted.
boolean allBusy = true;
for (final ICraftingCPU cpu : craftingGrid.getCpus()) {
if (!cpu.isBusy()) {
allBusy = false;
break;
}
}
// Find a request that we can submit to the network.
// If there is none, find the next request we can begin calculating.
ICraftingJob jobToSubmit = null;
@@ -175,10 +163,9 @@ public class TileLevelMaintainer extends AENetworkTile
boolean shouldCraft = isCraftable && aeItem.getStackSize() < quantity;
if (isDone) requests.updateState(i, State.Idle);
if (!isCraftable) requests.updateState(i, State.Error);
if (allBusy || !isDone
|| !shouldCraft
|| craftingGrid.canEmitFor(craftItem)
|| craftingGrid.isRequesting(craftItem))
if (craftingGrid.canEmitFor(craftItem) || craftingGrid.isRequesting(craftItem)
|| !isDone
|| !shouldCraft)
continue;
// do crafting
Future<ICraftingJob> jobTask = requests.getJob(i);
@@ -7,7 +7,6 @@ import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import com.glodblock.github.coremod.transform.CraftingCpuTransformer;
import com.glodblock.github.coremod.transform.CraftingGridCacheTransformer;
import com.glodblock.github.coremod.transform.CraftingTreeNodeTransformer;
import com.glodblock.github.coremod.transform.DualityInterfaceTransformer;
import com.glodblock.github.coremod.transform.ExternalStorageRegistryTransformer;
@@ -21,7 +20,6 @@ public class FCClassTransformer implements IClassTransformer {
Transform tform;
switch (transformedName) {
case "appeng.crafting.CraftingTreeNode" -> tform = CraftingTreeNodeTransformer.INSTANCE;
case "appeng.me.cache.CraftingGridCache" -> tform = CraftingGridCacheTransformer.INSTANCE;
case "appeng.me.cluster.implementations.CraftingCPUCluster" -> tform = CraftingCpuTransformer.INSTANCE;
case "appeng.helpers.DualityInterface" -> tform = DualityInterfaceTransformer.INSTANCE;
case "appeng.client.gui.implementations.GuiCraftingCPU", "appeng.client.gui.implementations.GuiCraftConfirm", "net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm", "appeng.client.gui.widgets.GuiCraftingTree" -> tform = GuiCraftingTransformer.INSTANCE;
@@ -1,38 +1,52 @@
package com.glodblock.github.coremod.hooker;
import java.util.Arrays;
import java.util.List;
import java.lang.reflect.Field;
import java.util.HashSet;
import java.util.Set;
import javax.annotation.Nullable;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.GuiFluidCraftConfirm;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.inventory.CraftingGridCacheFluidInventoryProxyCell;
import com.glodblock.github.common.parts.PartFluidInterface;
import com.glodblock.github.common.tile.TileFluidInterface;
import com.glodblock.github.inventory.FluidConvertingInventoryAdaptor;
import com.glodblock.github.inventory.FluidConvertingInventoryCrafting;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.network.SPacketMEItemInvUpdate;
import com.glodblock.github.util.Ae2Reflect;
import com.glodblock.github.util.SetBackedMachineSet;
import com.glodblock.github.util.Util;
import com.google.common.collect.Sets;
import appeng.api.config.Actionable;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridHost;
import appeng.api.networking.IGridNode;
import appeng.api.networking.IMachineSet;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.PlayerSource;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.IGuiTooltipHandler;
import appeng.crafting.MECraftingInventory;
import appeng.me.cache.CraftingGridCache;
import appeng.me.MachineSet;
import appeng.me.cluster.implementations.CraftingCPUCluster;
import appeng.parts.misc.PartInterface;
import appeng.tile.misc.TileInterface;
import appeng.util.InventoryAdaptor;
public class CoreModHooks {
@@ -81,6 +95,40 @@ public class CoreModHooks {
return originByte + totalBytes;
}
public static IAEItemStack[] flattenFluidPackets(IAEItemStack[] stacks) {
for (int i = 0; i < stacks.length; i++) {
if (stacks[i].getItem() instanceof ItemFluidPacket) {
stacks[i] = ItemFluidDrop.newAeStack(ItemFluidPacket.getFluidStack(stacks[i]));
}
}
return stacks;
}
public static IMachineSet getMachines(IGrid grid, Class<? extends IGridHost> c) {
if (c == TileInterface.class) {
return unionMachineSets(grid.getMachines(c), grid.getMachines(TileFluidInterface.class));
} else if (c == PartInterface.class) {
return unionMachineSets(grid.getMachines(c), grid.getMachines(PartFluidInterface.class));
} else {
return grid.getMachines(c);
}
}
private static IMachineSet unionMachineSets(IMachineSet a, IMachineSet b) {
if (a.isEmpty()) {
return b;
} else if (b.isEmpty()) {
return a;
} else if (a instanceof MachineSet && b instanceof MachineSet) {
return new SetBackedMachineSet(TileInterface.class, Sets.union((MachineSet) a, (MachineSet) b));
} else {
Set<IGridNode> union = new HashSet<>();
a.forEach(union::add);
b.forEach(union::add);
return new SetBackedMachineSet(TileInterface.class, union);
}
}
public static ItemStack displayFluid(IAEItemStack aeStack) {
if (aeStack.getItemStack() != null && aeStack.getItemStack().getItem() instanceof ItemFluidDrop) {
FluidStack fluid = ItemFluidDrop.getFluidStack(aeStack.getItemStack());
@@ -94,13 +142,6 @@ public class CoreModHooks {
} else return aeStack.getStackSize();
}
public static List<IMEInventoryHandler> craftingGridCacheGetCellArray(final CraftingGridCache instance,
final StorageChannel channel) {
// Equivalent to original function, but using the proxy for fluid channel
return channel == StorageChannel.ITEMS ? Arrays.asList(instance)
: Arrays.asList(new CraftingGridCacheFluidInventoryProxyCell(instance));
}
public static void storeFluidItem(CraftingCPUCluster instance) {
final IGrid g = Ae2Reflect.getGrid(instance);
@@ -156,4 +197,47 @@ public class CoreModHooks {
}
return true;
}
public static void craftingComplete(CraftingCPUCluster cpuCluster) {
try {
if (cpuCluster.isBusy()) return;
Field f;
f = cpuCluster.getClass().getField("player");
EntityPlayer player = (EntityPlayer) f.get(cpuCluster);
if (player != null) {
ItemStack term = Util.Wireless.getWirelessTerm(player);
if (term != null) {
SPacketMEItemInvUpdate piu = new SPacketMEItemInvUpdate((byte) 2);
f = cpuCluster.getClass().getField("requestItem");
IAEItemStack is = (IAEItemStack) f.get(cpuCluster);
if (is != null) {
piu.appendItem(is);
FluidCraft.proxy.netHandler.sendTo(piu, (EntityPlayerMP) player);
}
}
}
} catch (Exception ignored) {
}
}
public static void craftingAddActionSource(CraftingCPUCluster cpuCluster, BaseActionSource src) {
try {
Field f;
f = cpuCluster.getClass().getField("player");
if (src instanceof PlayerSource) {
f.set(cpuCluster, ((PlayerSource) src).player);
} else {
f.set(cpuCluster, null);
}
f = cpuCluster.getClass().getField("requestItem");
IAEItemStack is = cpuCluster.getFinalOutput();
if (is != null) {
f.set(cpuCluster, is.copy());
}
} catch (Exception ignored) {
}
}
}
@@ -1,6 +1,7 @@
package com.glodblock.github.coremod.transform;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Label;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
@@ -32,9 +33,69 @@ public class CraftingCpuTransformer extends FCClassTransformer.ClassMapper {
return new TransformExecuteCrafting(api, super.visitMethod(access, name, desc, signature, exceptions));
} else if (name.equals("cancel")) {
return new TransformStoreItems(api, super.visitMethod(access, name, desc, signature, exceptions));
} else if (name.equals("completeJob")) {
return new TransformCompleteJob(api, super.visitMethod(access, name, desc, signature, exceptions));
} else if (name.equals("submitJob")) {
return new TransformSubmitJob(api, super.visitMethod(access, name, desc, signature, exceptions));
}
return super.visitMethod(access, name, desc, signature, exceptions);
}
@Override
public void visitEnd() {
FieldVisitor p = cv
.visitField(Opcodes.ACC_PUBLIC, "player", "Lnet/minecraft/entity/player/EntityPlayer;", null, null);
p.visitEnd();
FieldVisitor is = cv.visitField(
Opcodes.ACC_PUBLIC,
"requestItem",
"Lappeng/api/storage/data/IAEItemStack;",
null,
null);
is.visitEnd();
super.visitEnd();
}
}
private static class TransformSubmitJob extends MethodVisitor {
TransformSubmitJob(int api, MethodVisitor mv) {
super(api, mv);
}
@Override
public void visitInsn(int opcode) {
if (opcode == Opcodes.ARETURN) {
super.visitVarInsn(Opcodes.ALOAD, 0);
super.visitVarInsn(Opcodes.ALOAD, 3);
super.visitMethodInsn(
Opcodes.INVOKESTATIC,
"com/glodblock/github/coremod/hooker/CoreModHooks",
"craftingAddActionSource",
"(Lappeng/me/cluster/implementations/CraftingCPUCluster;Lappeng/api/networking/security/BaseActionSource;)V");
}
super.visitInsn(opcode);
}
}
private static class TransformCompleteJob extends MethodVisitor {
TransformCompleteJob(int api, MethodVisitor mv) {
super(api, mv);
}
@Override
public void visitInsn(int opcode) {
if (opcode == Opcodes.RETURN) {
super.visitVarInsn(Opcodes.ALOAD, 0);
super.visitMethodInsn(
Opcodes.INVOKESTATIC,
"com/glodblock/github/coremod/hooker/CoreModHooks",
"craftingComplete",
"(Lappeng/me/cluster/implementations/CraftingCPUCluster;)V");
}
super.visitInsn(opcode);
}
}
private static class TransformExecuteCrafting extends MethodVisitor {
@@ -1,67 +0,0 @@
package com.glodblock.github.coremod.transform;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import com.glodblock.github.coremod.FCClassTransformer;
public class CraftingGridCacheTransformer extends FCClassTransformer.ClassMapper {
public static final CraftingGridCacheTransformer INSTANCE = new CraftingGridCacheTransformer();
private CraftingGridCacheTransformer() {
// NO-OP
}
@Override
protected ClassVisitor getClassMapper(ClassVisitor downstream) {
return new CraftingGridCacheTransformer.TransformCraftingGridCache(Opcodes.ASM5, downstream);
}
private static class TransformCraftingGridCache extends ClassVisitor {
TransformCraftingGridCache(int api, ClassVisitor cv) {
super(api, cv);
}
@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
if (name.equals("getCellArray")) {
return new CraftingGridCacheTransformer.ReplaceGetCellArray(
api,
super.visitMethod(access, name, desc, signature, exceptions));
}
return super.visitMethod(access, name, desc, signature, exceptions);
}
}
private static class ReplaceGetCellArray extends MethodVisitor {
private final MethodVisitor target;
ReplaceGetCellArray(int api, MethodVisitor mv) {
// Original method is replaced
super(api, null);
target = mv;
}
@Override
public void visitCode() {
target.visitCode();
// Equivalent to
// return CoreModHooks::craftingGridCacheGetCellArray(this, channel);
target.visitVarInsn(Opcodes.ALOAD, 0);
target.visitVarInsn(Opcodes.ALOAD, 1);
target.visitMethodInsn(
Opcodes.INVOKESTATIC,
"com/glodblock/github/coremod/hooker/CoreModHooks",
"craftingGridCacheGetCellArray",
"(Lappeng/me/cache/CraftingGridCache;Lappeng/api/storage/StorageChannel;)Ljava/util/List;",
false);
target.visitInsn(Opcodes.ARETURN);
target.visitMaxs(2, 3);
target.visitEnd();
}
}
}
@@ -188,6 +188,16 @@ public class DriverOCPatternEditor extends DriverSidedTileEntity {
return new Object[] { stack };
}
@Callback(
doc = "function([slot:number][, database:address, entry:number[, size:number]]):boolean -- Configure the interface.")
public Object[] setInterfaceConfiguration(Context context, Arguments args) {
IInventory config = tileEntity.getInternalInventory();
int slot = args.isString(0) ? 0 : optSlot(args, config, 0, 0);
config.setInventorySlotContents(slot, getStack(args));
context.pause(0.5);
return new Object[] { true };
}
@Callback(doc = "function([slot:number]):table -- Get the given pattern in the interface.")
public Object[] getInterfacePattern(Context context, Arguments args) {
IInventory inv = tileEntity.getInternalInventory();
@@ -1,14 +1,17 @@
package com.glodblock.github.crossmod.waila;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.ItemPotion;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.fluids.FluidStack;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.Util;
import mcp.mobius.waila.handlers.nei.TooltipHandlerWaila;
@@ -36,6 +39,14 @@ public class FCTooltipHandlerWaila extends TooltipHandlerWaila {
}
String modName = Util.getFluidModName(fs.getFluid());
if (modName != null && !modName.equals("")) currenttip.set(currenttip.size() - 1, "§9§o" + modName);
if (ModAndClassUtil.GT5NH || ModAndClassUtil.GT5) {
ItemStack potion = Util.FluidUtil.getPotion(fs);
if (potion != null && potion.getItem() instanceof ItemPotion) {
List<String> potionEffects = new ArrayList<>();
potion.getItem().addInformation(potion, Minecraft.getMinecraft().thePlayer, potionEffects, false);
currenttip.addAll(currenttip.size() - 1, potionEffects);
}
}
}
return currenttip;
}
@@ -1,85 +0,0 @@
package com.glodblock.github.inventory;
import org.jetbrains.annotations.NotNull;
import com.glodblock.github.common.item.ItemFluidDrop;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.me.cache.CraftingGridCache;
public class CraftingGridCacheFluidInventoryProxyCell implements IMEInventoryHandler<IAEFluidStack> {
private final CraftingGridCache inner;
public CraftingGridCacheFluidInventoryProxyCell(final CraftingGridCache craftingGridCache) {
inner = craftingGridCache;
}
@Override
public IAEFluidStack injectItems(IAEFluidStack input, Actionable type, BaseActionSource src) {
return ItemFluidDrop
.getAeFluidStack((IAEItemStack) inner.injectItems(ItemFluidDrop.newAeStack(input), type, src));
}
@Override
public IAEFluidStack extractItems(IAEFluidStack request, Actionable mode, BaseActionSource src) {
return null;
}
@Override
public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out, int iteration) {
return out;
}
@Override
public IAEFluidStack getAvailableItem(@NotNull IAEFluidStack request, int iteration) {
return null;
}
@Override
public StorageChannel getChannel() {
return StorageChannel.FLUIDS;
}
@Override
public AccessRestriction getAccess() {
return inner.getAccess();
}
@Override
public boolean isPrioritized(IAEFluidStack input) {
return inner.isPrioritized(input);
}
@Override
public boolean canAccept(IAEFluidStack input) {
return inner.canAccept(ItemFluidDrop.newAeStack(input));
}
@Override
public int getPriority() {
return inner.getPriority();
}
@Override
public int getSlot() {
return inner.getSlot();
}
@Override
public boolean validForPass(int i) {
return inner.validForPass(i);
}
@Override
public boolean isAutoCraftingInventory() {
return inner.isAutoCraftingInventory();
}
}
@@ -18,7 +18,6 @@ import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.common.parts.PartFluidExportBus;
import com.glodblock.github.common.parts.PartFluidInterface;
@@ -99,19 +98,11 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
|| Util.getPart(inter, face.getOpposite()) instanceof PartFluidExportBus
|| Util.getPart(inter, face.getOpposite()) instanceof PartFluidP2PInterface))
return InventoryAdaptor.getAdaptor(capProvider, face);
if (InventoryAdaptor.getAdaptor(capProvider, face) == null
&& !(ModAndClassUtil.EIO && capProvider instanceof IItemDuct)) {
if (capProvider instanceof IFluidHandler tank) {
if (tank.getTankInfo(face) == null || !(tank.getTankInfo(face).length > 0)) return null;
} else {
return null;
}
}
InventoryAdaptor item = InventoryAdaptor.getAdaptor(capProvider, face);
IFluidHandler fluid = capProvider instanceof IFluidHandler ? (IFluidHandler) capProvider : null;
boolean onmi = false;
if (inter instanceof TileInterface in) {
onmi = in.getTargets().size() > 1;
if (inter instanceof TileInterface) {
onmi = ((TileInterface) inter).getTargets().size() > 1;
}
return new FluidConvertingInventoryAdaptor(capProvider, item, fluid, face, new BlockPos(inter), onmi);
}
@@ -127,7 +118,7 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
if (fluid != null) {
int filled = fillSideFluid(fluid, this.invFluids, this.side, true);
fluid.amount -= filled;
return ItemFluidDrop.newStack(fluid);
return ItemFluidPacket.newStack(fluid);
} else {
ItemStack notFilled = fillSideItem(toBeAdded, this.invItems, insertionMode, true);
if (notFilled != null) {
@@ -347,13 +338,8 @@ public class FluidConvertingInventoryAdaptor extends InventoryAdaptor {
}
private boolean isGTMachine(Object o) {
if (!(ModAndClassUtil.GT5 || ModAndClassUtil.GT5NH)) return false;
if (o instanceof TileEntity te) {
return te.getBlockType().getUnlocalizedName().equals("gt.blockmachines");
}
return false;
return ModAndClassUtil.GT5 && o instanceof TileEntity
&& ((TileEntity) o).getBlockType().getUnlocalizedName().equals("gt.blockmachines");
}
private boolean isItemConduit(TileEntity te) {
@@ -58,18 +58,21 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
public IAEFluidStack injectItems(IAEFluidStack input, Actionable type, BaseActionSource src) {
int filled = this.handler.fill(this.side, input.getFluidStack(), type == Actionable.MODULATE);
if (type == Actionable.MODULATE) {
this.onTick();
}
if ((long) filled == input.getStackSize()) {
if (filled == 0) {
return input.copy();
} else if ((long) filled == input.getStackSize()) {
return null;
} else {
IAEFluidStack o = input.copy();
o.setStackSize(input.getStackSize() - (long) filled);
if (type == Actionable.MODULATE) {
IAEFluidStack added = o.copy();
this.cache.add(added);
this.postDifference(Collections.singletonList(added));
this.onTick();
}
return o;
}
IAEFluidStack o = input.copy();
o.setStackSize(input.getStackSize() - (long) filled);
return o;
}
public IAEFluidStack extractItems(IAEFluidStack request, Actionable type, BaseActionSource src) {
@@ -184,7 +187,7 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
return true;
}
public IItemList<IAEFluidStack> getAvailableItems(IItemList out, int iteration) {
public IItemList<IAEFluidStack> getAvailableItems(IItemList out) {
for (IAEFluidStack fs : this.cache) {
out.addStorage(fs);
@@ -194,7 +197,7 @@ public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
}
@Override
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request, int iteration) {
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request) {
return this.cache.findPrecise(request);
}
@@ -17,7 +17,6 @@ import com.glodblock.github.client.gui.GuiFluidCraftingWireless;
import com.glodblock.github.client.gui.GuiFluidIO;
import com.glodblock.github.client.gui.GuiFluidInterface;
import com.glodblock.github.client.gui.GuiFluidLevelEmitter;
import com.glodblock.github.client.gui.GuiFluidOptimizePatterns;
import com.glodblock.github.client.gui.GuiFluidPacketDecoder;
import com.glodblock.github.client.gui.GuiFluidPatternEncoder;
import com.glodblock.github.client.gui.GuiFluidPatternExWireless;
@@ -33,6 +32,7 @@ import com.glodblock.github.client.gui.GuiLargeIngredientBuffer;
import com.glodblock.github.client.gui.GuiLevelMaintainer;
import com.glodblock.github.client.gui.GuiLevelTerminal;
import com.glodblock.github.client.gui.GuiLevelWireless;
import com.glodblock.github.client.gui.GuiMagnet;
import com.glodblock.github.client.gui.GuiOCPatternEditor;
import com.glodblock.github.client.gui.GuiPatternValueAmount;
import com.glodblock.github.client.gui.GuiRenamer;
@@ -45,7 +45,6 @@ import com.glodblock.github.client.gui.container.ContainerFluidIO;
import com.glodblock.github.client.gui.container.ContainerFluidInterface;
import com.glodblock.github.client.gui.container.ContainerFluidLevelEmitter;
import com.glodblock.github.client.gui.container.ContainerFluidMonitor;
import com.glodblock.github.client.gui.container.ContainerFluidOptimizePatterns;
import com.glodblock.github.client.gui.container.ContainerFluidPacketDecoder;
import com.glodblock.github.client.gui.container.ContainerFluidPatternEncoder;
import com.glodblock.github.client.gui.container.ContainerFluidPatternExWireless;
@@ -60,6 +59,7 @@ import com.glodblock.github.client.gui.container.ContainerLargeIngredientBuffer;
import com.glodblock.github.client.gui.container.ContainerLevelMaintainer;
import com.glodblock.github.client.gui.container.ContainerLevelTerminal;
import com.glodblock.github.client.gui.container.ContainerLevelWireless;
import com.glodblock.github.client.gui.container.ContainerMagnet;
import com.glodblock.github.client.gui.container.ContainerOCPatternEditor;
import com.glodblock.github.client.gui.container.ContainerPatternValueAmount;
import com.glodblock.github.client.gui.container.ContainerRenamer;
@@ -88,6 +88,18 @@ import appeng.helpers.IPriorityHost;
public enum GuiType {
WIRELESS_MAGNET_CARD_FILTER(new ItemGuiFactory<>(ITerminalHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
return new ContainerMagnet(player.inventory, inv);
}
@Override
protected Object createClientGui(EntityPlayer player, ITerminalHost inv) {
return new GuiMagnet(player.inventory, inv);
}
}),
RENAMER(new PartOrItemGuiFactory<>(ITerminalHost.class) {
@Override
@@ -299,12 +311,12 @@ public enum GuiType {
@Override
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
return new ContainerFluidPortableCell(player.inventory, inv);
return new ContainerFluidMonitor(player.inventory, inv);
}
@Override
protected Object createClientGui(EntityPlayer player, IWirelessTerminal inv) {
return new GuiFluidPortableCell(player.inventory, inv);
return new GuiFluidTerminal(player.inventory, inv);
}
}),
@@ -449,32 +461,6 @@ public enum GuiType {
}
}),
FLUID_OPTIMIZE_PATTERNS(new PartGuiFactory<>(FCPart.class) {
@Override
protected Object createServerGui(EntityPlayer player, FCPart inv) {
return new ContainerFluidOptimizePatterns(player.inventory, inv);
}
@Override
protected Object createClientGui(EntityPlayer player, FCPart inv) {
return new GuiFluidOptimizePatterns(player.inventory, inv);
}
}),
FLUID_OPTIMIZE_PATTERNS_ITEM(new ItemGuiFactory<>(IWirelessTerminal.class) {
@Override
protected Object createServerGui(EntityPlayer player, IWirelessTerminal inv) {
return new ContainerFluidOptimizePatterns(player.inventory, inv);
}
@Override
protected Object createClientGui(EntityPlayer player, IWirelessTerminal inv) {
return new GuiFluidOptimizePatterns(player.inventory, inv);
}
}),
FLUID_CRAFTING_AMOUNT(new PartOrItemGuiFactory<>(ITerminalHost.class) {
@Override
@@ -30,7 +30,7 @@ public abstract class ItemGuiFactory<T> implements IGuiFactory {
@Nullable
@Override
public Object createServerGui(EntityPlayer player, World world, int x, int y, int z, ForgeDirection face) {
ItemStack item = Util.getWirelessTerminal(player, x);
ItemStack item = Util.Wireless.getWirelessTerminal(player, x);
if (item == null || !(item.getItem() instanceof IItemInventory)) {
return null;
}
@@ -57,7 +57,7 @@ public abstract class ItemGuiFactory<T> implements IGuiFactory {
@Nullable
@Override
public Object createClientGui(EntityPlayer player, World world, int x, int y, int z, ForgeDirection face) {
ItemStack item = Util.getWirelessTerminal(player, x);
ItemStack item = Util.Wireless.getWirelessTerminal(player, x);
if (item == null || !(item.getItem() instanceof IItemInventory)) {
return null;
}
@@ -31,7 +31,7 @@ public abstract class PartOrItemGuiFactory<T> extends PartGuiFactory<T> {
public Object createServerGui(EntityPlayer player, World world, int x, int y, int z, ForgeDirection face) {
ImmutablePair<Util.GuiHelper.GuiType, Integer> result = Util.GuiHelper.decodeType(y);
if (result.getLeft() == Util.GuiHelper.GuiType.ITEM) {
ItemStack item = Util.getWirelessTerminal(player, x);
ItemStack item = Util.Wireless.getWirelessTerminal(player, x);
if (item == null || !(item.getItem() instanceof IItemInventory)) {
return null;
}
@@ -62,7 +62,7 @@ public abstract class PartOrItemGuiFactory<T> extends PartGuiFactory<T> {
public Object createClientGui(EntityPlayer player, World world, int x, int y, int z, ForgeDirection face) {
ImmutablePair<Util.GuiHelper.GuiType, Integer> result = Util.GuiHelper.decodeType(y);
if (result.left == Util.GuiHelper.GuiType.ITEM) {
ItemStack item = Util.getWirelessTerminal(player, x);
ItemStack item = Util.Wireless.getWirelessTerminal(player, x);
if (item == null || !(item.getItem() instanceof IItemInventory)) {
return null;
}
@@ -0,0 +1,187 @@
package com.glodblock.github.inventory.item;
import static com.glodblock.github.common.item.ItemBaseWirelessTerminal.restockItems;
import static com.glodblock.github.common.item.ItemBaseWirelessTerminal.syncData;
import static com.glodblock.github.common.item.ItemMagnetCard.modeKey;
import java.util.Objects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import com.glodblock.github.common.item.ItemBaseWirelessTerminal;
import com.glodblock.github.common.item.ItemMagnetCard;
import com.glodblock.github.util.Util;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
import appeng.api.implementations.items.IAEItemPowerStorage;
import appeng.api.networking.IGridNode;
import appeng.api.networking.security.PlayerSource;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.storage.MEMonitorHandler;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.util.AECableType;
import appeng.items.tools.powered.ToolWirelessTerminal;
import appeng.util.Platform;
public abstract class BaseWirelessInventory extends MEMonitorHandler implements IWirelessTerminal, IWirelessExtendCard {
protected final ItemStack target;
protected final IAEItemPowerStorage ips;
protected final int inventorySlot;
protected final IGridNode grid;
protected final PlayerSource source;
protected final StorageChannel channel;
protected ItemMagnetCard.Mode magnetMode = ItemMagnetCard.Mode.Off;;
protected EntityPlayer player;
protected boolean sync = true;
protected boolean restock;
@SuppressWarnings("unchecked")
public BaseWirelessInventory(final ItemStack is, final int slot, IGridNode gridNode, EntityPlayer player,
StorageChannel channel) {
super(Objects.requireNonNull(Util.Wireless.getWirelessInv(is, player, channel)));
this.ips = (ToolWirelessTerminal) is.getItem();
this.grid = gridNode;
this.target = is;
this.inventorySlot = slot;
this.channel = channel;
this.source = new PlayerSource(player, this);
this.readFromNBT();
}
private void readFromNBT() {
NBTTagCompound data = Platform.openNbtData(this.target);
this.setMagnetCardMode(ItemMagnetCard.Mode.values()[data.getInteger(modeKey)]);
this.setRestock(data.getBoolean(ItemBaseWirelessTerminal.restockItems));
this.setSyncData(data.getBoolean(syncData));
}
public StorageChannel getChannel() {
return this.channel;
}
@Override
public ItemStack getItemStack() {
return this.target;
}
@Override
public double extractAEPower(double amt, Actionable mode, PowerMultiplier usePowerMultiplier) {
amt = usePowerMultiplier.multiply(amt);
if (mode == Actionable.SIMULATE) {
return usePowerMultiplier.divide(Math.min(amt, this.ips.getAECurrentPower(this.target)));
}
return usePowerMultiplier.divide(this.ips.extractAEPower(this.target, amt));
}
@Override
public int getInventorySlot() {
return this.inventorySlot;
}
@Override
public IGridNode getGridNode(ForgeDirection dir) {
return this.grid;
}
@Override
public AECableType getCableConnectionType(ForgeDirection dir) {
return AECableType.NONE;
}
@Override
public void securityBreak() {
this.getGridNode(ForgeDirection.UNKNOWN).getMachine().securityBreak();
}
@Override
public void saveChanges() {
}
@Override
public IGridNode getActionableNode() {
return this.grid;
}
@Override
public PlayerSource getActionSource() {
return this.source;
}
@Override
public void setMagnetCardMode(ItemMagnetCard.Mode mode) {
this.magnetMode = mode;
}
@Override
public ItemMagnetCard.Mode getMagnetCardMode() {
return this.magnetMode;
}
public void setMagnetCardNextMode() {
setMagnetCardMode(
ItemMagnetCard.Mode.values()[(getMagnetCardMode().ordinal() + 1)
% ItemMagnetCard.Mode.values().length]);
}
public void setRestock(boolean val) {
this.restock = val;
}
public boolean isRestock() {
return this.restock;
}
public IAEStack injectItems(IAEStack aeStack) {
try {
if (aeStack.isItem()) {
return ((IStorageGrid) getActionableNode().getGrid().getCache(IStorageGrid.class)).getItemInventory()
.injectItems((IAEItemStack) aeStack, Actionable.MODULATE, getActionSource());
} else {
return ((IStorageGrid) getActionableNode().getGrid().getCache(IStorageGrid.class)).getFluidInventory()
.injectItems((IAEFluidStack) aeStack, Actionable.MODULATE, getActionSource());
}
} catch (Exception e) {
return aeStack;
}
}
public IAEStack extractItems(IAEStack aeStack) {
try {
if (aeStack.isItem()) {
return ((IStorageGrid) getActionableNode().getGrid().getCache(IStorageGrid.class)).getItemInventory()
.extractItems((IAEItemStack) aeStack, Actionable.MODULATE, getActionSource());
} else {
return ((IStorageGrid) getActionableNode().getGrid().getCache(IStorageGrid.class)).getFluidInventory()
.extractItems((IAEFluidStack) aeStack, Actionable.MODULATE, getActionSource());
}
} catch (Exception e) {
return null;
}
}
public void saveSettings() {
NBTTagCompound data = Platform.openNbtData(this.target);
data.setBoolean(restockItems, this.restock);
data.setInteger(modeKey, this.getMagnetCardMode().ordinal());
data.setBoolean(syncData, this.sync);
}
public boolean getSyncData() {
return this.sync;
}
public void setSyncData(boolean sync) {
this.sync = sync;
}
}
@@ -2,10 +2,16 @@ package com.glodblock.github.inventory.item;
import net.minecraft.inventory.IInventory;
public interface IItemTerminal {
import appeng.api.implementations.guiobjects.IGuiItemObject;
public interface IItemTerminal extends IGuiItemObject {
IInventory getInventoryByName(final String name);
default void saveSettings() {}
boolean getSyncData();
void setSyncData(boolean sync);
default void saveSettings() {};
}
@@ -0,0 +1,28 @@
package com.glodblock.github.inventory.item;
import com.glodblock.github.common.item.ItemMagnetCard;
import appeng.api.networking.security.PlayerSource;
import appeng.api.storage.data.IAEStack;
public interface IWirelessExtendCard {
default void setMagnetCardMode(ItemMagnetCard.Mode mode) {}
ItemMagnetCard.Mode getMagnetCardMode();
PlayerSource getActionSource();
IAEStack injectItems(IAEStack aeStack);
IAEStack extractItems(IAEStack aeStack);
default void setMagnetCardNextMode() {};
void setRestock(boolean val);
default boolean isRestock() {
return false;
}
}
@@ -0,0 +1,25 @@
package com.glodblock.github.inventory.item;
import com.glodblock.github.common.item.ItemMagnetCard;
public interface IWirelessMagnetCardFilter extends IWirelessTerminal, IItemTerminal {
ItemMagnetCard.ListMode getListMode();
boolean getNBTMode();
boolean getMetaMode();
boolean getOreMode();
void setListMode(ItemMagnetCard.ListMode mode);
void setNBTMode(boolean ignoreNBT);
void setMetaMode(boolean ignoreMeta);
void setOreMode(boolean useOre);
default void clearConfig() {};
}
@@ -8,6 +8,7 @@ import appeng.api.implementations.guiobjects.IGuiItemObject;
import appeng.api.implementations.tiles.IViewCellStorage;
import appeng.api.networking.IGridHost;
import appeng.api.networking.security.IActionHost;
import appeng.api.storage.StorageChannel;
import appeng.tile.inventory.IAEAppEngInventory;
public interface IWirelessTerminal
@@ -21,4 +22,8 @@ public interface IWirelessTerminal
return false;
}
default StorageChannel getChannel() {
return null;
};
}
@@ -1,7 +1,5 @@
package com.glodblock.github.inventory.item;
import java.util.Objects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@@ -9,7 +7,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import com.glodblock.github.inventory.ItemBiggerAppEngInventory;
import com.glodblock.github.util.Util;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
@@ -20,9 +17,7 @@ import appeng.api.config.TypeFilter;
import appeng.api.config.ViewItems;
import appeng.api.implementations.items.IAEItemPowerStorage;
import appeng.api.networking.IGridNode;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.MEMonitorHandler;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
@@ -35,8 +30,7 @@ import appeng.tile.inventory.InvOperation;
import appeng.util.ConfigManager;
import appeng.util.Platform;
public class WirelessCraftingTerminalInventory extends MEMonitorHandler<IAEItemStack>
implements IWirelessCraftTerminal {
public class WirelessCraftingTerminalInventory extends BaseWirelessInventory implements IWirelessCraftTerminal {
private final ItemStack target;
private final IAEItemPowerStorage ips;
@@ -51,9 +45,7 @@ public class WirelessCraftingTerminalInventory extends MEMonitorHandler<IAEItemS
@SuppressWarnings("unchecked")
public WirelessCraftingTerminalInventory(final ItemStack is, final int slot, IGridNode gridNode,
EntityPlayer player) {
super(
(IMEInventoryHandler<IAEItemStack>) Objects
.requireNonNull(Util.getWirelessInv(is, player, StorageChannel.ITEMS)));
super(is, slot, gridNode, player, StorageChannel.ITEMS);
this.ips = (ToolWirelessTerminal) is.getItem();
this.grid = gridNode;
this.target = is;
@@ -1,15 +1,11 @@
package com.glodblock.github.inventory.item;
import java.util.Objects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
import com.glodblock.github.util.Util;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
import appeng.api.config.Settings;
@@ -18,9 +14,7 @@ import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems;
import appeng.api.implementations.items.IAEItemPowerStorage;
import appeng.api.networking.IGridNode;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.MEMonitorHandler;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
@@ -33,7 +27,7 @@ import appeng.tile.inventory.InvOperation;
import appeng.util.ConfigManager;
import appeng.util.Platform;
public class WirelessFluidTerminalInventory extends MEMonitorHandler<IAEFluidStack> implements IWirelessTerminal {
public class WirelessFluidTerminalInventory extends BaseWirelessInventory implements IWirelessTerminal, IItemTerminal {
private final ItemStack target;
private final IAEItemPowerStorage ips;
@@ -44,9 +38,7 @@ public class WirelessFluidTerminalInventory extends MEMonitorHandler<IAEFluidSta
@SuppressWarnings("unchecked")
public WirelessFluidTerminalInventory(final ItemStack is, final int slot, IGridNode gridNode, EntityPlayer player) {
super(
(IMEInventoryHandler<IAEFluidStack>) Objects
.requireNonNull(Util.getWirelessInv(is, player, StorageChannel.FLUIDS)));
super(is, slot, gridNode, player, StorageChannel.FLUIDS);
this.ips = (ToolWirelessTerminal) is.getItem();
this.grid = gridNode;
this.target = is;
@@ -135,4 +127,9 @@ public class WirelessFluidTerminalInventory extends MEMonitorHandler<IAEFluidSta
@Override
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack,
ItemStack newStack) {}
@Override
public IInventory getInventoryByName(String name) {
return null;
}
}
@@ -36,7 +36,7 @@ public class WirelessInterfaceTerminalInventory implements IClickableInTerminal,
private Util.DimensionalCoordSide tile;
public WirelessInterfaceTerminalInventory(ItemStack is, int slot, IGridNode gridNode, EntityPlayer player) {
Objects.requireNonNull(Util.getWirelessInv(is, player, StorageChannel.ITEMS));
Objects.requireNonNull(Util.Wireless.getWirelessInv(is, player, StorageChannel.ITEMS));
this.ips = (ToolWirelessTerminal) is.getItem();
this.grid = gridNode;
this.target = is;
@@ -36,7 +36,7 @@ public class WirelessLevelTerminalInventory implements IClickableInTerminal, IWi
private Util.DimensionalCoordSide tile;
public WirelessLevelTerminalInventory(ItemStack is, int slot, IGridNode gridNode, EntityPlayer player) {
Objects.requireNonNull(Util.getWirelessInv(is, player, StorageChannel.ITEMS));
Objects.requireNonNull(Util.Wireless.getWirelessInv(is, player, StorageChannel.ITEMS));
this.ips = (ToolWirelessTerminal) is.getItem();
this.grid = gridNode;
this.target = is;
@@ -0,0 +1,215 @@
package com.glodblock.github.inventory.item;
import static com.glodblock.github.common.item.ItemMagnetCard.filterConfigKey;
import static com.glodblock.github.common.item.ItemMagnetCard.filterKey;
import java.util.List;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import com.glodblock.github.common.item.ItemMagnetCard;
import com.glodblock.github.inventory.ItemBiggerAppEngInventory;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
import appeng.api.networking.IGridNode;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.api.util.IConfigManager;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.inventory.InvOperation;
import appeng.util.Platform;
public class WirelessMagnetCardFilterInventory extends BaseWirelessInventory implements IWirelessMagnetCardFilter {
private boolean nbt;
private boolean mata;
private boolean ore;
private ItemMagnetCard.ListMode listMode = ItemMagnetCard.ListMode.WhiteList;
protected AppEngInternalInventory filterList;
@SuppressWarnings("unchecked")
public WirelessMagnetCardFilterInventory(ItemStack is, int slot, IGridNode gridNode, EntityPlayer player) {
super(is, slot, gridNode, player, StorageChannel.ITEMS);
this.filterList = new ItemBiggerAppEngInventory(is, filterKey, 27);
readFromNBT();
}
public void readFromNBT() {
NBTTagCompound data = Platform.openNbtData(this.target);
if (!data.hasKey(filterConfigKey)) this.writeToNBT();
NBTTagCompound tag = (NBTTagCompound) data.getTag(filterConfigKey);
this.nbt = tag.getBoolean("nbt");
this.mata = tag.getBoolean("meta");
this.ore = tag.getBoolean("ore");
this.listMode = ItemMagnetCard.ListMode.values()[tag.getInteger("list")];
}
public void writeToNBT() {
NBTTagCompound data = Platform.openNbtData(this.target);
NBTTagCompound tmp = new NBTTagCompound();
tmp.setBoolean("nbt", this.nbt);
tmp.setBoolean("meta", this.mata);
tmp.setBoolean("ore", this.ore);
tmp.setInteger("list", this.listMode.ordinal());
data.setTag(filterConfigKey, tmp);
}
@Override
public ItemMagnetCard.ListMode getListMode() {
return this.listMode;
}
@Override
public boolean getNBTMode() {
return this.nbt;
}
@Override
public boolean getMetaMode() {
return this.mata;
}
@Override
public boolean getOreMode() {
return this.ore;
}
@Override
public void setListMode(ItemMagnetCard.ListMode mode) {
this.listMode = mode;
}
@Override
public void setNBTMode(boolean ignoreNBT) {
this.nbt = ignoreNBT;
}
@Override
public void setMetaMode(boolean ignoreMeta) {
this.mata = ignoreMeta;
}
@Override
public void setOreMode(boolean useOre) {
this.ore = useOre;
}
@Override
public void clearConfig() {
IInventory inv = this.getInventoryByName("config");
for (int i = 0; i < inv.getSizeInventory(); i++) {
inv.setInventorySlotContents(i, null);
}
}
@Override
public StorageChannel getChannel() {
return null;
}
@Override
public IInventory getViewCellStorage() {
return null;
}
@Override
public double extractAEPower(double amt, Actionable mode, PowerMultiplier usePowerMultiplier) {
return 0;
}
@Override
public IMEMonitor<IAEItemStack> getItemInventory() {
return this;
}
@Override
public IMEMonitor<IAEFluidStack> getFluidInventory() {
return null;
}
@Override
public IConfigManager getConfigManager() {
return null;
}
@Override
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack,
ItemStack newStack) {
}
@Override
public void saveSettings() {
super.saveSettings();
writeToNBT();
}
@Override
public IInventory getInventoryByName(String name) {
if (name.equals("config")) {
return this.filterList;
}
return null;
}
public boolean doInject(IAEItemStack is, EntityItem itemToGet, World world) {
IAEItemStack ais = (IAEItemStack) injectItems(is);
if (ais != null) {
player.onItemPickup(itemToGet, ais.getItemStack().stackSize);
player.inventory.addItemStackToInventory(ais.getItemStack());
world.playSoundAtEntity(
player,
"random.pop",
0.15F,
((world.rand.nextFloat() - world.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
return false;
}
return true;
}
public List<ItemStack> getFilteredItems() {
return ItemMagnetCard.getFilteredItems(this.target);
}
public IItemList<IAEItemStack> getAEFilteredItems() {
IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
for (ItemStack is : this.getFilteredItems()) {
list.add(AEApi.instance().storage().createItemStack(is));
}
return list;
}
public boolean isItemFiltered(ItemStack is, IItemList<IAEItemStack> list) {
if (is == null && list.isEmpty()) return false;
IAEItemStack ais = AEApi.instance().storage().createItemStack(is);
for (IAEItemStack i : list) {
if (this.ore) {
// use oredict
return i.sameOre(ais);
} else if (!this.mata && !this.nbt) {
// ignore meta & nbt
return Platform.isSameItem(i.getItemStack(), ais.getItemStack());
} else if (!this.mata && this.nbt) {
// ignore meta only
return Platform.isSameItemPrecise(i.getItemStack(), ais.getItemStack());
} else if (this.mata) {
// ignore nbt only
return i.getItemDamage() == ais.getItemDamage();
} else {
// ignore nothing/don't use oredict--must be exact match
return list.findPrecise(ais) != null;
}
}
return false;
}
}
@@ -2,7 +2,6 @@ package com.glodblock.github.inventory.item;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
@@ -14,7 +13,6 @@ import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.inventory.ItemBiggerAppEngInventory;
import com.glodblock.github.inventory.WirelessFluidPatternTerminalPatterns;
import com.glodblock.github.util.Util;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
@@ -27,9 +25,7 @@ import appeng.api.implementations.ICraftingPatternItem;
import appeng.api.implementations.items.IAEItemPowerStorage;
import appeng.api.networking.IGridNode;
import appeng.api.networking.crafting.ICraftingPatternDetails;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.MEMonitorHandler;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
@@ -42,8 +38,7 @@ import appeng.tile.inventory.InvOperation;
import appeng.util.ConfigManager;
import appeng.util.Platform;
public class WirelessPatternTerminalExInventory extends MEMonitorHandler<IAEItemStack>
implements IWirelessPatternTerminal {
public class WirelessPatternTerminalExInventory extends BaseWirelessInventory implements IWirelessPatternTerminal {
private final ItemStack target;
private final IAEItemPowerStorage ips;
@@ -68,9 +63,7 @@ public class WirelessPatternTerminalExInventory extends MEMonitorHandler<IAEItem
@SuppressWarnings("unchecked")
public WirelessPatternTerminalExInventory(final ItemStack is, final int slot, IGridNode gridNode,
EntityPlayer player) {
super(
(IMEInventoryHandler<IAEItemStack>) Objects
.requireNonNull(Util.getWirelessInv(is, player, StorageChannel.ITEMS)));
super(is, slot, gridNode, player, StorageChannel.ITEMS);
this.ips = (ToolWirelessTerminal) is.getItem();
this.grid = gridNode;
this.target = is;
@@ -419,6 +412,7 @@ public class WirelessPatternTerminalExInventory extends MEMonitorHandler<IAEItem
@Override
public void saveSettings() {
super.saveSettings();
this.writeToNBT();
}
@@ -2,7 +2,6 @@ package com.glodblock.github.inventory.item;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
@@ -14,7 +13,6 @@ import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.inventory.ItemBiggerAppEngInventory;
import com.glodblock.github.inventory.WirelessFluidPatternTerminalPatterns;
import com.glodblock.github.util.Util;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
@@ -27,9 +25,7 @@ import appeng.api.implementations.ICraftingPatternItem;
import appeng.api.implementations.items.IAEItemPowerStorage;
import appeng.api.networking.IGridNode;
import appeng.api.networking.crafting.ICraftingPatternDetails;
import appeng.api.storage.IMEInventoryHandler;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.MEMonitorHandler;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
@@ -42,8 +38,7 @@ import appeng.tile.inventory.InvOperation;
import appeng.util.ConfigManager;
import appeng.util.Platform;
public class WirelessPatternTerminalInventory extends MEMonitorHandler<IAEItemStack>
implements IWirelessPatternTerminal {
public class WirelessPatternTerminalInventory extends BaseWirelessInventory implements IWirelessPatternTerminal {
private final ItemStack target;
private final IAEItemPowerStorage ips;
@@ -68,9 +63,7 @@ public class WirelessPatternTerminalInventory extends MEMonitorHandler<IAEItemSt
@SuppressWarnings("unchecked")
public WirelessPatternTerminalInventory(final ItemStack is, final int slot, IGridNode gridNode,
EntityPlayer player) {
super(
(IMEInventoryHandler<IAEItemStack>) Objects
.requireNonNull(Util.getWirelessInv(is, player, StorageChannel.ITEMS)));
super(is, slot, gridNode, player, StorageChannel.ITEMS);
this.ips = (ToolWirelessTerminal) is.getItem();
this.grid = gridNode;
this.target = is;
@@ -391,6 +384,7 @@ public class WirelessPatternTerminalInventory extends MEMonitorHandler<IAEItemSt
@Override
public void saveSettings() {
super.saveSettings();
this.writeToNBT();
}
@@ -8,7 +8,7 @@ import com.glodblock.github.FluidCraft;
import com.glodblock.github.network.CPacketCraftRequest;
import com.glodblock.github.network.CPacketDumpTank;
import com.glodblock.github.network.CPacketEncodePattern;
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
import com.glodblock.github.network.CPacketFluidTerminalBtns;
import com.glodblock.github.network.CPacketFluidUpdate;
import com.glodblock.github.network.CPacketInventoryAction;
import com.glodblock.github.network.CPacketLevelMaintainer;
@@ -39,8 +39,8 @@ public class ChannelLoader implements Runnable {
FCNetworkWrapper netHandler = FluidCraft.proxy.netHandler;
netHandler.registerMessage(new CPacketSwitchGuis.Handler(), CPacketSwitchGuis.class, id++, Side.SERVER);
netHandler.registerMessage(
new CPacketFluidPatternTermBtns.Handler(),
CPacketFluidPatternTermBtns.class,
new CPacketFluidTerminalBtns.Handler(),
CPacketFluidTerminalBtns.class,
id++,
Side.SERVER);
netHandler.registerMessage(new CPacketEncodePattern.Handler(), CPacketEncodePattern.class, id++, Side.SERVER);
@@ -29,7 +29,9 @@ import com.glodblock.github.common.item.ItemFluidLevelEmitter;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.common.item.ItemFluidStorageHousing;
import com.glodblock.github.common.item.ItemFluidStorageMonitor;
import com.glodblock.github.common.item.ItemInfinityLavaStorageCell;
import com.glodblock.github.common.item.ItemInfinityWaterStorageCell;
import com.glodblock.github.common.item.ItemMagnetCard;
import com.glodblock.github.common.item.ItemMultiFluidStorageCell;
import com.glodblock.github.common.item.ItemPartFluidInterface;
import com.glodblock.github.common.item.ItemPartFluidP2PInterface;
@@ -134,19 +136,14 @@ public class ItemAndBlockHolder {
8,
1,
5).register();
public static ItemFluidExtremeStorageCell ARTIFICIAL_UNIVERSE_CELL = new ItemFluidExtremeStorageCell(
NameConst.ITEM_ARTIFICIAL_UNIVERSE_STORAGE,
Long.MAX_VALUE / 2048,
16384,
5,
600000D).register();
public static ItemCreativeFluidStorageCell CREATIVE_CELL = new ItemCreativeFluidStorageCell().register();
public static ItemInfinityWaterStorageCell INFINITY_WATER_CELL = new ItemInfinityWaterStorageCell().register();
public static ItemInfinityLavaStorageCell INFINITY_LAVA_CELL = new ItemInfinityLavaStorageCell().register();
public static ItemBasicFluidStoragePart CELL_PART = new ItemBasicFluidStoragePart().register();
public static ItemFluidStorageHousing CELL_HOUSING = new ItemFluidStorageHousing().register();
public static ItemEnergyCard ENERGY_CARD = new ItemEnergyCard().register();
public static ItemQuantumBridgeCard QUANTUM_BRIDGE_CARD = new ItemQuantumBridgeCard().register();
public static ItemMagnetCard MAGNET_CARD = new ItemMagnetCard().register();
public static void loadSetting() {
if (!Config.fluidCells) return;
@@ -4,11 +4,15 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.lwjgl.input.Keyboard;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.item.ItemWirelessUltraTerminal;
import com.glodblock.github.network.CPacketValueConfig;
import com.glodblock.github.util.NameConst;
import com.glodblock.github.util.Util;
import cpw.mods.fml.client.registry.ClientRegistry;
@@ -22,11 +26,14 @@ import cpw.mods.fml.relauncher.SideOnly;
public class KeybindLoader implements Runnable {
public static KeyBinding openTerminal;
public static KeyBinding restock;
@Override
public void run() {
openTerminal = new KeyBinding("key.OpenTerminal", Keyboard.CHAR_NONE, "itemGroup.ae2fc");
openTerminal = new KeyBinding(FluidCraft.MODID + ".key.OpenTerminal", Keyboard.CHAR_NONE, "itemGroup.ae2fc");
restock = new KeyBinding(FluidCraft.MODID + ".key.Restock", Keyboard.CHAR_NONE, "itemGroup.ae2fc");
ClientRegistry.registerKeyBinding(openTerminal);
ClientRegistry.registerKeyBinding(restock);
FMLCommonHandler.instance().bus().register(this);
}
@@ -39,12 +46,25 @@ public class KeybindLoader implements Runnable {
}
if (openTerminal.isPressed()) {
ImmutablePair<Integer, ItemStack> term = Util.getUltraWirelessTerm(p);
ImmutablePair<Integer, ItemStack> term = Util.Wireless.getUltraWirelessTerm(p);
if (term != null && term.getRight().getItem() instanceof ItemWirelessUltraTerminal) {
ItemWirelessUltraTerminal.switchTerminal(
p,
((ItemWirelessUltraTerminal) term.getRight().getItem()).guiGuiType(term.getRight()));
}
} else if (restock.isPressed()) {
ImmutablePair<Integer, ItemStack> term = Util.Wireless.getUltraWirelessTerm(p);
if (term != null) {
p.addChatMessage(
new ChatComponentText(
NameConst.i18n(
!Util.Wireless.isRestock(term.getRight())
? NameConst.TT_ULTRA_TERMINAL_RESTOCK_ON
: NameConst.TT_ULTRA_TERMINAL_RESTOCK_OFF)));
FluidCraft.proxy.netHandler.sendToServer(new CPacketValueConfig(0, 1));
}
}
}
}
@@ -42,6 +42,7 @@ import static com.glodblock.github.loader.ItemAndBlockHolder.INTERFACE;
import static com.glodblock.github.loader.ItemAndBlockHolder.LARGE_BUFFER;
import static com.glodblock.github.loader.ItemAndBlockHolder.LEVEL_MAINTAINER;
import static com.glodblock.github.loader.ItemAndBlockHolder.LEVEL_TERMINAL;
import static com.glodblock.github.loader.ItemAndBlockHolder.MAGNET_CARD;
import static com.glodblock.github.loader.ItemAndBlockHolder.OC_EDITOR;
import static com.glodblock.github.loader.ItemAndBlockHolder.PATTERN;
import static com.glodblock.github.loader.ItemAndBlockHolder.PORTABLE_FLUID_CELL;
@@ -54,7 +55,10 @@ import static com.glodblock.github.loader.ItemAndBlockHolder.WIRELESS_INTERFACE_
import static com.glodblock.github.loader.ItemAndBlockHolder.WIRELESS_LEVEL_TERM;
import static com.glodblock.github.loader.ItemAndBlockHolder.WIRELESS_PATTERN_TERM;
import static com.glodblock.github.loader.ItemAndBlockHolder.WIRELESS_ULTRA_TERM;
import static net.minecraft.init.Blocks.redstone_torch;
import static com.glodblock.github.loader.recipe.WirelessTerminalEnergyRecipe.energyCards;
import static com.glodblock.github.loader.recipe.WirelessTerminalInfinityBoosterRecipe.infCards;
import static com.glodblock.github.loader.recipe.WirelessTerminalMagnetRecipe.magnetCards;
import static net.minecraft.init.Blocks.*;
import static net.minecraft.init.Items.fish;
import java.util.Arrays;
@@ -71,8 +75,8 @@ import com.glodblock.github.common.Config;
import com.glodblock.github.common.item.FCBaseItemCell;
import com.glodblock.github.common.storage.CellType;
import com.glodblock.github.loader.recipe.WirelessTerminalEnergyRecipe;
import com.glodblock.github.loader.recipe.WirelessTerminalQuantumBridgeRecipe;
import com.glodblock.github.loader.recipe.WirelessTerminalRecipe;
import com.glodblock.github.loader.recipe.WirelessTerminalInfinityBoosterRecipe;
import com.glodblock.github.loader.recipe.WirelessTerminalMagnetRecipe;
import com.glodblock.github.util.ModAndClassUtil;
import appeng.api.AEApi;
@@ -168,37 +172,31 @@ public class RecipeLoader implements Runnable {
.findItemStack("appliedenergistics2", "tile.BlockQuantumRing", 1);
public static final ItemStack AE2_DENSE_ENERGY_CELL = GameRegistry
.findItemStack("appliedenergistics2", "tile.BlockDenseEnergyCell", 1);
public static final ItemStack AE2_ANNIHILATION_CORE = new ItemStack(
GameRegistry.findItem("appliedenergistics2", "item.ItemMultiMaterial"),
1,
44);
public static final ItemStack AE2_FORMATION_CORE = new ItemStack(
GameRegistry.findItem("appliedenergistics2", "item.ItemMultiMaterial"),
1,
43);
public static final ItemStack THE_WIRELESS_TERM = GameRegistry
.findItemStack("thaumicenergistics", "wireless.essentia.terminal", 1);
private static final ItemStack WCT_WIRELESS_TERM = GameRegistry
.findItemStack("ae2wct", "wirelessCraftingTerminal", 1);
public static final ItemStack BUCKET = new ItemStack(Items.bucket, 1);
public static final ItemStack IRON_BAR = new ItemStack(Blocks.iron_bars, 1);
public static final ItemStack AE2_ANNIHILATION_PLANE = new ItemStack(
GameRegistry.findItem("appliedenergistics2", "item.ItemMultiPart"),
1,
301);
public static final ItemStack AE2_ADVANCED_CARD = new ItemStack(
GameRegistry.findItem("appliedenergistics2", "item.ItemMultiMaterial"),
1,
28);
public static final ItemStack AE2_FLUIX_PEARL = new ItemStack(
GameRegistry.findItem("appliedenergistics2", "item.ItemMultiMaterial"),
1,
9);
public static final ItemStack AE2_WIRELESS_RECEIVER = new ItemStack(
GameRegistry.findItem("appliedenergistics2", "item.ItemMultiMaterial"),
1,
41);
public static final ItemStack AE2_BLOCK_CHARGER = GameRegistry
.findItemStack("appliedenergistics2", "tile.BlockCharger", 1);
public static final ItemStack AE2_SINGULARITY = new ItemStack(
GameRegistry.findItem("appliedenergistics2", "item.ItemMultiMaterial"),
1,
47);
public static final ItemStack NETHER_STAR = new ItemStack(Items.nether_star, 1);
public static final ItemStack WATER_BUCKET = new ItemStack(Items.water_bucket, 1);
private static final ItemStack WCT_WIRELESS_TERM = GameRegistry
.findItemStack("ae2wct", "wirelessCraftingTerminal", 1);
public static final ItemStack BUCKET = new ItemStack(Items.bucket, 1);
public static final ItemStack IRON_BAR = new ItemStack(Blocks.iron_bars, 1);
public static final ItemStack REDSTONE_BLOCK = new ItemStack(redstone_block, 1);
public static final ItemStack LAPIS_BLOCK = new ItemStack(lapis_block, 1);
public static final ItemStack IRON_BLOCK = new ItemStack(iron_block, 1);
@Override
public void run() {
@@ -669,70 +667,60 @@ public class RecipeLoader implements Runnable {
}
}
public static void addTerminalCards() {
public static void addTestItem() {
GameRegistry.addRecipe(
new ShapedOreRecipe(
ENERGY_CARD.stack(),
"DSD",
"HAH",
"DSD",
'H',
AE2_BLOCK_CHARGER,
'D',
"EEE",
"EAE",
"EEE",
'E',
AE2_DENSE_ENERGY_CELL,
'A',
AE2_ADVANCED_CARD,
'S',
AE2_SINGULARITY));
AE2_ADVANCED_CARD));
GameRegistry.addRecipe(
new ShapedOreRecipe(
MAGNET_CARD.stack(),
"RBL",
"IAI",
"III",
'I',
IRON_BLOCK,
'R',
REDSTONE_BLOCK,
'B',
AE2_ANNIHILATION_PLANE,
'L',
LAPIS_BLOCK,
'A',
AE2_ADVANCED_CARD));
GameRegistry.addRecipe(
new ShapedOreRecipe(
QUANTUM_BRIDGE_CARD.stack(),
"QSQ",
"WAW",
"QSQ",
'Q',
AE2_QUANTUM_RING,
'A',
AE2_ADVANCED_CARD,
'S',
NETHER_STAR,
'W',
" ",
"P P",
" R ",
'P',
AE2_FLUIX_PEARL,
'R',
AE2_WIRELESS_RECEIVER));
}
public static void addInfiniteWaterCell() {
GameRegistry.addRecipe(
new ShapedOreRecipe(
INFINITY_WATER_CELL,
"BKB",
"ACF",
"BMB",
'B',
WATER_BUCKET,
'K',
CellType.Cell64kPart.stack(1),
'A',
AE2_ANNIHILATION_CORE,
'C',
CELL_HOUSING.stack(1, 1),
'F',
AE2_FORMATION_CORE,
'M',
AE2_MATTER_CONDENSER));
new ShapelessOreRecipe(INFINITY_WATER_CELL, CELL_HOUSING.stack(1, 1), CellType.Cell64kPart.stack(1)));
}
public static void runTerminalRecipe() {
ItemStack[] fc2Terms = { WIRELESS_ULTRA_TERM.stack(), WIRELESS_FLUID_TERM.stack(),
WIRELESS_PATTERN_TERM.stack(), WIRELESS_INTERFACE_TERM.stack(), WIRELESS_LEVEL_TERM.stack() };
for (ItemStack fc2term : fc2Terms) {
if (fc2term != null) {
if (ModAndClassUtil.WCT) { // deprecated, adding Infinity Booster Card from WCT mod
GameRegistry.addRecipe(new WirelessTerminalRecipe(fc2term));
}
GameRegistry.addRecipe(new WirelessTerminalQuantumBridgeRecipe(fc2term));
GameRegistry.addRecipe(new WirelessTerminalEnergyRecipe(fc2term));
}
for (ItemStack c : infCards) {
GameRegistry.addRecipe(new WirelessTerminalInfinityBoosterRecipe(WIRELESS_PATTERN_TERM.stack(), c));
GameRegistry.addRecipe(new WirelessTerminalInfinityBoosterRecipe(WIRELESS_FLUID_TERM.stack(), c));
GameRegistry.addRecipe(new WirelessTerminalInfinityBoosterRecipe(WIRELESS_ULTRA_TERM.stack(), c));
GameRegistry.addRecipe(new WirelessTerminalInfinityBoosterRecipe(WIRELESS_INTERFACE_TERM.stack(), c));
GameRegistry.addRecipe(new WirelessTerminalInfinityBoosterRecipe(WIRELESS_LEVEL_TERM.stack(), c));
}
for (ItemStack m : magnetCards) {
GameRegistry.addRecipe(new WirelessTerminalMagnetRecipe(WIRELESS_ULTRA_TERM.stack(), m));
}
for (ItemStack e : energyCards) {
GameRegistry.addRecipe(new WirelessTerminalEnergyRecipe(WIRELESS_ULTRA_TERM.stack(), e));
}
ItemStack[] term = { AE2_WIRELESS_TERMINAL, WIRELESS_FLUID_TERM.stack(), WIRELESS_PATTERN_TERM.stack(),
@@ -1,9 +1,11 @@
package com.glodblock.github.loader.recipe;
import static com.glodblock.github.loader.ItemAndBlockHolder.ENERGY_CARD;
import static com.glodblock.github.util.Util.DimensionalCoordSide.hasEnergyCard;
import static com.glodblock.github.util.Util.Wireless.hasEnergyCard;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import net.minecraft.inventory.InventoryCrafting;
@@ -19,20 +21,30 @@ import appeng.util.Platform;
public class WirelessTerminalEnergyRecipe extends ShapelessRecipes {
private final ItemStack installedTerm;
public static ItemStack energyCard = ENERGY_CARD.stack();
public static List<ItemStack> energyCards = getEnergyCards();
public WirelessTerminalEnergyRecipe(ItemStack term) {
super(term, Arrays.asList(term, getEnergyCard()));
public WirelessTerminalEnergyRecipe(ItemStack term, ItemStack energyCard) {
super(term, Arrays.asList(term, energyCard));
this.installedTerm = installEnergyCard(term);
}
private static List<ItemStack> getEnergyCards() {
return new ArrayList<ItemStack>() {
{
add(ENERGY_CARD.stack());
}
};
}
private boolean isEnergyCard(ItemStack is) {
if (is == null || is.getItem() == null) return false;
return (Objects.equals(energyCard.getItem(), is.getItem()));
}
public static ItemStack getEnergyCard() {
return energyCard;
for (ItemStack c : energyCards) {
if (Objects.equals(c.getItem(), is.getItem())) {
return true;
}
}
return false;
}
@Override
@@ -44,6 +56,10 @@ public class WirelessTerminalEnergyRecipe extends ShapelessRecipes {
&& isEnergyCard(card);
}
public static ItemStack getEnergyCard() {
return ENERGY_CARD.stack();
}
@Override
public ItemStack getCraftingResult(InventoryCrafting inv) {
return installEnergyCard(inv.getStackInSlot(0));
@@ -1,8 +1,12 @@
package com.glodblock.github.loader.recipe;
import static com.glodblock.github.util.Util.hasInfinityBoosterCard;
import static com.glodblock.github.loader.ItemAndBlockHolder.QUANTUM_BRIDGE_CARD;
import static com.glodblock.github.util.Util.Wireless.hasInfinityBoosterCard;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
@@ -10,18 +14,42 @@ import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
import net.p455w0rd.wirelesscraftingterminal.items.ItemInfinityBooster;
import com.glodblock.github.common.item.ItemBaseWirelessTerminal;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.ModAndClassUtil;
import appeng.util.Platform;
public class WirelessTerminalRecipe extends ShapelessRecipes {
public class WirelessTerminalInfinityBoosterRecipe extends ShapelessRecipes {
private static final ItemStack infinityBoosterCard = ItemEnum.BOOSTER_CARD.getStack();
private final ItemStack installedTerm;
public static List<ItemStack> infCards = getInfinityCards();
public WirelessTerminalRecipe(ItemStack term) {
private static List<ItemStack> getInfinityCards() {
List<ItemStack> list = new ArrayList<ItemStack>() {
{
add(QUANTUM_BRIDGE_CARD.stack());
}
};
if (ModAndClassUtil.WCT) {
list.add(ItemEnum.BOOSTER_CARD.getStack());
}
return list;
}
public boolean isInfinityCard(ItemStack is) {
if (is == null || is.getItem() == null) return false;
for (ItemStack c : infCards) {
if (Objects.equals(c.getItem(), is.getItem())) {
return true;
}
}
return false;
}
public WirelessTerminalInfinityBoosterRecipe(ItemStack term, ItemStack infinityBoosterCard) {
super(term, Arrays.asList(term, infinityBoosterCard));
this.installedTerm = installInfinityBoosterCard(term);
}
@@ -32,12 +60,11 @@ public class WirelessTerminalRecipe extends ShapelessRecipes {
ItemStack infinityBoosterCard = inv.getStackInSlot(1);
return term != null && term.getItem() instanceof ItemBaseWirelessTerminal
&& !hasInfinityBoosterCard(term)
&& infinityBoosterCard != null
&& infinityBoosterCard.getItem() instanceof ItemInfinityBooster;
&& isInfinityCard(infinityBoosterCard);
}
public static ItemStack getInfinityBoosterCard() {
return infinityBoosterCard.copy();
return ItemAndBlockHolder.QUANTUM_BRIDGE_CARD.stack();
}
@Override
@@ -0,0 +1,92 @@
package com.glodblock.github.loader.recipe;
import static com.glodblock.github.loader.ItemAndBlockHolder.MAGNET_CARD;
import static com.glodblock.github.util.Util.Wireless.hasMagnetCard;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
import com.glodblock.github.common.item.ItemBaseWirelessTerminal;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.ModAndClassUtil;
import appeng.util.Platform;
public class WirelessTerminalMagnetRecipe extends ShapelessRecipes {
private final ItemStack installedTerm;
public static List<ItemStack> magnetCards = getMagnetCards();
public WirelessTerminalMagnetRecipe(ItemStack term, ItemStack magnetCard) {
super(term, Arrays.asList(term, magnetCard));
this.installedTerm = installMagnetCard(term);
}
private static List<ItemStack> getMagnetCards() {
List<ItemStack> list = new ArrayList<ItemStack>() {
{
add(MAGNET_CARD.stack());
}
};
if (ModAndClassUtil.WCT) {
list.add(ItemEnum.MAGNET_CARD.getStack());
}
return list;
}
private boolean isMagnetCard(ItemStack is) {
if (is == null || is.getItem() == null) return false;
for (ItemStack c : magnetCards) {
if (Objects.equals(c.getItem(), is.getItem())) {
return true;
}
}
return false;
}
@Override
public boolean matches(InventoryCrafting inv, World w) {
ItemStack term = inv.getStackInSlot(0);
ItemStack magnetCard = inv.getStackInSlot(1);
return term != null && term.getItem() instanceof ItemBaseWirelessTerminal
&& !hasMagnetCard(term)
&& isMagnetCard(magnetCard);
}
public static ItemStack getMagnetCard() {
return ItemAndBlockHolder.MAGNET_CARD.stack();
}
@Override
public ItemStack getCraftingResult(InventoryCrafting inv) {
return installMagnetCard(inv.getStackInSlot(0));
}
@Override
public int getRecipeSize() {
return 2;
}
private ItemStack installMagnetCard(ItemStack is) {
is = is.copy();
NBTTagCompound data = Platform.openNbtData(is);
data.setBoolean(ItemBaseWirelessTerminal.magnetCard, true);
is.setTagCompound(data);
return is;
}
@Override
public ItemStack getRecipeOutput() {
return installedTerm;
}
}
@@ -1,70 +0,0 @@
package com.glodblock.github.loader.recipe;
import static com.glodblock.github.loader.ItemAndBlockHolder.QUANTUM_BRIDGE_CARD;
import static com.glodblock.github.util.Util.hasInfinityBoosterCard;
import java.util.Arrays;
import java.util.Objects;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import com.glodblock.github.common.item.ItemBaseWirelessTerminal;
import appeng.util.Platform;
public class WirelessTerminalQuantumBridgeRecipe extends ShapelessRecipes {
private final ItemStack installedTerm;
public static ItemStack quantumBridgeCard = QUANTUM_BRIDGE_CARD.stack();
public boolean isQuantumBridgeCard(ItemStack is) {
if (is == null || is.getItem() == null) return false;
return Objects.equals(quantumBridgeCard.getItem(), is.getItem());
}
public WirelessTerminalQuantumBridgeRecipe(ItemStack term) {
super(term, Arrays.asList(term, getQuantumBridgeCard()));
this.installedTerm = installQuantumBridgeCard(term);
}
@Override
public boolean matches(InventoryCrafting inv, World w) {
ItemStack term = inv.getStackInSlot(0);
ItemStack infinityBoosterCard = inv.getStackInSlot(1);
return term != null && term.getItem() instanceof ItemBaseWirelessTerminal
&& !hasInfinityBoosterCard(term)
&& isQuantumBridgeCard(infinityBoosterCard);
}
public static ItemStack getQuantumBridgeCard() {
return quantumBridgeCard;
}
@Override
public ItemStack getCraftingResult(InventoryCrafting inv) {
return installQuantumBridgeCard(inv.getStackInSlot(0));
}
@Override
public int getRecipeSize() {
return 2;
}
private ItemStack installQuantumBridgeCard(ItemStack is) {
is = is.copy();
NBTTagCompound data = Platform.openNbtData(is);
data.setBoolean(ItemBaseWirelessTerminal.infinityBoosterCard, true);
is.setTagCompound(data);
return is;
}
@Override
public ItemStack getRecipeOutput() {
return installedTerm;
}
}
@@ -33,7 +33,7 @@ public class DefaultExtractorLoader implements Runnable {
if (ModAndClassUtil.GT5) {
try {
Class<?> recipeMapClazz = Class.forName("gregtech.api.util.GTRecipe$GT_Recipe_Map");
Class<?> recipeMapClazz = Class.forName("gregtech.api.util.GT_Recipe$GT_Recipe_Map");
Collection<?> sMappings = (Collection<?>) recipeMapClazz.getDeclaredField("sMappings").get(null);
for (Object tMap : sMappings) {
String mNEIName = (String) recipeMapClazz.getDeclaredField("mNEIName").get(tMap);
@@ -5,6 +5,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicInteger;
import net.minecraft.item.ItemStack;
@@ -58,19 +59,30 @@ public final class FluidRecipe {
}
private static List<OrderStack<?>> getDefaultPackageInputs(TemplateRecipeHandler tRecipe, int index) {
List<OrderStack<?>> tmp = new LinkedList<>();
AtomicInteger i = new AtomicInteger(0);
tRecipe.getIngredientStacks(index)
.forEach(ps -> tmp.add(new OrderStack<>(ps.item, i.getAndIncrement(), ps.items)));
return tmp;
try {
List<OrderStack<?>> tmp = new LinkedList<>();
AtomicInteger i = new AtomicInteger(0);
tRecipe.getIngredientStacks(index).stream().filter(Objects::nonNull).filter(ps -> ps.item != null)
.forEach(ps -> tmp.add(new OrderStack<>(ps.item, i.getAndIncrement(), ps.items)));
return tmp;
} catch (Exception e) {
return Collections.emptyList();
}
}
private static List<OrderStack<?>> getDefaultPackageOutputs(TemplateRecipeHandler tRecipe, int index) {
List<OrderStack<?>> tmp = new LinkedList<>();
AtomicInteger i = new AtomicInteger(0);
tmp.add(new OrderStack<>(tRecipe.getResultStack(index).item, i.getAndIncrement()));
tRecipe.getOtherStacks(index).forEach(ps -> tmp.add(new OrderStack<>(ps.item, i.getAndIncrement())));
return tmp;
try {
List<OrderStack<?>> tmp = new LinkedList<>();
AtomicInteger i = new AtomicInteger(0);
if (tRecipe.getResultStack(index) != null) {
tmp.add(new OrderStack<>(tRecipe.getResultStack(index).item, i.getAndIncrement()));
}
tRecipe.getOtherStacks(index).stream().filter(Objects::nonNull).filter(ps -> ps.item != null)
.forEach(ps -> tmp.add(new OrderStack<>(ps.item, i.getAndIncrement())));
return tmp;
} catch (Exception e) {
return Collections.emptyList();
}
}
public static List<OrderStack<?>> getPackageOutputs(IRecipeHandler recipe, int index, boolean useOther) {
@@ -12,7 +12,7 @@ import com.glodblock.github.nei.object.OrderStack;
import codechicken.nei.PositionedStack;
import gregtech.api.enums.ItemList;
import gregtech.common.items.ItemFluidDisplay;
import gregtech.common.items.GT_FluidDisplayItem;
public class GregTech5RecipeExtractor implements IRecipeExtractor {
@@ -47,7 +47,7 @@ public class GregTech5RecipeExtractor implements IRecipeExtractor {
public static Object getFluidFromDisplay(PositionedStack stack) {
if (stack != null) {
ItemStack item = stack.items[0].copy();
if (item.getItem() instanceof ItemFluidDisplay) {
if (item.getItem() instanceof GT_FluidDisplayItem) {
if (item.getTagCompound() != null) {
Fluid fluid = FluidRegistry.getFluid(item.getItemDamage());
int amt = (int) item.getTagCompound().getLong("mFluidDisplayAmount");
@@ -14,17 +14,17 @@ import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IWirelessTerminal;
import com.glodblock.github.util.BlockPos;
import appeng.api.config.CraftingMode;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridHost;
import appeng.api.networking.IGridNode;
import appeng.api.networking.crafting.ICraftingGrid;
import appeng.api.networking.crafting.ICraftingJob;
import appeng.api.storage.data.IAEItemStack;
import appeng.container.ContainerOpenContext;
import appeng.container.implementations.ContainerCraftAmount;
import appeng.container.implementations.ContainerCraftConfirm;
import appeng.core.AELog;
import appeng.me.cache.CraftingGridCache;
import appeng.util.item.AEItemStack;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
@@ -34,33 +34,55 @@ public class CPacketCraftRequest implements IMessage {
private long amount;
private boolean heldShift;
private IAEItemStack item = null;
private Mode mode;
private CraftingMode craftingMode;
private enum Mode {
ITEM,
STACK_SIZE
}
public CPacketCraftRequest() {}
public CPacketCraftRequest(final int craftAmt, final boolean shift) {
this(craftAmt, shift, CraftingMode.STANDARD);
public CPacketCraftRequest(final IAEItemStack item, final boolean shift) {
this.item = item;
this.heldShift = shift;
this.mode = Mode.ITEM;
}
public CPacketCraftRequest(final int craftAmt, final boolean shift, final CraftingMode craftingMode) {
public CPacketCraftRequest(final long craftAmt, final boolean shift) {
amount = craftAmt;
heldShift = shift;
this.craftingMode = craftingMode;
mode = Mode.STACK_SIZE;
}
@Override
public void toBytes(ByteBuf buf) {
buf.writeLong(amount);
buf.writeBoolean(heldShift);
buf.writeBoolean(this.craftingMode == CraftingMode.STANDARD);
buf.writeInt(mode.ordinal());
if (mode == Mode.ITEM) {
try {
item.writeToPacket(buf);
buf.writeBoolean(heldShift);
} catch (Exception ignored) {}
} else {
buf.writeLong(amount);
buf.writeBoolean(heldShift);
}
}
@Override
public void fromBytes(ByteBuf buf) {
amount = buf.readLong();
heldShift = buf.readBoolean();
craftingMode = buf.readBoolean() ? CraftingMode.STANDARD : CraftingMode.IGNORE_MISSING;
mode = Mode.values()[buf.readInt()];
if (mode == Mode.ITEM) {
try {
item = AEItemStack.loadItemStackFromPacket(buf);
heldShift = buf.readBoolean();
} catch (Exception ignored) {}
} else {
amount = buf.readLong();
heldShift = buf.readBoolean();
}
}
public static class Handler implements IMessageHandler<CPacketCraftRequest, IMessage> {
@@ -88,22 +110,12 @@ public class CPacketCraftRequest implements IMessage {
Future<ICraftingJob> futureJob = null;
try {
final ICraftingGrid cg = g.getCache(ICraftingGrid.class);
if(cg instanceof CraftingGridCache cgc) {
futureJob = cgc.beginCraftingJob(
cca.getWorld(),
cca.getGrid(),
cca.getActionSrc(),
cca.getItemToCraft(),
message.craftingMode,
null);
}else {
futureJob = cg.beginCraftingJob(
cca.getWorld(),
cca.getGrid(),
cca.getActionSrc(),
cca.getItemToCraft(),
null);
}
futureJob = cg.beginCraftingJob(
cca.getWorld(),
cca.getGrid(),
cca.getActionSrc(),
cca.getItemToCraft(),
null);
final ContainerOpenContext context = cca.getOpenContext();
if (context != null) {
@@ -125,7 +137,6 @@ public class CPacketCraftRequest implements IMessage {
}
if (player.openContainer instanceof final ContainerCraftConfirm ccc) {
ccc.setItemToCraft(cca.getItemToCraft());
ccc.setAutoStart(message.heldShift);
ccc.setJob(futureJob);
cca.detectAndSendChanges();
Loaded 100 of 123 files, more files were not shown because too many files have changed in this diff. Show more