Compare commits

..
37 changed files with 1909 additions and 598 deletions

No files matched your search

+1608 -3
View File
File diff suppressed because it is too large. Load diff
+12 -12
View File
@@ -34,25 +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.5.24-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-340-GTNH:dev')
api('com.github.GTNewHorizons:NotEnoughItems:2.4.13-GTNH:dev')
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-292-GTNH:dev')
api('curse.maven:cofh-core-69162:2388751')
api('com.github.GTNewHorizons:waila:1.7.1:dev')
api('com.github.GTNewHorizons:waila:1.6.5:dev')
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.11.1:dev")
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.10.1:dev")
compileOnly('com.github.GTNewHorizons:Baubles:1.0.4:dev')
compileOnly('com.github.GTNewHorizons:Baubles:1.0.3:dev')
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.34:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ForestryMC:4.8.7:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.7.1:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.45.100:dev') {
compileOnly('com.github.GTNewHorizons:ForestryMC:4.7.0:dev')
compileOnly('com.github.GTNewHorizons:EnderIO:2.5.6:dev')
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.44.106:dev') {
exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework'
}
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.7-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.6.3-GTNH:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.4.35:dev") { transitive = false }
compileOnly('com.github.GTNewHorizons:OpenComputers:1.9.19-GTNH:dev') { transitive = false }
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.5.4-GTNH:dev') { transitive = false }
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.3.39:dev") { transitive = false }
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.2.2:dev")
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.1.7:dev")
}
+28 -149
View File
@@ -1,192 +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
# 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 the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories.
includeWellKnownRepositories = true
# 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.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+8 -9
View File
@@ -83,8 +83,7 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -145,7 +144,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -153,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -202,11 +201,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Vendored
+10 -10
View File
@@ -43,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
@@ -57,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
+10 -5
View File
@@ -4,10 +4,10 @@ pluginManagement {
maven {
// RetroFuturaGradle
name "GTNH Maven"
url "https://nexus.gtnewhorizons.com/repository/public/"
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
allowInsecureProtocol = true
mavenContent {
includeGroup("com.gtnewhorizons")
includeGroupByRegex("com\\.gtnewhorizons\\..+")
includeGroup("com.gtnewhorizons.retrofuturagradle")
}
}
gradlePluginPortal()
@@ -17,7 +17,12 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.17'
id 'com.diffplug.blowdryerSetup' version '1.6.0'
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains
}
blowdryerSetup {
repoSubfolder 'gtnhShared'
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.2.0')
//devLocal '.' // Use this when testing config updates locally
}
@@ -17,7 +17,6 @@ import com.glodblock.github.util.NameConst;
import appeng.api.config.AdvancedBlockingMode;
import appeng.api.config.InsertionMode;
import appeng.api.config.LockCraftingMode;
import appeng.api.config.Settings;
import appeng.api.config.SidelessMode;
import appeng.api.config.Upgrades;
@@ -41,7 +40,6 @@ public class GuiDualInterface extends GuiUpgradeable {
private GuiImgButton insertionMode;
private GuiImgButton sidelessMode;
private GuiImgButton advancedBlockingMode;
private GuiImgButton lockCraftingMode;
private final IInterfaceHost host;
public GuiDualInterface(InventoryPlayer inventoryPlayer, IInterfaceHost te) {
@@ -105,14 +103,6 @@ public class GuiDualInterface extends GuiUpgradeable {
SidelessMode.SIDELESS);
this.buttonList.add(this.sidelessMode);
}
this.lockCraftingMode = new GuiImgButton(
this.guiLeft - 18,
this.guiTop + 98,
Settings.LOCK_CRAFTING_MODE,
LockCraftingMode.NONE);
this.lockCraftingMode.visible = this.bc.getInstalledUpgrades(Upgrades.LOCK_CRAFTING) > 0;
this.buttonList.add(lockCraftingMode);
}
@Override
@@ -133,9 +123,6 @@ public class GuiDualInterface extends GuiUpgradeable {
if (this.advancedBlockingMode != null) {
this.advancedBlockingMode.set(((ContainerDualInterface) this.cvb).getAdvancedBlockingMode());
}
if (this.lockCraftingMode != null) {
this.lockCraftingMode.set(((ContainerInterface) this.cvb).getLockCraftingMode());
}
this.fontRendererObj.drawString(
getGuiDisplayName(StatCollector.translateToLocal(NameConst.GUI_FLUID_INTERFACE)),
8,
@@ -174,8 +161,6 @@ public class GuiDualInterface extends GuiUpgradeable {
} else if (btn == this.advancedBlockingMode) {
NetworkHandler.instance
.sendToServer(new PacketConfigButton(this.advancedBlockingMode.getSetting(), backwards));
} else if (btn == this.lockCraftingMode) {
NetworkHandler.instance.sendToServer(new PacketConfigButton(this.lockCraftingMode.getSetting(), backwards));
}
}
@@ -193,8 +178,5 @@ public class GuiDualInterface extends GuiUpgradeable {
if (this.advancedBlockingMode != null) {
this.advancedBlockingMode.setVisibility(this.bc.getInstalledUpgrades(Upgrades.ADVANCED_BLOCKING) > 0);
}
if (this.lockCraftingMode != null) {
this.lockCraftingMode.setVisibility(this.bc.getInstalledUpgrades(Upgrades.LOCK_CRAFTING) > 0);
}
}
}
@@ -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);
@@ -4,7 +4,6 @@ import java.util.List;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import com.glodblock.github.client.gui.base.FCGuiMonitor;
import com.glodblock.github.client.gui.container.ContainerFluidMonitor;
@@ -56,9 +55,8 @@ public class GuiFluidMonitor extends FCGuiMonitor<IAEFluidStack> {
@Override
public void setTextFieldValue(String displayName, int mousex, int mousey, ItemStack stack) {
final FluidStack fluid = Util.getFluidFromItem(stack);
if (fluid != null) {
setSearchString(fluid.getLocalizedName(), true);
if (Util.getFluidFromItem(stack) != null) {
setSearchString(Util.getFluidFromItem(stack).getLocalizedName(), true);
}
}
}
@@ -318,18 +318,19 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
}
}
public GuiType getOriginalGui() {
return originalGui;
}
public void switchGui() {
CPacketLevelTerminalCommands message = new CPacketLevelTerminalCommands(
CPacketLevelTerminalCommands.Action.BACK,
originalBlockPos.x,
originalBlockPos.y,
originalBlockPos.z,
originalBlockPos.getDimension(),
originalBlockPos.getSide());
if (originalGui != null) {
message.setOriginalGui(originalGui.ordinal());
}
FluidCraft.proxy.netHandler.sendToServer(message);
FluidCraft.proxy.netHandler.sendToServer(
new CPacketLevelTerminalCommands(
CPacketLevelTerminalCommands.Action.BACK,
originalBlockPos.x,
originalBlockPos.y,
originalBlockPos.z,
originalBlockPos.getDimension(),
originalBlockPos.getSide()));
}
@Override
@@ -9,14 +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.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;
@@ -27,7 +25,6 @@ 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;
@@ -60,7 +57,6 @@ 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;
@@ -588,6 +584,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))
@@ -601,8 +598,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);
@@ -618,9 +616,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();
@@ -659,21 +657,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);
@@ -681,9 +671,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);
@@ -698,11 +688,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);
}
}
@@ -950,26 +940,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;
}
@@ -1416,8 +1386,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
if (action != null) {
ItemStack itemStack = getInventory().getStackInSlot(slotIdx);
if (itemStack != null && itemStack.hasTagCompound()
&& itemStack.getTagCompound().hasKey(TLMTags.Stack.tagName)) {
if (itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey(TLMTags.Stack.tagName)) {
long batch = itemStack.getTagCompound().getLong(TLMTags.Batch.tagName);
NBTTagCompound stackData = itemStack.getTagCompound().getCompoundTag(TLMTags.Stack.tagName);
ItemStack is = ItemStack.loadItemStackFromNBT(stackData);
@@ -35,8 +35,6 @@ public class GuiRenamer extends AEBaseGui implements IDropToFillTextField {
protected ItemStack icon = null;
protected GuiType originalGui;
public GuiRenamer(InventoryPlayer ip, ITerminalHost monitorable) {
super(new ContainerRenamer(ip, monitorable));
this.host = monitorable;
@@ -53,16 +51,12 @@ public class GuiRenamer extends AEBaseGui implements IDropToFillTextField {
FluidCraft.proxy.netHandler.sendToServer(new CPacketRenamer(CPacketRenamer.Action.GET_TEXT));
if (host instanceof PartLevelTerminal) {
icon = ItemAndBlockHolder.LEVEL_TERMINAL.stack();
originalGui = GuiType.LEVEL_TERMINAL;
} else if (host instanceof IWirelessTerminal terminal && terminal.isUniversal(host)) {
icon = ItemAndBlockHolder.WIRELESS_ULTRA_TERM.stack();
originalGui = ItemWirelessUltraTerminal.readMode(terminal.getItemStack());
} else if (host instanceof WirelessLevelTerminalInventory) {
icon = ItemAndBlockHolder.WIRELESS_LEVEL_TERM.stack();
originalGui = GuiType.WIRELESS_LEVEL_TERMINAL;
} else if (host instanceof WirelessInterfaceTerminalInventory) {
icon = ItemAndBlockHolder.WIRELESS_INTERFACE_TERM.stack();
originalGui = GuiType.WIRELESS_INTERFACE_TERMINAL;
}
if (this.icon != null) {
this.buttonList.add(
@@ -120,9 +114,13 @@ public class GuiRenamer extends AEBaseGui implements IDropToFillTextField {
}
public void switchGui() {
if (originalGui != null) {
InventoryHandler.switchGui(originalGui);
}
if (host instanceof PartLevelTerminal) InventoryHandler.switchGui(GuiType.LEVEL_TERMINAL);
else if (host instanceof IWirelessTerminal terminal && terminal.isUniversal(host))
InventoryHandler.switchGui(ItemWirelessUltraTerminal.readMode(terminal.getItemStack()));
else if (host instanceof WirelessInterfaceTerminalInventory)
InventoryHandler.switchGui(GuiType.WIRELESS_INTERFACE_TERMINAL);
else if (host instanceof WirelessLevelTerminalInventory)
InventoryHandler.switchGui(GuiType.WIRELESS_LEVEL_TERMINAL);
}
public void setTextFieldValue(final String displayName, final int mousex, final int mousey, final ItemStack stack) {
@@ -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());
@@ -101,7 +101,6 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
protected GuiImgButton terminalStyleBox;
protected GuiImgButton searchStringSave;
protected GuiImgButton typeFilter;
protected boolean hasShiftKeyDown = false;
@SuppressWarnings("unchecked")
public FCGuiMonitor(final InventoryPlayer inventoryPlayer, final ITerminalHost te, final FCContainerMonitor<T> c) {
@@ -773,14 +772,4 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends FCBaseMEGui
public boolean isOverTextField(int mousex, int mousey) {
return searchField.isMouseIn(mousex, mousey);
}
@Override
public void handleKeyboardInput() {
super.handleKeyboardInput();
hasShiftKeyDown |= isShiftKeyDown();
if (hasShiftKeyDown && !Keyboard.getEventKeyState()) { // keyup
this.repo.updateView();
hasShiftKeyDown = false;
}
}
}
@@ -17,7 +17,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
import com.glodblock.github.client.gui.container.ContainerItemMonitor;
import com.glodblock.github.common.item.ItemFluidDrop;
@@ -131,19 +133,17 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
}
Slot slot = getSlot(slotId);
ItemStack stack = player.inventory.getItemStack();
FluidStack fluid = Util.getFluidFromItem(stack);
if (fluid == null || fluid.amount <= 0) {
if (Util.getFluidFromItem(stack) == null || Util.getFluidFromItem(stack).amount <= 0) {
super.doAction(player, action, slotId, id);
return;
}
if (validPatternSlot(slot)) {
if (validPatternSlot(slot)
&& (stack.getItem() instanceof IFluidContainerItem || FluidContainerRegistry.isContainer(stack))) {
FluidStack fluid = null;
switch (action) {
case PICKUP_OR_SET_DOWN -> {
fluid = Util.getFluidFromItem(stack);
slot.putStack(ItemFluidPacket.newStack(fluid));
return;
}
case SPLIT_OR_PLACE_SINGLE -> {
fluid = Util.getFluidFromItem(Util.copyStackWithSize(stack, 1));
@@ -153,10 +153,13 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
if (fluid.amount <= 0) fluid = null;
}
slot.putStack(ItemFluidPacket.newStack(fluid));
return;
}
}
if (fluid == null) {
super.doAction(player, action, slotId, id);
return;
}
return;
}
super.doAction(player, action, slotId, id);
}
@@ -29,7 +29,7 @@ public class EssentiaRepo extends FluidRepo {
@Override
public void updateView() {
if (needUpdateView()) this.view.clear();
this.view.clear();
this.dsp.clear();
this.view.ensureCapacity(this.list.size());
@@ -58,7 +58,7 @@ public class EssentiaRepo extends FluidRepo {
}
}
for (IAEItemStack is : needUpdateView() ? this.list : this.cache) {
for (IAEItemStack is : this.list) {
if (this.myPartitionList != null) {
if (!this.myPartitionList.isListed(is)) {
continue;
@@ -87,30 +87,26 @@ public class EssentiaRepo extends FluidRepo {
this.view.add(is);
}
}
if (needUpdateView()) {
final Enum<?> SortBy = this.sortSrc.getSortBy();
final Enum<?> SortDir = this.sortSrc.getSortDir();
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
FluidSorters.init();
final Enum<?> SortBy = this.sortSrc.getSortBy();
final Enum<?> SortDir = this.sortSrc.getSortDir();
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);
}
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
FluidSorters.init();
if (SortBy == SortOrder.MOD) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_MOD);
} else if (SortBy == SortOrder.AMOUNT) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_SIZE);
} else if (SortBy == SortOrder.INVTWEAKS) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
} else {
this.cache.clear();
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_NAME);
}
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,8 +10,6 @@
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;
@@ -47,14 +45,12 @@ 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;
@@ -90,19 +86,11 @@ 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);
@@ -111,7 +99,7 @@ public class FluidRepo implements IDisplayRepo {
@Override
public void updateView() {
if (needUpdateView()) this.view.clear();
this.view.clear();
this.dsp.clear();
this.view.ensureCapacity(this.list.size());
@@ -142,7 +130,7 @@ public class FluidRepo implements IDisplayRepo {
}
}
for (IAEItemStack is : needUpdateView() ? this.list : this.cache) {
for (IAEItemStack is : this.list) {
if (this.myPartitionList != null) {
if (!this.myPartitionList.isListed(is)) {
continue;
@@ -179,30 +167,26 @@ public class FluidRepo implements IDisplayRepo {
}
}
}
if (needUpdateView()) {
final Enum<?> SortBy = this.sortSrc.getSortBy();
final Enum<?> SortDir = this.sortSrc.getSortDir();
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
FluidSorters.init();
final Enum<?> SortBy = this.sortSrc.getSortBy();
final Enum<?> SortDir = this.sortSrc.getSortDir();
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);
}
FluidSorters.setDirection((appeng.api.config.SortDir) SortDir);
FluidSorters.init();
if (SortBy == SortOrder.MOD) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_MOD);
} else if (SortBy == SortOrder.AMOUNT) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_SIZE);
} else if (SortBy == SortOrder.INVTWEAKS) {
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_INV_TWEAKS);
} else {
this.cache.clear();
this.view.sort(FluidSorters.CONFIG_BASED_SORT_BY_NAME);
}
for (final IAEItemStack is : this.view) {
this.dsp.add(is.getItemStack());
}
this.lastSearchString = this.searchString;
}
protected void updateNEI(final String filter) {
@@ -2,7 +2,6 @@ package com.glodblock.github.common.block;
import java.util.EnumSet;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
@@ -62,14 +61,6 @@ public class BlockFluidInterface extends FCBaseBlock {
return false;
}
@Override
public void onNeighborBlockChange(World worldIn, int x, int y, int z, Block neighbor) {
TileFluidInterface tile = this.getTileEntity(worldIn, x, y, z);
if (tile != null) {
tile.getInterfaceDuality().updateRedstoneState();
}
}
@Override
protected boolean hasCustomRotation() {
return true;
@@ -16,8 +16,8 @@ import net.minecraftforge.common.util.ForgeDirection;
import com.glodblock.github.api.FluidCraftAPI;
import com.glodblock.github.common.storage.CellType;
import com.glodblock.github.common.storage.FluidCellInventoryHandler;
import com.glodblock.github.common.storage.IFluidCellInventory;
import com.glodblock.github.common.storage.IFluidCellInventoryHandler;
import com.glodblock.github.common.storage.IStorageFluidCell;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.NameConst;
@@ -96,7 +96,7 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell()
.getCellInventory(stack, null, StorageChannel.FLUIDS);
if (inventory instanceof final FluidCellInventoryHandler handler) {
if (inventory instanceof final IFluidCellInventoryHandler handler) {
final IFluidCellInventory cellInventory = handler.getCellInv();
if (cellInventory != null) {
@@ -155,9 +155,6 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
} else {
lines.add(StatCollector.translateToLocal(NameConst.TT_SHIFT_FOR_MORE));
}
if (handler.getSticky()) {
lines.add(GuiText.Sticky.getLocal());
}
}
}
}
@@ -190,7 +187,7 @@ public abstract class FCBaseItemCell extends AEBaseItem implements IStorageFluid
@Override
public IInventory getUpgradesInventory(ItemStack is) {
return new CellUpgrades(is, 2);
return new CellUpgrades(is, 0);
}
@Override
@@ -24,19 +24,27 @@ import com.glodblock.github.util.BlockPos;
import com.glodblock.github.util.DualityFluidInterface;
import com.glodblock.github.util.Util;
import appeng.api.config.Actionable;
import appeng.api.config.Upgrades;
import appeng.api.networking.IGridNode;
import appeng.api.networking.energy.IEnergyGrid;
import appeng.api.networking.events.MENetworkChannelsChanged;
import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.MachineSource;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
import appeng.api.parts.IPartRenderHelper;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.texture.CableBusTextures;
import appeng.me.GridAccessException;
import appeng.parts.misc.PartInterface;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.util.Platform;
import appeng.util.item.AEFluidStack;
import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -44,6 +52,7 @@ import io.netty.buffer.ByteBuf;
public class PartFluidInterface extends PartInterface implements IDualHost {
private final BaseActionSource ownActionSource = new MachineSource(this);
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, 6);
private final DualityFluidInterface fluidDuality = new DualityFluidInterface(this.getProxy(), this);
@@ -192,9 +201,35 @@ public class PartFluidInterface extends PartInterface implements IDualHost {
return getInterfaceDuality().getInstalledUpgrades(u);
}
private IMEMonitor<IAEFluidStack> getFluidGrid() {
try {
return getProxy().getGrid().<IStorageGrid>getCache(IStorageGrid.class).getFluidInventory();
} catch (GridAccessException e) {
return null;
}
}
private IEnergyGrid getEnergyGrid() {
try {
return getProxy().getGrid().getCache(IEnergyGrid.class);
} catch (GridAccessException e) {
return null;
}
}
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
return fluidDuality.fill(from, resource, doFill);
IMEMonitor<IAEFluidStack> fluidGrid = getFluidGrid();
IEnergyGrid energyGrid = getEnergyGrid();
if (energyGrid == null || fluidGrid == null || resource == null) return 0;
int ori = resource.amount;
IAEFluidStack remove;
if (doFill) {
remove = fluidGrid.injectItems(AEFluidStack.create(resource), Actionable.MODULATE, ownActionSource);
} else {
remove = fluidGrid.injectItems(AEFluidStack.create(resource), Actionable.SIMULATE, ownActionSource);
}
return remove == null ? ori : (int) (ori - remove.getStackSize());
}
@Override
@@ -209,12 +244,12 @@ public class PartFluidInterface extends PartInterface implements IDualHost {
@Override
public boolean canFill(ForgeDirection from, Fluid fluid) {
return fluidDuality.canFill(from, fluid);
return true;
}
@Override
public boolean canDrain(ForgeDirection from, Fluid fluid) {
return fluidDuality.canDrain(from, fluid);
return true;
}
@Override
@@ -38,11 +38,14 @@ import appeng.api.networking.IGridNode;
import appeng.api.networking.crafting.ICraftingLink;
import appeng.api.networking.crafting.ICraftingPatternDetails;
import appeng.api.networking.crafting.ICraftingProviderHelper;
import appeng.api.networking.energy.IEnergyGrid;
import appeng.api.networking.events.MENetworkChannelsChanged;
import appeng.api.networking.events.MENetworkCraftingPatternChange;
import appeng.api.networking.events.MENetworkEventSubscribe;
import appeng.api.networking.events.MENetworkPowerStatusChange;
import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.security.MachineSource;
import appeng.api.networking.storage.IStorageGrid;
import appeng.api.networking.ticking.IGridTickable;
import appeng.api.networking.ticking.TickRateModulation;
import appeng.api.networking.ticking.TickingRequest;
@@ -65,6 +68,7 @@ import appeng.tile.inventory.IAEAppEngInventory;
import appeng.tile.inventory.InvOperation;
import appeng.util.Platform;
import appeng.util.inv.IInventoryDestination;
import appeng.util.item.AEFluidStack;
public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInterface>
implements IGridTickable, IStorageMonitorable, IInventoryDestination, IDualHost, ISidedInventory,
@@ -104,6 +108,7 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
};
private final DualityFluidInterface dualityFluid = new DualityFluidInterface(this.getProxy(), this);
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, 6);
private final BaseActionSource ownActionSource = new MachineSource(this);
public PartFluidP2PInterface(ItemStack is) {
super(is);
@@ -127,11 +132,6 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
dualityFluid.gridChanged();
}
@Override
public void onNeighborChanged() {
this.duality.updateRedstoneState();
}
@Override
public boolean onPartActivate(final EntityPlayer player, final Vec3 pos) {
AppEngInternalInventory patterns = (AppEngInternalInventory) duality.getPatterns();
@@ -350,9 +350,35 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
return true;
}
private IMEMonitor<IAEFluidStack> getFluidGrid() {
try {
return getProxy().getGrid().<IStorageGrid>getCache(IStorageGrid.class).getFluidInventory();
} catch (GridAccessException e) {
return null;
}
}
private IEnergyGrid getEnergyGrid() {
try {
return getProxy().getGrid().getCache(IEnergyGrid.class);
} catch (GridAccessException e) {
return null;
}
}
@Override
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
return dualityFluid.fill(from, resource, doFill);
IMEMonitor<IAEFluidStack> fluidGrid = getFluidGrid();
IEnergyGrid energyGrid = getEnergyGrid();
if (energyGrid == null || fluidGrid == null || resource == null) return 0;
int ori = resource.amount;
IAEFluidStack remove;
if (doFill) {
remove = fluidGrid.injectItems(AEFluidStack.create(resource), Actionable.MODULATE, ownActionSource);
} else {
remove = fluidGrid.injectItems(AEFluidStack.create(resource), Actionable.SIMULATE, ownActionSource);
}
return remove == null ? ori : (int) (ori - remove.getStackSize());
}
@Override
@@ -367,12 +393,12 @@ public class PartFluidP2PInterface extends PartP2PTunnelStatic<PartFluidP2PInter
@Override
public boolean canFill(ForgeDirection from, Fluid fluid) {
return dualityFluid.canFill(from, fluid);
return true;
}
@Override
public boolean canDrain(ForgeDirection from, Fluid fluid) {
return dualityFluid.canDrain(from, fluid);
return true;
}
@Override
@@ -401,11 +401,6 @@ public class FluidCellInventory implements IFluidCellInventory {
return ret;
}
@Override
public IInventory getUpgradesInventory() {
return this.cellType.getUpgradesInventory(this.cellItem);
}
@Override
public StorageChannel getChannel() {
return StorageChannel.FLUIDS;
@@ -2,15 +2,12 @@ package com.glodblock.github.common.storage;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import com.glodblock.github.util.Ae2Reflect;
import com.glodblock.github.util.Util;
import appeng.api.AEApi;
import appeng.api.config.IncludeExclude;
import appeng.api.config.Upgrades;
import appeng.api.implementations.items.IUpgradeModule;
import appeng.api.storage.ICellCacheRegistry;
import appeng.api.storage.IMEInventory;
import appeng.api.storage.StorageChannel;
@@ -35,32 +32,13 @@ public class FluidCellInventoryHandler extends MEInventoryHandler<IAEFluidStack>
final IItemList<IAEFluidStack> priorityList = AEApi.instance().storage().createFluidList();
for (int x = 0; x < config.getSizeInventory(); x++) {
final ItemStack is = config.getStackInSlot(x);
final FluidStack fluid = Util.getFluidFromItem(is);
if (fluid != null) {
priorityList.add(AEFluidStack.create(fluid));
if (Util.getFluidFromItem(is) != null) {
priorityList.add(AEFluidStack.create(Util.getFluidFromItem(is)));
}
}
if (!priorityList.isEmpty()) {
this.setPartitionList(new PrecisePriorityList<>(priorityList));
}
final IInventory upgrades = ci.getUpgradesInventory();
boolean hasSticky = false;
for (int x = 0; x < upgrades.getSizeInventory(); x++) {
final ItemStack is = upgrades.getStackInSlot(x);
if (is != null && is.getItem() instanceof IUpgradeModule) {
final Upgrades u = ((IUpgradeModule) is.getItem()).getType(is);
if (u == Upgrades.STICKY) {
hasSticky = true;
break;
}
}
}
if (hasSticky) {
setSticky(true);
}
}
}
@@ -86,9 +86,4 @@ public interface IFluidCellInventory extends IMEInventory<IAEFluidStack> {
long getTotalFluidTypes();
List<IAEFluidStack> getContents();
/**
* @return access installed upgrades.
*/
IInventory getUpgradesInventory();
}
@@ -187,7 +187,7 @@ public class TileFluidInterface extends TileInterface implements IDualHost {
@Override
public boolean canDrain(ForgeDirection from, Fluid fluid) {
return fluidDuality.canDrain(from, fluid);
return true;
}
@Override
@@ -60,7 +60,6 @@ public class TileLevelMaintainer extends AENetworkTile
public static final int REQ_COUNT = 5;
public final InventoryRequest requests = new InventoryRequest(this);
private int firstRequest = 0;
private final BaseActionSource source;
private final IInventory inv = new AeItemStackHandler(requests.requestStacks);
private boolean isPowered = false;
@@ -140,17 +139,7 @@ public class TileLevelMaintainer extends AENetworkTile
final ICraftingGrid craftingGrid = getProxy().getCrafting();
final IGrid grid = getProxy().getGrid();
final IItemList<IAEItemStack> inv = getProxy().getStorage().getItemInventory().getStorageList();
// Find a request that we can submit to the network.
// If there is none, find the next request we can begin calculating.
ICraftingJob jobToSubmit = null;
int jobToSubmitIdx = -1;
IAEItemStack itemToBegin = null;
int itemToBeginIdx = -1;
for (int j = 0; j < REQ_COUNT; ++j) {
int i = (firstRequest + j) % REQ_COUNT;
for (int i = 0; i < REQ_COUNT; i++) {
long quantity = requests.getQuantity(i);
long batchSize = requests.getBatchSize(i);
boolean isEnable = requests.isEnable(i);
@@ -170,18 +159,28 @@ public class TileLevelMaintainer extends AENetworkTile
// do crafting
Future<ICraftingJob> jobTask = requests.getJob(i);
if (jobTask == null) {
if (itemToBegin == null) {
itemToBegin = craftItem;
itemToBeginIdx = i;
}
requests.updateJob(
i,
craftingGrid.beginCraftingJob(getWorldObj(), grid, source, craftItem, null));
requests.updateState(i, State.Craft);
// calculate only one job per tick request
return TickRateModulation.SAME;
} else if (jobTask.isDone()) {
requests.updateState(i, State.Craft);
try {
ICraftingJob job = jobTask.get();
if (job != null) {
if (jobToSubmit == null) {
jobToSubmit = job;
jobToSubmitIdx = i;
ICraftingLink link = craftingGrid.submitJob(job, this, null, false, source);
requests.updateJob(i, null);
if (link != null) {
requests.updateState(i, State.Craft);
requests.updateLink(i, link);
// submit only one job per tick request
return TickRateModulation.SAME;
} else {
requests.updateState(i, State.Error);
}
} else {
requests.updateState(i, State.Error);
@@ -192,31 +191,6 @@ public class TileLevelMaintainer extends AENetworkTile
}
}
}
if (jobToSubmit != null) {
// Finished calculating a request, try to submit it.
ICraftingLink link = craftingGrid.submitJob(jobToSubmit, this, null, false, source);
requests.updateJob(jobToSubmitIdx, null);
if (link != null) {
requests.updateState(jobToSubmitIdx, State.Craft);
requests.updateLink(jobToSubmitIdx, link);
} else {
requests.updateState(jobToSubmitIdx, State.Error);
}
} else if (itemToBegin != null) {
// No jobs to submit, start calculating some item.
requests.updateJob(
itemToBeginIdx,
craftingGrid.beginCraftingJob(getWorldObj(), grid, source, itemToBegin, null));
requests.updateState(itemToBeginIdx, State.Craft);
// Try the next item next time.
firstRequest = (firstRequest + 1) % REQ_COUNT;
} else {
// No work to be done:
// Every item is at desired quantity, being crafted, or has no patterns.
return TickRateModulation.IDLE;
}
} catch (final GridAccessException ignore) {
}
@@ -374,8 +348,7 @@ public class TileLevelMaintainer extends AENetworkTile
}
private ItemStack removeRecursion(ItemStack itemStack) {
if (itemStack != null && itemStack.hasTagCompound()
&& itemStack.getTagCompound().hasKey(TLMTags.Stack.tagName)) {
if (itemStack.hasTagCompound() && itemStack.getTagCompound().hasKey(TLMTags.Stack.tagName)) {
return removeRecursion(loadItemStackFromTag(itemStack));
}
return itemStack;
@@ -10,9 +10,11 @@ import net.minecraftforge.common.util.ForgeDirection;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.tile.TileLevelMaintainer;
import com.glodblock.github.inventory.AeItemStackHandler;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.NameConst;
import appeng.util.item.AEItemStack;
import cpw.mods.fml.common.registry.GameRegistry;
import li.cil.oc.api.driver.EnvironmentProvider;
import li.cil.oc.api.driver.NamedBlock;
@@ -122,7 +124,9 @@ public class DriverLevelMaintainer extends DriverSidedTileEntity {
if (dbStack == null) {
throw new IllegalArgumentException("Invalid slot");
}
tileEntity.requests.updateStack(slot, dbStack);
dbStack.stackSize = 1;
((AeItemStackHandler) tileEntity.getInventory()).getAeInventory()
.setStack(slot, AEItemStack.create(dbStack));
} else {
throw new IllegalArgumentException("Not a database");
}
@@ -338,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) {
@@ -24,7 +24,6 @@ import com.glodblock.github.network.SPacketMEFluidInvUpdate;
import com.glodblock.github.network.SPacketMEItemInvUpdate;
import com.glodblock.github.network.SPacketSetItemAmount;
import com.glodblock.github.network.SPacketStringUpdate;
import com.glodblock.github.network.SPacketSwitchBack;
import com.glodblock.github.network.wrapper.FCNetworkWrapper;
import cpw.mods.fml.relauncher.Side;
@@ -67,7 +66,6 @@ public class ChannelLoader implements Runnable {
netHandler.registerMessage(new SPacketSetItemAmount.Handler(), SPacketSetItemAmount.class, id++, Side.CLIENT);
netHandler.registerMessage(new CPacketRenamer.Handler(), CPacketRenamer.class, id++, Side.SERVER);
netHandler.registerMessage(new SPacketStringUpdate.Handler(), SPacketStringUpdate.class, id++, Side.CLIENT);
netHandler.registerMessage(new SPacketSwitchBack.Handler(), SPacketSwitchBack.class, id++, Side.CLIENT);
netHandler.registerMessage(
new SPacketLevelTerminalUpdate.Handler(),
SPacketLevelTerminalUpdate.class,
@@ -1,10 +1,13 @@
package com.glodblock.github.network;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.util.ForgeDirection;
import com.glodblock.github.client.gui.GuiLevelMaintainer;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IClickableInTerminal;
@@ -25,7 +28,6 @@ public class CPacketLevelTerminalCommands implements IMessage {
private int z;
private int dim;
private ForgeDirection side;
private int originalGui = -1;
public enum Action {
EDIT,
@@ -47,30 +49,17 @@ public class CPacketLevelTerminalCommands implements IMessage {
this.side = side;
}
public CPacketLevelTerminalCommands setOriginalGui(int originalGui) {
this.originalGui = originalGui;
return this;
}
@Override
public void fromBytes(ByteBuf buf) {
action = Action.values()[buf.readInt()];
switch (action) {
case EDIT -> {
case EDIT, BACK -> {
x = buf.readInt();
y = buf.readInt();
z = buf.readInt();
dim = buf.readInt();
side = ForgeDirection.getOrientation(buf.readInt());
}
case BACK -> {
x = buf.readInt();
y = buf.readInt();
z = buf.readInt();
dim = buf.readInt();
side = ForgeDirection.getOrientation(buf.readInt());
originalGui = buf.readInt();
}
case ENABLE -> {}
case DISABLE -> {}
case ENABLE_ALL -> {}
@@ -82,21 +71,13 @@ public class CPacketLevelTerminalCommands implements IMessage {
public void toBytes(ByteBuf buf) {
buf.writeInt(action.ordinal());
switch (action) {
case EDIT -> {
case EDIT, BACK -> {
buf.writeInt(x);
buf.writeInt(y);
buf.writeInt(z);
buf.writeInt(dim);
buf.writeInt(side.ordinal());
}
case BACK -> {
buf.writeInt(x);
buf.writeInt(y);
buf.writeInt(z);
buf.writeInt(dim);
buf.writeInt(side.ordinal());
buf.writeInt(originalGui);
}
case ENABLE -> {}
case DISABLE -> {}
case ENABLE_ALL -> {}
@@ -122,7 +103,11 @@ public class CPacketLevelTerminalCommands implements IMessage {
GuiType.LEVEL_MAINTAINER);
}
case BACK -> {
GuiType originalGui = GuiType.getByOrdinal(message.originalGui);
GuiType originalGui = null;
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
if (gs instanceof GuiLevelMaintainer guiLevelMaintainer) {
originalGui = guiLevelMaintainer.getOriginalGui();
}
if (originalGui == null) {
return null;
}
@@ -1,11 +1,14 @@
package com.glodblock.github.network;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.DimensionManager;
import net.minecraftforge.common.util.ForgeDirection;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.GuiRenamer;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.inventory.item.IClickableInTerminal;
@@ -176,7 +179,10 @@ public class CPacketRenamer implements IMessage {
.getTileEntity(intMsg.x, intMsg.y, intMsg.z);
this.setName(tile, intMsg.getSide(), message.text);
FluidCraft.proxy.netHandler.sendTo(new SPacketSwitchBack(), player);
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
if (gs instanceof GuiRenamer guiRenamer) {
guiRenamer.switchGui();
}
}
}
}
@@ -1,34 +0,0 @@
package com.glodblock.github.network;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import com.glodblock.github.client.gui.GuiRenamer;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import io.netty.buffer.ByteBuf;
public class SPacketSwitchBack implements IMessage {
public SPacketSwitchBack() {}
@Override
public void fromBytes(ByteBuf buf) {}
@Override
public void toBytes(ByteBuf buf) {}
public static class Handler implements IMessageHandler<SPacketSwitchBack, IMessage> {
@Override
public IMessage onMessage(SPacketSwitchBack message, MessageContext ctx) {
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
if (gs instanceof GuiRenamer) {
((GuiRenamer) gs).switchGui();
}
return null;
}
}
}
@@ -53,33 +53,10 @@ public class CommonProxy {
}
Upgrades.CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE), 1);
Upgrades.CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.INTERFACE), 1);
Upgrades.CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE_P2P), 1);
Upgrades.ADVANCED_BLOCKING.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE), 1);
Upgrades.ADVANCED_BLOCKING.registerItem(new ItemStack(ItemAndBlockHolder.INTERFACE), 1);
Upgrades.LOCK_CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE), 1);
Upgrades.LOCK_CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.INTERFACE), 1);
Upgrades.LOCK_CRAFTING.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_INTERFACE_P2P), 1);
Upgrades.CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_STORAGE_BUS), 5);
Upgrades.INVERTER.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_STORAGE_BUS), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL1K), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL4K), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL16K), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL64K), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL256K), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL1024K), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL4096K), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL16384K), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL1KM), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL4KM), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL16KM), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL64KM), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL256KM), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL1024KM), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL4096KM), 1);
Upgrades.STICKY.registerItem(new ItemStack(ItemAndBlockHolder.CELL16384KM), 1);
if (Config.fluidIOBus) {
Upgrades.CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_EXPORT_BUS), 2);
Upgrades.CAPACITY.registerItem(new ItemStack(ItemAndBlockHolder.FLUID_IMPORT_BUS), 2);
@@ -11,7 +11,6 @@ import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidHandler;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.inventory.AEFluidInventory;
import com.glodblock.github.inventory.IAEFluidInventory;
@@ -409,13 +408,6 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
IAEFluidStack remove;
if (doFill) {
remove = fluidGrid.injectItems(AEFluidStack.create(resource), Actionable.MODULATE, this.mySource);
if (remove == null) {
onStackReturnedToNetwork(resource);
} else {
FluidStack copy = resource.copy();
copy.amount -= (int) remove.getStackSize();
onStackReturnedToNetwork(copy);
}
} else {
remove = fluidGrid.injectItems(AEFluidStack.create(resource), Actionable.SIMULATE, this.mySource);
}
@@ -447,10 +439,6 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
return this.tanks.getTankInfo(from);
}
private void onStackReturnedToNetwork(FluidStack fluidStack) {
this.iHost.getInterfaceDuality().onStackReturnedToNetwork(ItemFluidDrop.newAeStack(fluidStack));
}
private static class InterfaceInventory extends MEMonitorIFluidHandler {
InterfaceInventory(DualityFluidInterface tileInterface) {
@@ -55,7 +55,6 @@ import appeng.tile.networking.TileWireless;
import appeng.util.Platform;
import appeng.util.item.AEFluidStack;
import baubles.api.BaublesApi;
import codechicken.nei.recipe.StackInfo;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.registry.GameData;
import io.netty.buffer.ByteBuf;
@@ -231,10 +230,21 @@ public final class Util {
public static AEFluidStack getAEFluidFromItem(ItemStack stack) {
if (stack != null) {
FluidStack fluid = getFluidFromItem(stack);
if (fluid != null) {
return AEFluidStack.create(fluid.copy());
if (stack.getItem() instanceof IFluidContainerItem) {
FluidStack fluid = ((IFluidContainerItem) stack.getItem()).getFluid(stack);
if (fluid != null) {
AEFluidStack fluid0 = AEFluidStack.create(fluid.copy());
fluid0.setStackSize(fluid0.getStackSize() * stack.stackSize);
return fluid0;
}
}
if (FluidContainerRegistry.isContainer(stack)) {
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(stack);
if (fluid != null) {
AEFluidStack fluid0 = AEFluidStack.create(fluid.copy());
fluid0.setStackSize(fluid0.getStackSize() * stack.stackSize);
return fluid0;
}
}
}
return null;
@@ -242,26 +252,21 @@ public final class Util {
public static FluidStack getFluidFromItem(ItemStack stack) {
if (stack != null) {
FluidStack fluid = null;
if (stack.getItem() instanceof IFluidContainerItem) {
fluid = ((IFluidContainerItem) stack.getItem()).getFluid(stack);
} else if (FluidContainerRegistry.isContainer(stack)) {
fluid = FluidContainerRegistry.getFluidForFilledItem(stack);
} else if (stack.getItem() instanceof ItemFluidPacket) {
fluid = ItemFluidPacket.getFluidStack(stack);
} else if (stack.getItem() instanceof ItemFluidDrop) {
fluid = ItemFluidDrop.getFluidStack(Util.copyStackWithSize(stack, 1));
FluidStack fluid = ((IFluidContainerItem) stack.getItem()).getFluid(stack);
if (fluid != null) {
FluidStack fluid0 = fluid.copy();
fluid0.amount *= stack.stackSize;
return fluid0;
}
}
if (fluid == null) {
fluid = StackInfo.getFluid(Util.copyStackWithSize(stack, 1));
}
if (fluid != null) {
FluidStack fluid0 = fluid.copy();
fluid0.amount *= stack.stackSize;
return fluid0;
if (FluidContainerRegistry.isContainer(stack)) {
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(stack);
if (fluid != null) {
FluidStack fluid0 = fluid.copy();
fluid0.amount *= stack.stackSize;
return fluid0;
}
}
}
return null;