mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-10-26 22:34:09 +00:00
Compare commits
77
Commits
1.5.61-gtnh
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
358c238e17 | ||
|
|
e16be431c3 | ||
|
|
df71dd52b2 | ||
|
|
c7ec5b0c8b | ||
|
|
ec682b28c3 | ||
|
|
ff129e46d9 | ||
|
|
e670a0c3c0 | ||
|
|
b23c816d69 | ||
|
|
6e8dd013bd | ||
|
|
5e4cf83fff | ||
|
|
47300b8980 | ||
|
|
3c6a5d8933 | ||
|
|
c05448f8b3 | ||
|
|
31746024ee | ||
|
|
1706b5a8da | ||
|
|
d89808dc0b | ||
|
|
e7effee580 | ||
|
|
869613ae31 | ||
|
|
6bec3e7e3a | ||
|
|
c251372e95 | ||
|
|
5315b79c70 | ||
|
|
23d2142084 | ||
|
|
049156e63e | ||
|
|
3d445d7988 | ||
|
|
79648a17b5 | ||
|
|
965d3d9db6 | ||
|
|
8d7bde168d | ||
|
|
2352510223 | ||
|
|
5f9c1b236e | ||
|
|
3f5903aad4 | ||
|
|
10cd1d50ab | ||
|
|
7014b7eaca | ||
|
|
e50d549085 | ||
|
|
f381726ef2 | ||
|
|
c1de99049c | ||
|
|
31533e96df | ||
|
|
7124e812d1 | ||
|
|
edac0cdec6 | ||
|
|
3b67b77572 | ||
|
|
208e4d66d9 | ||
|
|
1aba13e96f | ||
|
|
dd05ae29c1 | ||
|
|
44dfa4d551 | ||
|
|
0a84d208f3 | ||
|
|
4a030a52b6 | ||
|
|
ead0aff1ae | ||
|
|
04d80384b2 | ||
|
|
1b5680d2fd | ||
|
|
0bccb9bc5c | ||
|
|
caf1b282a7 | ||
|
|
1f2613b331 | ||
|
|
a7bf25fcf0 | ||
|
|
07ce2fd1ea | ||
|
|
387c740dcb | ||
|
|
31a9034b8e | ||
|
|
a108986cbb | ||
|
|
abecbe8506 | ||
|
|
36671559a8 | ||
|
|
9c50bb0d70 | ||
|
|
d89a67d3db | ||
|
|
a684a07d7c | ||
|
|
ac0e0de363 | ||
|
|
f98e44d106 | ||
|
|
e66050c78d | ||
|
|
4313dbb4e0 | ||
|
|
fda338525e | ||
|
|
d69e7559cf | ||
|
|
fc2507477a | ||
|
|
e372300ced | ||
|
|
18f337c193 | ||
|
|
1e98b07ed5 | ||
|
|
184c4be4f2 | ||
|
|
a5f030223e | ||
|
|
1bca87de0c | ||
|
|
ed8a9f8372 | ||
|
|
e338176386 | ||
|
|
d97285ba52 |
No files matched your search
@@ -0,0 +1,17 @@
|
||||
name: Optimize images
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: [ master, main, release/** ]
|
||||
paths:
|
||||
- "**/*.png"
|
||||
|
||||
push:
|
||||
branches: [ master, main, release/** ]
|
||||
paths:
|
||||
- "**/*.png"
|
||||
|
||||
jobs:
|
||||
optimize-images:
|
||||
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.yml@master
|
||||
secrets: inherit
|
||||
@@ -28,6 +28,7 @@ whitelist.json
|
||||
*.iws
|
||||
src/main/resources/mixins.*([!.]).json
|
||||
*.bat
|
||||
*.sh
|
||||
*.DS_Store
|
||||
!gradlew.bat
|
||||
.factorypath
|
||||
|
||||
+14
-21
@@ -34,29 +34,22 @@
|
||||
* For more details, see https://docs.gradle.org/8.0.1/userguide/java_library_plugin.html#sec:java_library_configurations_graph
|
||||
*/
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:NotEnoughItems:2.8.60-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-817-GTNH:dev')
|
||||
api('curse.maven:cofh-core-69162:2388751')
|
||||
api('com.github.GTNewHorizons:waila:1.19.21:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.9.10:dev")
|
||||
api('com.github.GTNewHorizons:NotEnoughItems:2.8.160-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-1078-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:waila:1.19.34:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.11.52:dev")
|
||||
|
||||
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.12.12:dev") {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
|
||||
}
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.6-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.25-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.64:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.35:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.4:dev')
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.15:dev')
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.52.258:dev') {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework'
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.39:dev')
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.49:dev')
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.64-GTNH:dev') { transitive = false }
|
||||
|
||||
compileOnly("org.jetbrains:annotations:26.1.0")
|
||||
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.4.6:dev")
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:WirelessCraftingTerminal:1.12.16:dev") {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
|
||||
}
|
||||
|
||||
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
compileOnly('com.gregoriust.gregtech:gregtech_1.7.10:6.14.23:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.16-GTNH:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.7.27-GTNH:dev') { transitive = false }
|
||||
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.4.0:dev")
|
||||
}
|
||||
@@ -186,6 +186,11 @@ modrinthRelations =
|
||||
# Leave this empty if you don't want to publish on CurseForge.
|
||||
curseForgeProjectId =
|
||||
|
||||
# Comma-separated supported CurseForge environments: client, server (case-insensitive).
|
||||
# Use client or server for mods that only support one environment. Defaults to client,server.
|
||||
# These tags describe where the mod can run, not whether installation is required on both sides.
|
||||
curseForgeEnvironments = client,server
|
||||
|
||||
# The project's relations on CurseForge. You can use this to refer to other projects on CurseForge.
|
||||
# Syntax: type1:name1;type2:name2;...
|
||||
# Where type can be one of [requiredDependency, embeddedLibrary, optionalDependency, tool, incompatible],
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/b41931cf1e70bc8e08d7dd19c343ef00/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/b41931cf1e70bc8e08d7dd19c343ef00/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/46949723aaa20c7b64d7ecfed7207034/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/d6690dfd71c4c91e08577437b5b2beb0/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/df211d3c3eefdc408b462041881bc575/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/b41931cf1e70bc8e08d7dd19c343ef00/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/3cd7045fca9a72cd9bc7d14a385e594c/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/552c7bffe0370c66410a51c55985b511/redirect
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/9064f22734b42ac03e85df04b632e167/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/4d0277c49991306ac78048580fe34bcf/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/539ea72837c6244075f8ee037babc29e/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/876dbbf00bf4ef6190f7da074cee903a/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a9fa3b809e484a1e1ac4308a5dda661a/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/aa99913fa6d767d899ffc96082da01ca/redirect
|
||||
toolchainVersion=25
|
||||
Vendored
BIN
Binary file not shown.
+3
-1
@@ -1,7 +1,9 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
|
||||
networkTimeout=10000
|
||||
retries=0
|
||||
retryBackOffMs=500
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
# gradlew start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
@@ -29,7 +29,7 @@
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
# ksh gradlew
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
@@ -57,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
|
||||
Vendored
+12
-23
@@ -19,12 +19,12 @@
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem gradlew startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
@rem Set local scope for the variables, and ensure extensions are enabled
|
||||
setlocal EnableExtensions
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@@ -51,7 +51,7 @@ echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
"%COMSPEC%" /c exit 1
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
@@ -65,29 +65,18 @@ echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
"%COMSPEC%" /c exit 1
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
@rem Execute gradlew
|
||||
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
|
||||
@rem which allows us to clear the local environment before executing the java command
|
||||
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
:exitWithErrorLevel
|
||||
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
|
||||
"%COMSPEC%" /c exit %ERRORLEVEL%
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 8.6 KiB |
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.19'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.34'
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,10 @@ import com.glodblock.github.loader.ChannelLoader;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.loader.RecipeLoader;
|
||||
import com.glodblock.github.proxy.CommonProxy;
|
||||
import com.glodblock.github.util.FluidCellHandler;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
@@ -24,7 +26,7 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
modid = FluidCraft.MODID,
|
||||
version = FluidCraft.VERSION,
|
||||
name = FluidCraft.MODNAME,
|
||||
dependencies = "required-after:appliedenergistics2@[rv3-beta-238,);required-after:CoFHCore;after:waila;after:thaumicenergistics;after:ae2wct")
|
||||
dependencies = "required-after:appliedenergistics2@[rv3-beta-238,);after:waila;after:thaumicenergistics;after:ae2wct")
|
||||
public class FluidCraft {
|
||||
|
||||
public static final String MODID = "ae2fc";
|
||||
@@ -60,7 +62,7 @@ public class FluidCraft {
|
||||
@Mod.EventHandler
|
||||
public static void postInit(FMLPostInitializationEvent event) {
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(FluidCraft.INSTANCE, new InventoryHandler());
|
||||
|
||||
AEApi.instance().registries().cell().addCellHandler(new FluidCellHandler());
|
||||
ItemAndBlockHolder.loadSetting();
|
||||
|
||||
if (!Config.removeRecipe) {
|
||||
|
||||
@@ -215,7 +215,7 @@ public class UltraTerminalButtons implements ICustomButtonDataObject {
|
||||
public void readData(NBTTagCompound tag) {
|
||||
this.reStock = tag.getBoolean(restockItems);
|
||||
this.magnetMode = WirelessMagnet.Mode.values()[tag.getInteger(modeKey)];
|
||||
this.terminalMode = UltraTerminalModes.values()[tag.getInteger(MODE)];
|
||||
this.terminalMode = UltraTerminalModes.VALUES[tag.getInteger(MODE)];
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -229,7 +229,8 @@ public class UltraTerminalButtons implements ICustomButtonDataObject {
|
||||
public void readByte(ByteBuf buf) {
|
||||
this.reStock = buf.readBoolean();
|
||||
this.magnetMode = WirelessMagnet.Mode.values()[buf.readInt()];
|
||||
this.terminalMode = UltraTerminalModes.values()[buf.readInt()];
|
||||
this.terminalMode = UltraTerminalModes.VALUES[buf.readInt()];
|
||||
ItemWirelessUltraTerminal.setMode(this.terminal, this.terminalMode);
|
||||
|
||||
toggleMagnetButtonsVisibility();
|
||||
toggleRestockVisibility();
|
||||
|
||||
@@ -49,7 +49,7 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
this.registerApp(2, "FORCE_PRIO", "DO_PRIO", "prio");
|
||||
this.registerApp(3, "NOT_PRIO", "DONT_PRIO", "not_prio");
|
||||
this.registerApp(4, "SUBMIT", "SUBMIT", "submit");
|
||||
this.registerApp(5, "EDIT", "YES", "edit");
|
||||
this.registerApp(5, "RENAME", "YES", "rename");
|
||||
this.registerApp(6, "DISABLE", "DISABLE", "disable");
|
||||
this.registerApp(7, "ENABLE", "ENABLE", "enable");
|
||||
this.registerApp(10, "FLUID_TEM", "YES", "fluid_terminal_w");
|
||||
@@ -65,8 +65,10 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
this.registerApp(22, "SWITCH", "OFF", "view");
|
||||
this.registerApp(21, "SWITCH", "ENABLE", "enable");
|
||||
this.registerApp(22, "SWITCH", "DISABLE", "disable");
|
||||
this.registerApp(23, "CONFIG", "YES", "open_configuration");
|
||||
this.registerApp(23, "OPEN_GUI", "YES", "open_gui");
|
||||
this.registerApp(24, "HIGHLIGHT", "YES", "block_highlight");
|
||||
this.registerApp(26, "stock mode button", "normalMode", "Normal.mode");
|
||||
this.registerApp(27, "stock mode button", "fullstockMode", "Full-stock.mode");
|
||||
this.registerApp(30, "MAGNET_CARD", "INV", "magnet_card.inv");
|
||||
this.registerApp(30, "MAGNET_CARD", "ME", "magnet_card.me");
|
||||
this.registerApp(30, "MAGNET_CARD", "FILTER", "magnet_card.filter");
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidAutoFiller;
|
||||
import com.glodblock.github.common.tile.TileFluidAutoFiller;
|
||||
import com.glodblock.github.util.FCGuiColors;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
@@ -31,7 +32,12 @@ public class GuiFluidAutoFiller extends AEBaseGui {
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_AUTO_FILLER)), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
fontRendererObj.drawString(
|
||||
getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_AUTO_FILLER)),
|
||||
8,
|
||||
6,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
fontRendererObj
|
||||
.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, FCGuiColors.guiTextColorGray.getColor());
|
||||
}
|
||||
}
|
||||
@@ -10,14 +10,15 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidInterface;
|
||||
import com.glodblock.github.common.parts.PartFluidInterface;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import com.glodblock.github.inventory.IDualHost;
|
||||
import com.glodblock.github.inventory.gui.MouseRegionManager;
|
||||
import com.glodblock.github.inventory.gui.TankMouseHandler;
|
||||
import com.glodblock.github.util.FCGuiColors;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.glodblock.github.util.RenderUtil;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.client.gui.GuiSub;
|
||||
import appeng.core.localization.GuiText;
|
||||
@@ -51,15 +52,24 @@ public class GuiFluidInterface extends GuiSub {
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_INTERFACE)), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
fontRendererObj.drawString(
|
||||
getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_INTERFACE)),
|
||||
8,
|
||||
6,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
fontRendererObj
|
||||
.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, FCGuiColors.guiTextColorGray.getColor());
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
|
||||
IAEFluidTank fluidInv = cont.getTile().getInternalFluid();
|
||||
mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
for (int i = 0; i < 6; i++) {
|
||||
if (!isPart()) {
|
||||
fontRendererObj.drawString(dirName(i), TANK_X + i * TANK_X_OFF + 5, 22, 0x404040);
|
||||
fontRendererObj.drawString(
|
||||
dirName(i),
|
||||
TANK_X + i * TANK_X_OFF + 5,
|
||||
22,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
}
|
||||
RenderUtil.renderFluidIntoGui(
|
||||
this,
|
||||
@@ -93,6 +103,6 @@ public class GuiFluidInterface extends GuiSub {
|
||||
}
|
||||
|
||||
private boolean isPart() {
|
||||
return this.cont.getTile() instanceof PartFluidInterface;
|
||||
return this.cont.getTile() instanceof IPart;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerFluidPacketDecoder;
|
||||
import com.glodblock.github.common.tile.TileFluidPacketDecoder;
|
||||
import com.glodblock.github.util.FCGuiColors;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
@@ -28,7 +29,12 @@ public class GuiFluidPacketDecoder extends AEBaseGui {
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_PACKET_DECODER)), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
fontRendererObj.drawString(
|
||||
getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_PACKET_DECODER)),
|
||||
8,
|
||||
6,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
fontRendererObj
|
||||
.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, FCGuiColors.guiTextColorGray.getColor());
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import com.glodblock.github.common.tile.TileFluidPatternEncoder;
|
||||
import com.glodblock.github.inventory.gui.MouseRegionManager;
|
||||
import com.glodblock.github.inventory.slot.ISlotFluid;
|
||||
import com.glodblock.github.inventory.slot.SlotSingleItem;
|
||||
import com.glodblock.github.util.FCGuiColors;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
@@ -73,8 +74,13 @@ public class GuiFluidPatternEncoder extends AEBaseGui {
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_PATTERN_ENCODER)), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
fontRendererObj.drawString(
|
||||
getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_PATTERN_ENCODER)),
|
||||
8,
|
||||
6,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
fontRendererObj
|
||||
.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, FCGuiColors.guiTextColorGray.getColor());
|
||||
mouseRegions.render(mouseX, mouseY);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import com.glodblock.github.inventory.gui.ButtonMouseHandler;
|
||||
import com.glodblock.github.inventory.gui.MouseRegionManager;
|
||||
import com.glodblock.github.inventory.gui.TankMouseHandler;
|
||||
import com.glodblock.github.util.FCGuiColors;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.glodblock.github.util.RenderUtil;
|
||||
|
||||
@@ -66,8 +67,13 @@ public class GuiIngredientBuffer extends AEBaseGui {
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_INGREDIENT_BUFFER)), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
fontRendererObj.drawString(
|
||||
getGuiDisplayName(I18n.format(NameConst.GUI_INGREDIENT_BUFFER)),
|
||||
8,
|
||||
6,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
fontRendererObj
|
||||
.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, FCGuiColors.guiTextColorGray.getColor());
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
|
||||
IAEFluidTank fluidInv = cont.getTile().getInternalFluid();
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import com.glodblock.github.inventory.gui.ButtonMouseHandler;
|
||||
import com.glodblock.github.inventory.gui.MouseRegionManager;
|
||||
import com.glodblock.github.inventory.gui.TankMouseHandler;
|
||||
import com.glodblock.github.util.FCGuiColors;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.glodblock.github.util.RenderUtil;
|
||||
|
||||
@@ -66,9 +67,13 @@ public class GuiLargeIngredientBuffer extends AEBaseGui {
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(
|
||||
getGuiDisplayName(I18n.format(NameConst.GUI_LARGE_INGREDIENT_BUFFER)),
|
||||
8,
|
||||
6,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
fontRendererObj
|
||||
.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_LARGE_INGREDIENT_BUFFER)), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, FCGuiColors.guiTextColorGray.getColor());
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
|
||||
IAEFluidTank fluidInv = cont.getTile().getInternalFluid();
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
@@ -28,9 +29,10 @@ import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.client.gui.GuiSub;
|
||||
import appeng.client.gui.slots.VirtualMEPhantomSlot;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.client.gui.widgets.GuiToggleButton;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.util.calculators.ArithHelper;
|
||||
import appeng.util.calculators.Calculator;
|
||||
import cofh.core.render.CoFHFontRenderer;
|
||||
|
||||
public class GuiLevelMaintainer extends GuiSub {
|
||||
|
||||
@@ -39,14 +41,15 @@ public class GuiLevelMaintainer extends GuiSub {
|
||||
private final Component[] component = new Component[TileLevelMaintainer.REQ_COUNT];
|
||||
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
|
||||
private Widget focusedWidget;
|
||||
private final CoFHFontRenderer render;
|
||||
private final FontRenderer render;
|
||||
private GuiToggleButton liteMode;
|
||||
|
||||
public GuiLevelMaintainer(InventoryPlayer ipl, TileLevelMaintainer tile) {
|
||||
super(new ContainerLevelMaintainer(ipl, tile));
|
||||
this.cont = (ContainerLevelMaintainer) inventorySlots;
|
||||
this.xSize = 195;
|
||||
this.ySize = 214;
|
||||
this.render = new CoFHFontRenderer(
|
||||
this.render = new FontRenderer(
|
||||
Minecraft.getMinecraft().gameSettings,
|
||||
TEX_BG,
|
||||
Minecraft.getMinecraft().getTextureManager(),
|
||||
@@ -88,6 +91,15 @@ public class GuiLevelMaintainer extends GuiSub {
|
||||
this.buttonList,
|
||||
this.cont);
|
||||
}
|
||||
this.buttonList.add(
|
||||
this.liteMode = new GuiToggleButton(
|
||||
guiLeft - 18,
|
||||
guiTop + 2,
|
||||
178,
|
||||
194,
|
||||
GuiText.CraftingModeLite.getLocal(),
|
||||
NameConst.TT_LEVEL_MAINTAINER_LITE_CRAFT_DESC));
|
||||
this.liteMode.setState(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -124,26 +136,26 @@ public class GuiLevelMaintainer extends GuiSub {
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(getGuiDisplayName(NameConst.i18n(NameConst.GUI_LEVEL_MAINTAINER)), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(
|
||||
getGuiDisplayName(NameConst.i18n(NameConst.GUI_LEVEL_MAINTAINER)),
|
||||
8,
|
||||
6,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
mouseRegions.render(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void mouseClicked(final int xCoord, final int yCoord, final int btn) {
|
||||
if (btn == 0) {
|
||||
if (focusedWidget != null) {
|
||||
focusedWidget.textField.setFocused(false);
|
||||
}
|
||||
for (Component com : this.component) {
|
||||
Widget textField = com.isMouseIn(xCoord, yCoord);
|
||||
if (textField != null) {
|
||||
textField.textField.setFocused(true);
|
||||
this.focusedWidget = textField;
|
||||
this.focusWidget(textField);
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.focusedWidget = null;
|
||||
this.focusWidget(null);
|
||||
}
|
||||
super.mouseClicked(xCoord, yCoord, btn);
|
||||
}
|
||||
@@ -164,12 +176,48 @@ public class GuiLevelMaintainer extends GuiSub {
|
||||
|
||||
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
|
||||
this.component[this.focusedWidget.componentIndex].submit();
|
||||
this.focusedWidget.textField.setFocused(false);
|
||||
this.focusedWidget = null;
|
||||
this.focusWidget(null);
|
||||
}
|
||||
|
||||
if (key == Keyboard.KEY_TAB) {
|
||||
this.focusAdjacentWidget(isShiftKeyDown());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void focusWidget(@Nullable Widget widget) {
|
||||
if (this.focusedWidget != null) {
|
||||
this.focusedWidget.textField.setFocused(false);
|
||||
}
|
||||
this.focusedWidget = widget;
|
||||
if (this.focusedWidget != null) {
|
||||
this.focusedWidget.textField.setFocused(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void focusAdjacentWidget(boolean backwards) {
|
||||
this.focusedWidget.validate();
|
||||
this.focusWidget(this.getAdjacentWidget(backwards));
|
||||
}
|
||||
|
||||
private Widget getAdjacentWidget(boolean backwards) {
|
||||
int index = this.focusedWidget.componentIndex;
|
||||
boolean isBatch = this.focusedWidget.action == Action.Batch;
|
||||
|
||||
if (backwards) {
|
||||
if (isBatch) {
|
||||
return this.component[index].getQty();
|
||||
}
|
||||
return this.component[(index + TileLevelMaintainer.REQ_COUNT - 1) % TileLevelMaintainer.REQ_COUNT]
|
||||
.getBatch();
|
||||
}
|
||||
|
||||
if (isBatch) {
|
||||
return this.component[(index + 1) % TileLevelMaintainer.REQ_COUNT].getQty();
|
||||
}
|
||||
return this.component[index].getBatch();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
for (Component com : this.component) {
|
||||
@@ -177,6 +225,14 @@ public class GuiLevelMaintainer extends GuiSub {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (btn == this.liteMode) {
|
||||
if (isShiftKeyDown()) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.ClearLiteMode));
|
||||
} else {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.ToggleLiteMode));
|
||||
}
|
||||
return;
|
||||
}
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
|
||||
@@ -195,6 +251,10 @@ public class GuiLevelMaintainer extends GuiSub {
|
||||
component[index].setState(state);
|
||||
}
|
||||
|
||||
public void updateComponent(boolean isLiteMode) {
|
||||
this.liteMode.setState(isLiteMode);
|
||||
}
|
||||
|
||||
private static boolean acceptType(VirtualMEPhantomSlot slot, IAEStackType<?> type, int mouseButton) {
|
||||
return true;
|
||||
}
|
||||
@@ -307,43 +367,43 @@ public class GuiLevelMaintainer extends GuiSub {
|
||||
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_TITLE) + "\n");
|
||||
switch (this.state) {
|
||||
case Idle -> {
|
||||
this.line.setColor(FCGuiColors.StateIdle.getColor());
|
||||
this.line.setColor(FCGuiColors.stateIdle.getColor());
|
||||
message.add(
|
||||
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_IDLE));
|
||||
}
|
||||
case Craft -> {
|
||||
this.line.setColor(FCGuiColors.StateCraft.getColor());
|
||||
this.line.setColor(FCGuiColors.stateCraft.getColor());
|
||||
message.add(
|
||||
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_LINK));
|
||||
}
|
||||
case Export -> {
|
||||
this.line.setColor(FCGuiColors.StateExport.getColor());
|
||||
this.line.setColor(FCGuiColors.stateExport.getColor());
|
||||
message.add(
|
||||
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_EXPORT));
|
||||
}
|
||||
case Error -> {
|
||||
this.line.setColor(FCGuiColors.StateError.getColor());
|
||||
this.line.setColor(FCGuiColors.stateError.getColor());
|
||||
message.add(
|
||||
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_ERROR));
|
||||
}
|
||||
case NotFound -> {
|
||||
this.line.setColor(FCGuiColors.StateError.getColor());
|
||||
this.line.setColor(FCGuiColors.stateError.getColor());
|
||||
message.add(
|
||||
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_NOT_FOUND));
|
||||
}
|
||||
case CantCraft -> {
|
||||
this.line.setColor(FCGuiColors.StateError.getColor());
|
||||
this.line.setColor(FCGuiColors.stateError.getColor());
|
||||
message.add(
|
||||
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CANT_CRAFT));
|
||||
}
|
||||
default -> {
|
||||
this.line.setColor(FCGuiColors.StateNone.getColor());
|
||||
this.line.setColor(FCGuiColors.stateNone.getColor());
|
||||
message.add(
|
||||
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT) + " "
|
||||
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_NONE));
|
||||
@@ -434,10 +494,10 @@ public class GuiLevelMaintainer extends GuiSub {
|
||||
final double result = Calculator.conversion(this.textField.getText());
|
||||
if (Double.isNaN(result) || result < 0) {
|
||||
this.amount = null;
|
||||
this.textField.setTextColor(0xFF0000);
|
||||
this.textField.setTextColor(FCGuiColors.guiLevelMaintainerError.getColor());
|
||||
} else {
|
||||
this.amount = (long) ArithHelper.round(result, 0);
|
||||
this.textField.setTextColor(0xFFFFFF);
|
||||
this.textField.setTextColor(FCGuiColors.guiTextColorGray.getColor());
|
||||
}
|
||||
|
||||
IAEStack<?> stack = component[this.componentIndex].getStack();
|
||||
|
||||
@@ -62,7 +62,6 @@ import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
import appeng.core.localization.GuiColors;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.localization.PlayerMessages;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
@@ -73,7 +72,6 @@ import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.ReadableNumberConverter;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextField, IGuiTooltipHandler {
|
||||
|
||||
@@ -93,8 +91,8 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
private GuiImgButton terminalStyleBox;
|
||||
|
||||
private ItemStack tooltipStack;
|
||||
private List<String> buttonTooltip;
|
||||
private boolean online;
|
||||
private final boolean neiPresent;
|
||||
private int viewHeight;
|
||||
|
||||
protected GuiTabButton craftingStatusBtn;
|
||||
@@ -108,7 +106,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
private static final float ITEM_STACK_Z = 100.0f;
|
||||
private static final float ITEM_STACK_OVERLAY_Z = 200.0f;
|
||||
private static final float SLOT_HOVER_Z = 310.0f;
|
||||
private static final float TOOLTIP_Z = 410.0f;
|
||||
private static final float STEP_Z = 10.0f;
|
||||
private static final float MAGIC_RENDER_ITEM_Z = 50.0f;
|
||||
|
||||
@@ -117,7 +114,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
setScrollBar(new GuiScrollbar());
|
||||
xSize = 209;
|
||||
ySize = 255;
|
||||
neiPresent = Loader.isModLoaded("NotEnoughItems");
|
||||
|
||||
searchFieldOutputs = new MEGuiTextField(86, 12, ButtonToolTips.SearchFieldOutputs.getLocal()) {
|
||||
|
||||
@@ -134,7 +130,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
masterList.markDirty();
|
||||
}
|
||||
};
|
||||
searchFieldNames.setFocused(true);
|
||||
extraOptionsText.add(ButtonToolTips.HighlightInterface.getLocal());
|
||||
online = true;
|
||||
}
|
||||
@@ -179,6 +174,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
|
||||
searchFieldNames.x = guiLeft + Math.max(32, offsetX) + 99;
|
||||
searchFieldNames.y = guiTop + 38;
|
||||
searchFieldNames.setFocused(true);
|
||||
|
||||
terminalStyleBox.xPosition = guiLeft - 18;
|
||||
terminalStyleBox.yPosition = guiTop + 8;
|
||||
@@ -190,7 +186,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
itemRender);
|
||||
craftingStatusBtn.setHideEdge(13);
|
||||
|
||||
if (ModAndClassUtil.isSearchBar && (AEConfig.instance.preserveSearchBar || isSubGui())) {
|
||||
if (AEConfig.instance.preserveSearchBar || isSubGui()) {
|
||||
setSearchString();
|
||||
}
|
||||
buttonList.add(terminalStyleBox);
|
||||
@@ -244,14 +240,14 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
StatCollector.translateToLocal(NameConst.GUI_LEVEL_TERMINAL),
|
||||
8,
|
||||
6,
|
||||
GuiColors.InterfaceTerminalTitle.getColor());
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
fontRendererObj.drawString(
|
||||
GuiText.inventory.getLocal(),
|
||||
GuiLevelTerminal.offsetX + 2,
|
||||
ySize - 96 + 3,
|
||||
GuiColors.InterfaceTerminalInventory.getColor());
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
|
||||
if (!neiPresent && tooltipStack != null) {
|
||||
if (!ModAndClassUtil.NEI && tooltipStack != null) {
|
||||
renderToolTip(tooltipStack, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
@@ -264,6 +260,11 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
|
||||
handleTooltip(mouseX, mouseY, searchFieldOutputs);
|
||||
handleTooltip(mouseX, mouseY, searchFieldNames);
|
||||
|
||||
// Drawn after the viewport so the items do not cover it
|
||||
if (buttonTooltip != null) {
|
||||
drawHoveringText(buttonTooltip, mouseX, mouseY, fontRendererObj);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -290,7 +291,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (actionPerformedCustomButtons(btn)) return;
|
||||
if (ModAndClassUtil.isSaveText && btn == searchStringSave) {
|
||||
if (btn == searchStringSave) {
|
||||
|
||||
final boolean backwards = Mouse.isButtonDown(1);
|
||||
final GuiImgButton iBtn = (GuiImgButton) btn;
|
||||
@@ -348,6 +349,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(offsetX + VIEW_LEFT, offsetY + HEADER_HEIGHT, 0);
|
||||
tooltipStack = null;
|
||||
buttonTooltip = null;
|
||||
drawViewport(mouseX - offsetX - VIEW_LEFT, mouseY - offsetY - HEADER_HEIGHT - 1);
|
||||
GL11.glPopMatrix();
|
||||
GL11.glPopAttrib();
|
||||
@@ -398,7 +400,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
int title;
|
||||
int renderY = 0;
|
||||
final int sectionBottom = viewY + section.getHeight() - 1;
|
||||
final int fontColor = GuiColors.InterfaceTerminalInventory.getColor();
|
||||
final int fontColor = FCGuiColors.guiTextColorGray.getColor();
|
||||
/*
|
||||
* Render title
|
||||
*/
|
||||
@@ -502,22 +504,26 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
entry.renameButton.yPosition = viewY + 1;
|
||||
entry.configButton.yPosition = viewY + 1;
|
||||
GuiFCImgButton toRender;
|
||||
if (isCtrlKeyDown() && isShiftKeyDown()) {
|
||||
toRender = entry.configButton;
|
||||
} else if (isShiftKeyDown()) {
|
||||
if (isShiftKeyDown() && entry.isInPlayerDimension()) {
|
||||
toRender = entry.renameButton;
|
||||
} else if (isCtrlKeyDown() && entry.isInPlayerDimension()) {
|
||||
toRender = entry.configButton;
|
||||
} else {
|
||||
toRender = entry.highlightButton;
|
||||
}
|
||||
toRender.drawButton(mc, relMouseX, relMouseY);
|
||||
if (toRender.getMouseIn()
|
||||
&& relMouseY >= Math.max(LevelTerminalSection.TITLE_HEIGHT, entry.highlightButton.yPosition)) {
|
||||
// draw a tooltip
|
||||
GL11.glTranslatef(0f, 0f, TOOLTIP_Z);
|
||||
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
||||
drawHoveringText(Arrays.asList(toRender.getMessage()), relMouseX, relMouseY);
|
||||
GL11.glTranslatef(0f, 0f, -TOOLTIP_Z);
|
||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
List<String> tooltip = new ArrayList<>();
|
||||
tooltip.add(toRender.getMessage());
|
||||
if (entry.isInPlayerDimension()) {
|
||||
tooltip.add(StatCollector.translateToLocal(NameConst.TT_KEY + "level_terminal.hint_rename"));
|
||||
tooltip.add(StatCollector.translateToLocal(NameConst.TT_KEY + "level_terminal.hint_open_gui"));
|
||||
} else {
|
||||
tooltip.add(
|
||||
StatCollector.translateToLocal(NameConst.TT_KEY + "level_terminal.hint_other_dimension"));
|
||||
}
|
||||
buttonTooltip = tooltip;
|
||||
}
|
||||
} else {
|
||||
entry.highlightButton.yPosition = -1;
|
||||
@@ -557,11 +563,11 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
aes.drawOverlayInGui(mc, 0, 0, false, false, false, false);
|
||||
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z - ITEM_STACK_Z);
|
||||
int color = switch (state) {
|
||||
case Idle -> FCGuiColors.StateIdle.getColor();
|
||||
case Craft -> FCGuiColors.StateCraft.getColor();
|
||||
case Export -> FCGuiColors.StateExport.getColor();
|
||||
case Error, NotFound, CantCraft -> FCGuiColors.StateError.getColor();
|
||||
case None -> FCGuiColors.StateNone.getColor();
|
||||
case Idle -> FCGuiColors.stateIdle.getColor();
|
||||
case Craft -> FCGuiColors.stateCraft.getColor();
|
||||
case Export -> FCGuiColors.stateExport.getColor();
|
||||
case Error, NotFound, CantCraft -> FCGuiColors.stateError.getColor();
|
||||
case None -> FCGuiColors.stateNone.getColor();
|
||||
};
|
||||
int offset = 0;
|
||||
int size = 4;
|
||||
@@ -579,23 +585,28 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
if (!tooltip) {
|
||||
if (entry.filteredRecipes[slotIdx]) {
|
||||
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z);
|
||||
drawRect(0, 0, 16, 16, GuiColors.ItemSlotOverlayUnpowered.getColor());
|
||||
drawRect(0, 0, 16, 16, FCGuiColors.itemSlotOverlayUnpowered.getColor());
|
||||
}
|
||||
} else {
|
||||
tooltipStack = Platform.stackConvert(aes).getItemStack();
|
||||
tooltipStack = aes.getItemStackForNEI();
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
} else if (entry.filteredRecipes[slotIdx]) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(colLeft, viewY + rowYTop + 1, ITEM_STACK_OVERLAY_Z);
|
||||
drawRect(0, 0, 16, 16, GuiColors.ItemSlotOverlayUnpowered.getColor());
|
||||
drawRect(0, 0, 16, 16, FCGuiColors.itemSlotOverlayUnpowered.getColor());
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (tooltip) {
|
||||
// overlay highlight
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glTranslatef(0.0f, 0.0f, SLOT_HOVER_Z);
|
||||
drawRect(colLeft, viewY + 1 + rowYTop, -2 + colRight, viewY - 1 + rowYBot, 0x77FFFFFF);
|
||||
drawRect(
|
||||
colLeft,
|
||||
viewY + 1 + rowYTop,
|
||||
-2 + colRight,
|
||||
viewY - 1 + rowYBot,
|
||||
FCGuiColors.guiLevelTerminalOverlayHighlight.getColor());
|
||||
GL11.glTranslatef(0.0f, 0.0f, -SLOT_HOVER_Z);
|
||||
}
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
@@ -653,102 +664,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawHoveringText(List<String> textLines, int x, int y, FontRenderer font) {
|
||||
if (!textLines.isEmpty()) {
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
int maxStrWidth = 0;
|
||||
|
||||
// is this more efficient than doing 1 pass, then doing a translate before drawing the text?
|
||||
for (String s : (List<String>) textLines) {
|
||||
int width = font.getStringWidth(s);
|
||||
|
||||
if (width > maxStrWidth) {
|
||||
maxStrWidth = width;
|
||||
}
|
||||
}
|
||||
|
||||
// top left corner
|
||||
int curX = x + 12;
|
||||
int curY = y - 12;
|
||||
int totalHeight = 8;
|
||||
|
||||
if (textLines.size() > 1) {
|
||||
totalHeight += 2 + (textLines.size() - 1) * 10;
|
||||
}
|
||||
|
||||
/* String is too long? Display on the left side */
|
||||
if (curX + maxStrWidth > width) {
|
||||
curX -= 28 + maxStrWidth;
|
||||
}
|
||||
|
||||
/* String is too tall? move it up */
|
||||
if (curY + totalHeight + 6 > height) {
|
||||
curY = height - totalHeight - 6;
|
||||
}
|
||||
|
||||
int borderColor = -267386864;
|
||||
// drawing the border...
|
||||
drawGradientRect(curX - 3, curY - 4, curX + maxStrWidth + 3, curY - 3, borderColor, borderColor);
|
||||
drawGradientRect(
|
||||
curX - 3,
|
||||
curY + totalHeight + 3,
|
||||
curX + maxStrWidth + 3,
|
||||
curY + totalHeight + 4,
|
||||
borderColor,
|
||||
borderColor);
|
||||
drawGradientRect(
|
||||
curX - 3,
|
||||
curY - 3,
|
||||
curX + maxStrWidth + 3,
|
||||
curY + totalHeight + 3,
|
||||
borderColor,
|
||||
borderColor);
|
||||
drawGradientRect(curX - 4, curY - 3, curX - 3, curY + totalHeight + 3, borderColor, borderColor);
|
||||
drawGradientRect(
|
||||
curX + maxStrWidth + 3,
|
||||
curY - 3,
|
||||
curX + maxStrWidth + 4,
|
||||
curY + totalHeight + 3,
|
||||
borderColor,
|
||||
borderColor);
|
||||
int color1 = 1347420415;
|
||||
int color2 = (color1 & 16711422) >> 1 | color1 & -16777216;
|
||||
drawGradientRect(curX - 3, curY - 3 + 1, curX - 3 + 1, curY + totalHeight + 3 - 1, color1, color2);
|
||||
drawGradientRect(
|
||||
curX + maxStrWidth + 2,
|
||||
curY - 3 + 1,
|
||||
curX + maxStrWidth + 3,
|
||||
curY + totalHeight + 3 - 1,
|
||||
color1,
|
||||
color2);
|
||||
drawGradientRect(curX - 3, curY - 3, curX + maxStrWidth + 3, curY - 3 + 1, color1, color1);
|
||||
drawGradientRect(
|
||||
curX - 3,
|
||||
curY + totalHeight + 2,
|
||||
curX + maxStrWidth + 3,
|
||||
curY + totalHeight + 3,
|
||||
color2,
|
||||
color2);
|
||||
|
||||
for (int i = 0; i < textLines.size(); ++i) {
|
||||
String line = (String) textLines.get(i);
|
||||
font.drawStringWithShadow(line, curX, curY, -1);
|
||||
|
||||
if (i == 0) {
|
||||
// gap between name and lore text
|
||||
curY += 2;
|
||||
}
|
||||
|
||||
curY += 10;
|
||||
}
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(final char character, final int key) {
|
||||
if (!checkHotbarKeys(key)) {
|
||||
@@ -854,18 +769,13 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
}
|
||||
}
|
||||
|
||||
private boolean itemStackMatchesSearchTerm(final ItemStack itemStack, final String searchTerm) {
|
||||
if (itemStack == null) {
|
||||
private boolean stackMatchesSearchTerm(final IAEStack<?> stack, final String searchTerm) {
|
||||
if (stack == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final String displayName = Platform.getItemDisplayName(itemStack).toLowerCase();
|
||||
|
||||
if (displayName.contains(searchTerm)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
final String displayName = stack.getDisplayName();
|
||||
return displayName != null && displayName.toLowerCase().contains(searchTerm);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1103,9 +1013,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
continue;
|
||||
}
|
||||
|
||||
if (itemStackMatchesSearchTerm(
|
||||
Platform.stackConvert(entry.infoList[i].stack).getItemStack(),
|
||||
output)) {
|
||||
if (stackMatchesSearchTerm(entry.infoList[i].stack, output)) {
|
||||
shouldAdd = true;
|
||||
entry.filteredRecipes[i] = false;
|
||||
} else {
|
||||
@@ -1188,8 +1096,8 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
}
|
||||
}
|
||||
highlightButton = new GuiFCImgButton(1, 0, "HIGHLIGHT", "YES");
|
||||
renameButton = new GuiFCImgButton(1, 0, "EDIT", "YES");
|
||||
configButton = new GuiFCImgButton(1, 0, "CONFIG", "YES");
|
||||
renameButton = new GuiFCImgButton(1, 0, "RENAME", "YES");
|
||||
configButton = new GuiFCImgButton(1, 0, "OPEN_GUI", "YES");
|
||||
guiHeight = 18 * rows + 1;
|
||||
filteredRecipes = new boolean[rows * rowSize];
|
||||
}
|
||||
@@ -1209,6 +1117,10 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
return this;
|
||||
}
|
||||
|
||||
private boolean isInPlayerDimension() {
|
||||
return mc != null && mc.thePlayer != null && mc.thePlayer.dimension == this.dim;
|
||||
}
|
||||
|
||||
public boolean mouseClicked(int mouseX, int mouseY, int mouseButton) {
|
||||
if (!section.visible || mouseButton < 0 || mouseButton > 2) {
|
||||
return false;
|
||||
@@ -1224,16 +1136,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
dim,
|
||||
ForgeDirection.getOrientation(side),
|
||||
"");
|
||||
if (isCtrlKeyDown() && isShiftKeyDown()) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketLevelTerminalCommands(
|
||||
Action.EDIT,
|
||||
blockPos.x,
|
||||
blockPos.y,
|
||||
blockPos.z,
|
||||
blockPos.getDimension(),
|
||||
blockPos.getSide()));
|
||||
} else if (isShiftKeyDown()) {
|
||||
if (isShiftKeyDown() && isInPlayerDimension()) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketLevelTerminalCommands(
|
||||
Action.RENAME,
|
||||
@@ -1242,7 +1145,15 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
blockPos.z,
|
||||
blockPos.getDimension(),
|
||||
blockPos.getSide()));
|
||||
|
||||
} else if (isCtrlKeyDown() && isInPlayerDimension()) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(
|
||||
new CPacketLevelTerminalCommands(
|
||||
Action.EDIT,
|
||||
blockPos.x,
|
||||
blockPos.y,
|
||||
blockPos.z,
|
||||
blockPos.getDimension(),
|
||||
blockPos.getSide()));
|
||||
} else {
|
||||
BlockPosHighlighter.highlightBlocks(
|
||||
mc.thePlayer,
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerMagnetFilter;
|
||||
import com.glodblock.github.inventory.item.WirelessMagnet;
|
||||
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
|
||||
import com.glodblock.github.util.FCGuiColors;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.config.ActionItems;
|
||||
@@ -136,14 +137,32 @@ public class GuiMagnetFilter extends GuiSub {
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
this.fontRendererObj.drawString(NameConst.i18n(NameConst.GUI_MAGNET_CARD), 8, 6, 0x404040);
|
||||
this.fontRendererObj.drawString(NameConst.i18n(NameConst.GUI_MAGNET_CARD_NBT), 61, 22, 0x404040);
|
||||
this.fontRendererObj.drawString(NameConst.i18n(NameConst.GUI_MAGNET_CARD_META), 61, 34, 0x404040);
|
||||
this.fontRendererObj.drawString(NameConst.i18n(NameConst.GUI_MAGNET_CARD_ORE), 61, 46, 0x404040);
|
||||
this.fontRendererObj
|
||||
.drawString(NameConst.i18n(NameConst.GUI_MAGNET_CARD), 8, 6, FCGuiColors.guiTextColorGray.getColor());
|
||||
this.fontRendererObj.drawString(
|
||||
NameConst.i18n(NameConst.GUI_MAGNET_CARD_NBT),
|
||||
61,
|
||||
22,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
this.fontRendererObj.drawString(
|
||||
NameConst.i18n(NameConst.GUI_MAGNET_CARD_META),
|
||||
61,
|
||||
34,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
this.fontRendererObj.drawString(
|
||||
NameConst.i18n(NameConst.GUI_MAGNET_CARD_ORE),
|
||||
61,
|
||||
46,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
this.components[0].setVar(this.cont.nbt);
|
||||
this.components[1].setVar(this.cont.meta);
|
||||
this.components[2].setVar(this.cont.ore);
|
||||
this.components[3].setVar(this.cont.oreDict);
|
||||
// the synced value arrives after initGui, so re-apply it while the field is not being edited
|
||||
if (!oreDict.isFocused() && this.cont.oreDictFilter != null
|
||||
&& !this.cont.oreDictFilter.equals(oreDict.getText())) {
|
||||
oreDict.setText(this.cont.oreDictFilter, true);
|
||||
}
|
||||
for (Component c : components) {
|
||||
c.draw();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.util.ResourceLocation;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerOCPatternEditor;
|
||||
import com.glodblock.github.common.tile.TileOCPatternEditor;
|
||||
import com.glodblock.github.util.FCGuiColors;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
@@ -29,7 +30,12 @@ public class GuiOCPatternEditor extends AEBaseGui {
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_OC_PATTERN_EDITOR)), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
fontRendererObj.drawString(
|
||||
getGuiDisplayName(I18n.format(NameConst.GUI_OC_PATTERN_EDITOR)),
|
||||
8,
|
||||
6,
|
||||
FCGuiColors.guiTextColorGray.getColor());
|
||||
fontRendererObj
|
||||
.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, FCGuiColors.guiTextColorGray.getColor());
|
||||
}
|
||||
}
|
||||
@@ -1,101 +1,120 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerSuperStockReplenisher;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.common.tile.TileSuperStockReplenisher;
|
||||
import com.glodblock.github.util.FCGuiColors;
|
||||
|
||||
import appeng.api.storage.StorageName;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotFake;
|
||||
import appeng.client.gui.slots.VirtualMEPhantomSlot;
|
||||
import appeng.client.gui.slots.VirtualMEPhantomSlotPrecise;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||
import appeng.core.sync.packets.PacketVirtualSlot;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import appeng.util.item.AEFluidStackType;
|
||||
import appeng.util.item.AEItemStackType;
|
||||
|
||||
public class GuiSuperStockReplenisher extends AEBaseGui {
|
||||
|
||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/superStockReplenisher.png");
|
||||
private final DecimalFormat df = new DecimalFormat("#.#");
|
||||
private Map<Integer, IAEStack<?>> list = new HashMap<>();
|
||||
private final ContainerSuperStockReplenisher containerSuperStockReplenisher;
|
||||
private final TileSuperStockReplenisher tileSuperStockReplenisher;
|
||||
|
||||
private final VirtualMEPhantomSlotPrecise[] configFluidsSlots = new VirtualMEPhantomSlotPrecise[9];
|
||||
private final VirtualMEPhantomSlotPrecise[] configItemsSlots = new VirtualMEPhantomSlotPrecise[63];
|
||||
|
||||
private GuiFCImgButton StockModeButton;
|
||||
|
||||
public GuiSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockReplenisher tile) {
|
||||
super(new ContainerSuperStockReplenisher(ipl, tile));
|
||||
|
||||
this.containerSuperStockReplenisher = (ContainerSuperStockReplenisher) inventorySlots;
|
||||
this.tileSuperStockReplenisher = tile;
|
||||
|
||||
this.ySize = 251;
|
||||
this.xSize = 216;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleMouseClick(Slot slot, int slotIdx, int ctrlDown, int mouseButton) {
|
||||
if (mouseButton == 3) {
|
||||
if (slot instanceof SlotFake) {
|
||||
if (slot.getHasStack()) {
|
||||
IAEItemStack stack = AEItemStack.create(slot.getStack());
|
||||
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
|
||||
for (int i = 0; i < this.inventorySlots.inventorySlots.size(); i++) {
|
||||
if (slot.equals(this.inventorySlots.inventorySlots.get(i))) {
|
||||
NetworkHandler.instance
|
||||
.sendToServer(new PacketSwitchGuis(GuiBridge.GUI_PATTERN_VALUE_AMOUNT));
|
||||
NetworkHandler.instance
|
||||
.sendToServer(new PacketVirtualSlot(StorageName.CRAFTING_INPUT, i, stack));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
this.StockModeButton = new GuiFCImgButton(
|
||||
guiLeft - 18,
|
||||
guiTop + 8,
|
||||
"stock mode button",
|
||||
this.containerSuperStockReplenisher.isFullStockMode() ? "fullstockMode" : "normalMode",
|
||||
true);
|
||||
this.containerSuperStockReplenisher.setModeButton(this.StockModeButton);
|
||||
buttonList.add(this.StockModeButton);
|
||||
this.initSlots();
|
||||
}
|
||||
|
||||
private void initSlots() {
|
||||
|
||||
final int xo = 8;
|
||||
final int yo = 8;
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
VirtualMEPhantomSlotPrecise slot = new VirtualMEPhantomSlotPrecise(
|
||||
xo + i * 18,
|
||||
yo,
|
||||
this.containerSuperStockReplenisher.configFluidsSlots,
|
||||
i,
|
||||
this::acceptType);
|
||||
this.configFluidsSlots[i] = slot;
|
||||
this.registerVirtualSlots(slot);
|
||||
}
|
||||
|
||||
final int iyo = 29;
|
||||
for (int y = 0; y < 7; y++) {
|
||||
for (int ix = 0; ix < 9; ix++) {
|
||||
VirtualMEPhantomSlotPrecise slot = new VirtualMEPhantomSlotPrecise(
|
||||
xo + ix * 18,
|
||||
iyo + y * 18,
|
||||
this.containerSuperStockReplenisher.configItemsSlots,
|
||||
y * 9 + ix,
|
||||
this::acceptType);
|
||||
this.configItemsSlots[y * 9 + ix] = slot;
|
||||
this.registerVirtualSlots(slot);
|
||||
}
|
||||
}
|
||||
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_146977_a(Slot s) {
|
||||
if (s instanceof SlotFake) {
|
||||
this.drawFillStatus(s);
|
||||
}
|
||||
super.func_146977_a(s);
|
||||
}
|
||||
private void drawFillStatus(VirtualMEPhantomSlotPrecise virtualSlot) {
|
||||
final int offsetX = virtualSlot.getX() - 8;
|
||||
final int offsetY = virtualSlot.getY() - 12;
|
||||
final IAEStack<?> aes = virtualSlot.getAEStack();
|
||||
final long stackSize = aes != null ? aes.getStackSize() : 0;
|
||||
final int slotIndex = virtualSlot.getStorageName() == StorageName.NONE ? virtualSlot.getSlotIndex()
|
||||
: virtualSlot.getSlotIndex() + 100;
|
||||
|
||||
private void drawFillStatus(Slot slotIn) {
|
||||
int offsetX = slotIn.xDisplayPosition - 8;
|
||||
int offsetY = slotIn.yDisplayPosition - 11;
|
||||
ItemStack itemstack = slotIn.getStack();
|
||||
int slotInt = slotIn.slotNumber;
|
||||
if (itemstack != null) {
|
||||
if (stackSize != 0) {
|
||||
String s = "0%";
|
||||
if (slotInt > 0 && slotInt < 10) {
|
||||
IAEStack<?> aeStack = list.get(slotInt - 1);
|
||||
if (aeStack != null)
|
||||
s = (int) (((float) aeStack.getStackSize() / ItemFluidPacket.getFluidAmount(itemstack)) * 100)
|
||||
+ "%";
|
||||
} else if (slotInt > 9 && slotInt < 73) {
|
||||
IAEStack<?> aeStack = list.get(slotInt + 90);
|
||||
if (aeStack != null && itemstack.stackSize > 0) {
|
||||
long i = aeStack.getStackSize();
|
||||
s = (int) (((float) i / itemstack.stackSize) * 100) + "%";
|
||||
}
|
||||
}
|
||||
IAEStack<?> aeStack = list.get(slotIndex);
|
||||
|
||||
if (aeStack != null) s = df.format((float) aeStack.getStackSize() / stackSize * 100) + "%";
|
||||
|
||||
float scale = 0.5f;
|
||||
float shiftX = 2;
|
||||
float shiftY = 1;
|
||||
final float inverseScaleFactor = 1.0f / scale;
|
||||
|
||||
final int X = (int) (((float) offsetX - shiftX + 10.0f) * inverseScaleFactor);
|
||||
final int Y = (int) (((float) offsetY - shiftY + 16.0f - 7.0f * scale) * inverseScaleFactor);
|
||||
final int X = (int) (((float) offsetX - shiftX + 10.0f) * inverseScaleFactor) + 1;
|
||||
final int Y = (int) (((float) offsetY - shiftY + 16.0f - 7.0f * scale) * inverseScaleFactor) + 2;
|
||||
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
this.fontRendererObj.drawStringWithShadow(s, X, Y, 16777215);
|
||||
@@ -104,9 +123,16 @@ public class GuiSuperStockReplenisher extends AEBaseGui {
|
||||
}
|
||||
}
|
||||
|
||||
private void drawVirtualSlots() {
|
||||
for (VirtualMEPhantomSlotPrecise slot : this.configFluidsSlots) this.drawFillStatus(slot);
|
||||
for (VirtualMEPhantomSlotPrecise slot : this.configItemsSlots) this.drawFillStatus(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
|
||||
fontRendererObj
|
||||
.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, FCGuiColors.guiTextColorGray.getColor());
|
||||
this.drawVirtualSlots();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -115,7 +141,25 @@ public class GuiSuperStockReplenisher extends AEBaseGui {
|
||||
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (actionPerformedCustomButtons(btn)) return;
|
||||
if (btn == StockModeButton) {
|
||||
boolean newMode = !containerSuperStockReplenisher.isFullStockMode();
|
||||
this.containerSuperStockReplenisher.setFullStockMode(newMode);
|
||||
StockModeButton.set(newMode ? "fullstockMode" : "normalMode");
|
||||
|
||||
this.flushPendingSync();
|
||||
}
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
|
||||
public void update(Map<Integer, IAEStack<?>> map) {
|
||||
this.list = map;
|
||||
}
|
||||
|
||||
private boolean acceptType(VirtualMEPhantomSlot slot, IAEStackType<?> type, int mouseButton) {
|
||||
if (slot.getStorageName() == StorageName.NONE) return type == AEFluidStackType.FLUID_STACK_TYPE;
|
||||
else return type == AEItemStackType.ITEM_STACK_TYPE;
|
||||
}
|
||||
}
|
||||
+11
-1
@@ -1,7 +1,10 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.DROP;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.PACKET;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.common.tile.TileFluidPacketDecoder;
|
||||
@@ -13,7 +16,14 @@ public class ContainerFluidPacketDecoder extends AEBaseContainer {
|
||||
|
||||
public ContainerFluidPacketDecoder(InventoryPlayer ipl, TileFluidPacketDecoder tile) {
|
||||
super(ipl, tile);
|
||||
addSlotToContainer(new FCSlotRestrictedInput(PACKET.stack(), tile.getInventory(), 0, 80, 35, ipl));
|
||||
addSlotToContainer(
|
||||
new FCSlotRestrictedInput(
|
||||
Arrays.asList(PACKET.stack(), DROP.stack()),
|
||||
tile.getInventory(),
|
||||
0,
|
||||
80,
|
||||
35,
|
||||
ipl));
|
||||
bindPlayerInventory(ipl, 0, 84);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -110,7 +110,7 @@ public class ContainerLevelMaintainer extends ContainerSubGui implements IVirtua
|
||||
(EntityPlayerMP) this.getInventoryPlayer().player);
|
||||
}
|
||||
FluidCraft.proxy.netHandler.sendTo(
|
||||
new SPacketLevelMaintainerGuiUpdate(this.tile.requests, !this.isFirstUpdate),
|
||||
new SPacketLevelMaintainerGuiUpdate(this.tile.requests, !this.isFirstUpdate, this.tile.isLiteMode()),
|
||||
(EntityPlayerMP) this.getInventoryPlayer().player);
|
||||
this.isFirstUpdate = false;
|
||||
this.updateCount = 0;
|
||||
@@ -126,7 +126,7 @@ public class ContainerLevelMaintainer extends ContainerSubGui implements IVirtua
|
||||
NetworkHandler.instance
|
||||
.sendTo(new PacketVirtualSlot(StorageName.NONE, slotStacks), (EntityPlayerMP) player);
|
||||
FluidCraft.proxy.netHandler.sendTo(
|
||||
new SPacketLevelMaintainerGuiUpdate(this.tile.requests, false),
|
||||
new SPacketLevelMaintainerGuiUpdate(this.tile.requests, false, this.tile.isLiteMode()),
|
||||
(EntityPlayerMP) player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,9 +155,9 @@ public class ContainerLevelTerminal extends FCBaseContainer {
|
||||
if (update == null) update = new SPacketLevelTerminalUpdate();
|
||||
update.addOverwriteSlotEntry(knownTracker.id, i, null);
|
||||
} else if (!Platform.isStacksIdentical(prev[i].stack, curr[i].stack)
|
||||
|| prev[i].quantity == curr[i].quantity
|
||||
|| prev[i].batchSize == curr[i].batchSize
|
||||
|| prev[i].state == curr[i].state) {
|
||||
|| prev[i].quantity != curr[i].quantity
|
||||
|| prev[i].batchSize != curr[i].batchSize
|
||||
|| prev[i].state != curr[i].state) {
|
||||
knownTracker.infoList[i] = curr[i];
|
||||
if (update == null) update = new SPacketLevelTerminalUpdate();
|
||||
update.addOverwriteSlotEntry(knownTracker.id, i, curr[i]);
|
||||
|
||||
@@ -24,10 +24,12 @@ public class ContainerLevelWireless extends ContainerLevelTerminal {
|
||||
@Override
|
||||
public PrimaryGui createPrimaryGui() {
|
||||
ContainerOpenContext context = getOpenContext();
|
||||
return new FluidPrimaryGui(
|
||||
PrimaryGui primaryGui = new FluidPrimaryGui(
|
||||
GuiType.WIRELESS_LEVEL_TERMINAL,
|
||||
ItemAndBlockHolder.WIRELESS_LEVEL_TERM.stack(),
|
||||
context.getTile(),
|
||||
context.getSide());
|
||||
primaryGui.setSlotIndex(getTargetSlotIndex());
|
||||
return primaryGui;
|
||||
}
|
||||
}
|
||||
+82
-112
@@ -3,63 +3,70 @@ package com.glodblock.github.client.gui.container;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.item.FCBaseItemCell;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.client.gui.GuiFCImgButton;
|
||||
import com.glodblock.github.common.tile.TileSuperStockReplenisher;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.slot.OptionalFluidSlotFake;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.network.SPacketSuperStockReplenisherUpdate;
|
||||
import com.glodblock.github.util.FluidPrimaryGui;
|
||||
|
||||
import appeng.api.implementations.items.IStorageCell;
|
||||
import appeng.api.storage.StorageName;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.client.gui.implementations.GuiPatternItemRenamer;
|
||||
import appeng.client.gui.implementations.GuiPatternValueAmount;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerOpenContext;
|
||||
import appeng.container.PrimaryGui;
|
||||
import appeng.container.interfaces.IVirtualSlotHolder;
|
||||
import appeng.container.interfaces.IVirtualSlotSource;
|
||||
import appeng.container.slot.IOptionalSlotHost;
|
||||
import appeng.container.slot.SlotPatternOutputs;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketVirtualSlot;
|
||||
import appeng.items.storage.ItemBasicStorageCell;
|
||||
import appeng.container.sync.SyncManager;
|
||||
import appeng.container.sync.handlers.AEStackInventorySyncHandler;
|
||||
import appeng.container.sync.handlers.BooleanSyncHandler;
|
||||
import appeng.tile.inventory.IAEStackInventory;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ContainerSuperStockReplenisher extends AEBaseContainer
|
||||
implements IOptionalSlotHost, IVirtualSlotHolder, IVirtualSlotSource {
|
||||
public class ContainerSuperStockReplenisher extends AEBaseContainer implements IVirtualSlotSource {
|
||||
|
||||
private final TileSuperStockReplenisher tile;
|
||||
private final IInventory configFluids;
|
||||
private final IInventory configItems;
|
||||
private int lastUpdated = 0;
|
||||
|
||||
private int lastUpdated = 1337;
|
||||
|
||||
private final IAEStackInventory configFluids;
|
||||
public final AEStackInventorySyncHandler configFluidsSlots;
|
||||
|
||||
private final IAEStackInventory configItems;
|
||||
public final AEStackInventorySyncHandler configItemsSlots;
|
||||
|
||||
public final BooleanSyncHandler fullStockModeSync;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private GuiFCImgButton modeButton;
|
||||
|
||||
public ContainerSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockReplenisher tile) {
|
||||
super(ipl, tile);
|
||||
this.tile = tile;
|
||||
configFluids = tile.getConfigFluid();
|
||||
configItems = tile.getConfigItems();
|
||||
this.configFluids = tile.getConfigFluids();
|
||||
this.configItems = tile.getConfigItems();
|
||||
final IInventory cell = tile.getCell();
|
||||
|
||||
final int x = 8;
|
||||
final int fy = 8;
|
||||
final SyncManager sm = this.getSyncManager();
|
||||
this.configFluidsSlots = sm.root().aeStackInventory("fluidConfig", this.configFluids);
|
||||
this.configItemsSlots = sm.root().aeStackInventory("itemConfig", this.configItems);
|
||||
this.fullStockModeSync = sm.root().booleanSync("fullstockMode").onClientChange((oldValue, newValue) -> {
|
||||
if (this.modeButton != null) {
|
||||
this.modeButton.set(newValue ? "fullstockMode" : "normalMode");
|
||||
}
|
||||
}).onServerChange((oldValue, newValue) -> this.tile.setFullStockMode(newValue));
|
||||
|
||||
this.addSlotToContainer(
|
||||
new SlotRestrictedInput(
|
||||
@@ -67,56 +74,38 @@ public class ContainerSuperStockReplenisher extends AEBaseContainer
|
||||
cell,
|
||||
0,
|
||||
173,
|
||||
fy,
|
||||
8,
|
||||
this.getInventoryPlayer()));
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
addSlotToContainer(new OptionalFluidSlotFake(configFluids, this, i, x, fy, i, 0, 0));
|
||||
}
|
||||
|
||||
final int io = 29;
|
||||
for (int y = 0; y < 7; y++) {
|
||||
for (int ix = 0; ix < 9; ix++) {
|
||||
this.addSlotToContainer(new SlotPatternOutputs(configItems, this, y * 9 + ix, x, io, ix, y, y));
|
||||
}
|
||||
}
|
||||
|
||||
bindPlayerInventory(ipl, 0, 251 - 82);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setModeButton(GuiFCImgButton button) {
|
||||
this.modeButton = button;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int slotId, int clickedButton, int mode, EntityPlayer player) {
|
||||
if (slotId == 0 && player.inventory.getItemStack() == null && isConfigurated()) {
|
||||
return null;
|
||||
}
|
||||
if (slotId == 0 && player.inventory.getItemStack() == null && isConfigurated()) return null;
|
||||
return super.slotClick(slotId, clickedButton, mode, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlotEnabled(int idx) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting p_75132_1_) {
|
||||
super.addCraftingToCrafters(p_75132_1_);
|
||||
lastUpdated = 24;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
if (Platform.isClient()) return;
|
||||
|
||||
if (lastUpdated > 20) {
|
||||
lastUpdated = 0;
|
||||
if (this.lastUpdated > 20) {
|
||||
this.lastUpdated = 0;
|
||||
Map<Integer, IAEStack<?>> tmp = new HashMap<>();
|
||||
|
||||
for (int i = 0; i < tile.getInternalFluid().getSlots(); i++) {
|
||||
tmp.put(i, tile.getInternalFluid().getFluidInSlot(i));
|
||||
for (int i = 0; i < this.tile.getInternalFluid().getSlots(); i++) {
|
||||
tmp.put(i, this.tile.getInternalFluid().getFluidInSlot(i));
|
||||
}
|
||||
|
||||
for (int i = 0; i < tile.getInternalInventory().getSizeInventory(); i++) {
|
||||
tmp.put(i + 100, AEItemStack.create(tile.getInternalInventory().getStackInSlot(i)));
|
||||
for (int i = 0; i < this.tile.getInternalInventory().getSizeInventory(); i++) {
|
||||
tmp.put(i + 100, AEItemStack.create(this.tile.getInternalInventory().getStackInSlot(i)));
|
||||
}
|
||||
|
||||
for (final Object g : this.crafters) {
|
||||
@@ -124,21 +113,20 @@ public class ContainerSuperStockReplenisher extends AEBaseContainer
|
||||
FluidCraft.proxy.netHandler.sendTo(new SPacketSuperStockReplenisherUpdate(tmp), (EntityPlayerMP) g);
|
||||
}
|
||||
}
|
||||
|
||||
if (Platform.isServer()) this.setFullStockMode(this.tile.isFullStockMode());
|
||||
|
||||
}
|
||||
lastUpdated++;
|
||||
|
||||
this.lastUpdated++;
|
||||
}
|
||||
|
||||
private boolean isConfigurated() {
|
||||
for (int i = 0; i < configItems.getSizeInventory(); i++) {
|
||||
if (configItems.getStackInSlot(i) != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < configFluids.getSizeInventory(); i++) {
|
||||
if (configFluids.getStackInSlot(i) != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < this.configItems.getSizeInventory(); i++)
|
||||
if (this.configItems.getAEStackInSlot(i) != null) return true;
|
||||
|
||||
for (int i = 0; i < this.configFluids.getSizeInventory(); i++)
|
||||
if (this.configFluids.getAEStackInSlot(i) != null) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -148,17 +136,9 @@ public class ContainerSuperStockReplenisher extends AEBaseContainer
|
||||
long currentBytes = 0;
|
||||
long newBytes = -1;
|
||||
|
||||
if (s.getStack().getItem() instanceof ItemBasicStorageCell ibsc) {
|
||||
currentBytes = ibsc.getBytesLong(is);
|
||||
} else if (s.getStack().getItem() instanceof FCBaseItemCell fcbic) {
|
||||
currentBytes = fcbic.getBytes(is);
|
||||
}
|
||||
if (s.getStack().getItem() instanceof IStorageCell isc) currentBytes = isc.getBytesLong(is);
|
||||
|
||||
if (is.getItem() instanceof ItemBasicStorageCell ibsc) {
|
||||
newBytes = ibsc.getBytesLong(is);
|
||||
} else if (is.getItem() instanceof FCBaseItemCell fcbic) {
|
||||
newBytes = fcbic.getBytes(is);
|
||||
}
|
||||
if (is.getItem() instanceof IStorageCell isc) newBytes = isc.getBytesLong(is);
|
||||
|
||||
if (currentBytes > newBytes) {
|
||||
return false;
|
||||
@@ -167,10 +147,6 @@ public class ContainerSuperStockReplenisher extends AEBaseContainer
|
||||
return super.isValidForSlot(s, is);
|
||||
}
|
||||
|
||||
public TileSuperStockReplenisher getTile() {
|
||||
return tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrimaryGui createPrimaryGui() {
|
||||
ContainerOpenContext context = getOpenContext();
|
||||
@@ -181,40 +157,34 @@ public class ContainerSuperStockReplenisher extends AEBaseContainer
|
||||
context.getSide());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveSlotStacks(StorageName invName, Int2ObjectMap<IAEStack<?>> slotStacks) {
|
||||
var entry = slotStacks.int2ObjectEntrySet().iterator().next();
|
||||
IAEStack<?> aes = entry.getValue();
|
||||
int slotIndex = entry.getIntKey();
|
||||
|
||||
if (Platform.isServer()) {
|
||||
for (ICrafting crafter : this.crafters) {
|
||||
final EntityPlayerMP emp = (EntityPlayerMP) crafter;
|
||||
NetworkHandler.instance.sendTo(new PacketVirtualSlot(invName, slotIndex, aes), emp);
|
||||
}
|
||||
} else {
|
||||
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
|
||||
if (gs instanceof GuiPatternValueAmount gpva) {
|
||||
gpva.update();
|
||||
} else if (gs instanceof GuiPatternItemRenamer gpir) {
|
||||
gpir.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateVirtualSlot(StorageName invName, int slotId, IAEStack<?> aes) {
|
||||
if (aes instanceof IAEItemStack ais) {
|
||||
ItemStack newIs;
|
||||
if (ais.getItem() instanceof ItemFluidPacket) {
|
||||
newIs = ais.getItemStack();
|
||||
newIs.stackSize = 1;
|
||||
ItemFluidPacket.setFluidAmount(newIs, aes.getStackSize());
|
||||
} else {
|
||||
newIs = ais.getItemStack();
|
||||
if (aes != null && aes.getStackSize() > Integer.MAX_VALUE) aes.setStackSize(Integer.MAX_VALUE);
|
||||
switch (invName) {
|
||||
case NONE -> {
|
||||
this.configFluids.putAEStackInSlot(slotId, aes);
|
||||
this.configFluidsSlots.markDirty();
|
||||
}
|
||||
case CONFIG -> {
|
||||
this.configItems.putAEStackInSlot(slotId, aes);
|
||||
this.configItemsSlots.markDirty();
|
||||
}
|
||||
this.inventorySlots.get(slotId).putStack(newIs);
|
||||
}
|
||||
}
|
||||
|
||||
public TileSuperStockReplenisher getTile() {
|
||||
return this.tile;
|
||||
}
|
||||
|
||||
public boolean isFullStockMode() {
|
||||
return this.fullStockModeSync.get();
|
||||
}
|
||||
|
||||
public void setFullStockMode(final boolean fullStockMode) {
|
||||
this.fullStockModeSync.set(fullStockMode);
|
||||
}
|
||||
|
||||
public void markDirty() {
|
||||
this.fullStockModeSync.markDirty();
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,12 @@ public class ItemPacketRender implements IItemRenderer {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
final boolean entity = type.equals(ItemRenderType.ENTITY);
|
||||
if (entity) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotated(90.0D, 0.0D, 1.0D, 0.0D);
|
||||
GL11.glTranslated(-0.5D, -0.6D, 0.0D);
|
||||
}
|
||||
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(item);
|
||||
int RGB = fluid == null ? 0xFFFFFF : fluid.getFluid().getColor(fluid);
|
||||
@@ -65,6 +71,9 @@ public class ItemPacketRender implements IItemRenderer {
|
||||
0.0625F);
|
||||
}
|
||||
|
||||
if (entity) {
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
package com.glodblock.github.client.render;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.tile.TileWalrus;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
|
||||
@@ -19,9 +14,6 @@ import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
|
||||
public class ItemWalrusRender implements IItemRenderer {
|
||||
|
||||
IModelCustom modelWalrus = AdvancedModelLoader.loadModel(FluidCraft.resource("models/walrus.obj"));
|
||||
ResourceLocation textureWalrus = FluidCraft.resource("textures/blocks/walrus.png");
|
||||
|
||||
public ItemWalrusRender() {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileWalrus.class, new RenderBlockWalrus());
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ItemAndBlockHolder.WALRUS), this);
|
||||
@@ -34,7 +26,6 @@ public class ItemWalrusRender implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(this.textureWalrus);
|
||||
GL11.glPushMatrix();
|
||||
switch (type) {
|
||||
case EQUIPPED_FIRST_PERSON -> {
|
||||
@@ -44,7 +35,7 @@ public class ItemWalrusRender implements IItemRenderer {
|
||||
case INVENTORY -> GL11.glTranslatef(-0.5F, -0.5F, -0.1F);
|
||||
default -> {}
|
||||
}
|
||||
this.modelWalrus.renderAll();
|
||||
WalrusRenderer.render();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
import com.glodblock.github.common.block.BlockFluidInterface;
|
||||
import com.glodblock.github.common.tile.TileFluidInterface;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.BlockRenderInfo;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
@@ -25,15 +26,18 @@ public class RenderBlockFluidInterface extends BaseBlockRender<BlockFluidInterfa
|
||||
final TileInterface ti = block.getTileEntity(world, x, y, z);
|
||||
final BlockRenderInfo info = block.getRendererInstance();
|
||||
|
||||
if (ti != null && ti.getForward() != ForgeDirection.UNKNOWN) {
|
||||
final IIcon side = FCPartsTexture.BlockFluidInterfaceAlternate_Arrow.getIcon();
|
||||
info.setTemporaryRenderIcons(
|
||||
FCPartsTexture.BlockInterfaceAlternate.getIcon(),
|
||||
block.getIcon(0, 0),
|
||||
side,
|
||||
side,
|
||||
side,
|
||||
side);
|
||||
if (ti != null) {
|
||||
final AEColor color = ti.getProxy().getColor();
|
||||
if (ti.getForward() != ForgeDirection.UNKNOWN) {
|
||||
final IIcon face = color == AEColor.Transparent ? block.getIcon(0, 0)
|
||||
: block.getColoredTexture(0, color);
|
||||
final IIcon alternate = color == AEColor.Transparent ? FCPartsTexture.BlockInterfaceAlternate.getIcon()
|
||||
: block.getColoredTexture(1, color);
|
||||
final IIcon side = color == AEColor.Transparent
|
||||
? FCPartsTexture.BlockFluidInterfaceAlternate_Arrow.getIcon()
|
||||
: block.getColoredTexture(2, color);
|
||||
info.setTemporaryRenderIcons(alternate, face, side, side, side, side);
|
||||
}
|
||||
}
|
||||
|
||||
final boolean fz = super.renderInWorld(block, world, x, y, z, renderer);
|
||||
|
||||
@@ -1,25 +1,16 @@
|
||||
package com.glodblock.github.client.render;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.tile.TileWalrus;
|
||||
|
||||
public class RenderBlockWalrus extends TileEntitySpecialRenderer {
|
||||
|
||||
IModelCustom modelWalrus = AdvancedModelLoader.loadModel(FluidCraft.resource("models/walrus.obj"));
|
||||
ResourceLocation textureWalrus = FluidCraft.resource("textures/blocks/walrus.png");
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTickTime) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(this.textureWalrus);
|
||||
if (!(tileentity instanceof TileWalrus Tile)) return;
|
||||
float scale = Tile.getWalrusScale();
|
||||
GL11.glPushMatrix();
|
||||
@@ -42,7 +33,7 @@ public class RenderBlockWalrus extends TileEntitySpecialRenderer {
|
||||
break;
|
||||
}
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
this.modelWalrus.renderAll();
|
||||
WalrusRenderer.render();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.glodblock.github.client.render;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.gtnewhorizon.gtnhlib.client.model.wavefront.WavefrontVBOBuilder;
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.vao.IVertexArrayObject;
|
||||
|
||||
public final class WalrusRenderer {
|
||||
|
||||
private static IVertexArrayObject walrus;
|
||||
private static final ResourceLocation textureWalrus = FluidCraft.resource("textures/blocks/walrus.png");
|
||||
|
||||
public static void load() {
|
||||
walrus = WavefrontVBOBuilder.compileToVBO(FluidCraft.resource("models/walrus.obj"));
|
||||
}
|
||||
|
||||
public static void render() {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(textureWalrus);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
walrus.render();
|
||||
}
|
||||
}
|
||||
@@ -12,12 +12,6 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public enum FCPartsTexture {
|
||||
|
||||
PartFluidTerminal_Bright("fluid_terminal_bright"),
|
||||
PartFluidTerminal_Dark("fluid_terminal_dark"),
|
||||
PartFluidTerminal_Colored("fluid_terminal_medium"),
|
||||
PartFluidPatternTerminal_Bright("pattern_terminal_bright"),
|
||||
PartFluidPatternTerminal_Dark("pattern_terminal_dark"),
|
||||
PartFluidPatternTerminal_Colored("pattern_terminal_medium"),
|
||||
PartLevelTerminal_Bright("level_terminal_bright"),
|
||||
PartLevelTerminal_Dark("level_terminal_dark"),
|
||||
PartLevelTerminal_Colored("level_terminal_medium"),
|
||||
@@ -28,9 +22,15 @@ public enum FCPartsTexture {
|
||||
BlockFluidInterfaceAlternate_Arrow("fluid_interface_arrow"),
|
||||
BlockInterfaceAlternate("fluid_interface_a"),
|
||||
BlockInterface_Face("fluid_interface"),
|
||||
PartFluidLevelEmitter("fluid_level_emitter"),
|
||||
BlockLevelMaintainer("level_maintainer"),
|
||||
BlockLevelMaintainer_Active("level_maintainer_active");
|
||||
BlockLevelMaintainer_Active("level_maintainer_active"),
|
||||
PartFluidFormationPlane("fluid_formation_plane"),
|
||||
PartFluidAnnihilationPlane("fluid_annihilation_plane"),
|
||||
PartFluidFormationPlaneOn("fluid_formation_plane_on"),
|
||||
PartFluidAnnihilationPlaneOn("fluid_annihilation_plane_on"),
|
||||
BlockMEChestFluid_Bright("fluid_terminal_light"),
|
||||
BlockMEChestFluid_Dark("fluid_terminal_dark"),
|
||||
BlockMEChestFluid_Medium("fluid_terminal_medium");
|
||||
|
||||
private final String name;
|
||||
public net.minecraft.util.IIcon IIcon;
|
||||
|
||||
@@ -4,7 +4,10 @@ import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@@ -13,6 +16,7 @@ import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.common.tile.TileFluidInterface;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.block.AEBaseItemBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
@@ -25,6 +29,12 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockFluidInterface extends FCBaseBlock {
|
||||
|
||||
private static final String[] COLORED_TEXTURES = { "fluid_interface", "fluid_interface_a",
|
||||
"fluid_interface_arrow" };
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[][] coloredTextures;
|
||||
|
||||
public BlockFluidInterface() {
|
||||
super(Material.iron, NameConst.BLOCK_FLUID_INTERFACE);
|
||||
setFullBlock(true);
|
||||
@@ -39,6 +49,38 @@ public class BlockFluidInterface extends FCBaseBlock {
|
||||
return new RenderBlockFluidInterface();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(final IIconRegister iconRegistry) {
|
||||
super.registerBlockIcons(iconRegistry);
|
||||
this.coloredTextures = new IIcon[COLORED_TEXTURES.length][AEColor.VALUES.length];
|
||||
|
||||
for (final AEColor color : AEColor.VALID_COLORS) {
|
||||
for (int id = 0; id < COLORED_TEXTURES.length; id++) {
|
||||
this.coloredTextures[id][color.ordinal()] = iconRegistry
|
||||
.registerIcon("ae2fc:interface/" + COLORED_TEXTURES[id] + "_" + color.name());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getColoredTexture(final int id, final AEColor color) {
|
||||
return this.coloredTextures[id][color.ordinal()];
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
final TileInterface tile = this.getTileEntity(world, x, y, z);
|
||||
if (tile != null && tile.getForward() == ForgeDirection.UNKNOWN) {
|
||||
final AEColor color = tile.getProxy().getColor();
|
||||
if (color != AEColor.Transparent) {
|
||||
return this.getColoredTexture(0, color);
|
||||
}
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(final World world, final int x, final int y, final int z, final EntityPlayer player,
|
||||
final int facing, final float hitX, final float hitY, final float hitZ) {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.glodblock.github.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@@ -13,11 +15,17 @@ import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.block.AEBaseItemBlock;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockSuperStockReplenisher extends FCBaseBlock {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] coloredTextures;
|
||||
|
||||
public BlockSuperStockReplenisher() {
|
||||
super(Material.web, NameConst.BLOCK_SUPER_STOCK_REPLENISHER);
|
||||
setTileEntity(TileSuperStockReplenisher.class);
|
||||
@@ -26,6 +34,28 @@ public class BlockSuperStockReplenisher extends FCBaseBlock {
|
||||
this.lightOpacity = 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(final IIconRegister iconRegistry) {
|
||||
super.registerBlockIcons(iconRegistry);
|
||||
this.coloredTextures = new IIcon[AEColor.VALUES.length];
|
||||
|
||||
for (final AEColor color : AEColor.VALID_COLORS) {
|
||||
this.coloredTextures[color.ordinal()] = iconRegistry
|
||||
.registerIcon(this.getTextureName().replace(":", ":replenisher/") + "_" + color.name());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(final IBlockAccess world, final int x, final int y, final int z, final int side) {
|
||||
final TileSuperStockReplenisher tile = this.getTileEntity(world, x, y, z);
|
||||
if (tile != null && tile.getColor() != AEColor.Transparent) {
|
||||
return this.coloredTextures[tile.getColor().ordinal()];
|
||||
}
|
||||
return super.getIcon(world, x, y, z, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(World world, int x, int y, int z, EntityPlayer player, int facing, float hitX,
|
||||
float hitY, float hitZ) {
|
||||
@@ -47,15 +77,6 @@ public class BlockSuperStockReplenisher extends FCBaseBlock {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World w, int x, int y, int z, Block a, int b) {
|
||||
final TileSuperStockReplenisher tss = this.getTileEntity(w, x, y, z);
|
||||
if (tss != null) {
|
||||
tss.fullRefund();
|
||||
}
|
||||
super.breakBlock(w, x, y, z, a, b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockSuperStockReplenisher register() {
|
||||
GameRegistry.registerBlock(this, AEBaseItemBlock.class, NameConst.BLOCK_SUPER_STOCK_REPLENISHER);
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.item.BaseItemBlockContainer;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.common.tile.TileWalrus;
|
||||
@@ -30,6 +31,8 @@ public class BlockWalrus extends BaseBlockContainer {
|
||||
setHardness(2.0F);
|
||||
setResistance(10.0F);
|
||||
setBlockName(NameConst.BLOCK_WALRUS);
|
||||
// only used for hit/break particles, the block itself is rendered by RenderBlockWalrus
|
||||
setBlockTextureName(FluidCraft.MODID + ":" + NameConst.BLOCK_WALRUS + "_particle");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.glodblock.github.common.block;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
|
||||
@@ -16,8 +14,6 @@ import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.ActivityState;
|
||||
import appeng.core.features.BlockStackSrc;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public abstract class FCBaseBlock extends AEBaseTileBlock implements IRegister<FCBaseBlock> {
|
||||
|
||||
@@ -46,15 +42,6 @@ public abstract class FCBaseBlock extends AEBaseTileBlock implements IRegister<F
|
||||
super.setFeature(f);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(final ItemStack itemStack, final EntityPlayer player, final List<String> toolTip,
|
||||
final boolean advancedToolTips) {}
|
||||
|
||||
public void addCheckedInformation(ItemStack itemStack, EntityPlayer player, List<String> toolTip,
|
||||
boolean advancedToolTips) {
|
||||
this.addInformation(itemStack, player, toolTip, advancedToolTips);
|
||||
}
|
||||
|
||||
public ItemStack stack(int size) {
|
||||
return new ItemStack(this, size);
|
||||
}
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
package com.glodblock.github.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.glodblock.github.common.block.FCBaseBlock;
|
||||
|
||||
import appeng.block.AEBaseItemBlock;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class FCBaseItemBlock extends AEBaseItemBlock {
|
||||
|
||||
@@ -20,11 +14,4 @@ public class FCBaseItemBlock extends AEBaseItemBlock {
|
||||
super(id);
|
||||
blockType = (FCBaseBlock) id;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addCheckedInformation(final ItemStack itemStack, final EntityPlayer player, final List<String> toolTip,
|
||||
final boolean advancedToolTips) {
|
||||
blockType.addCheckedInformation(itemStack, player, toolTip, advancedToolTips);
|
||||
super.addCheckedInformation(itemStack, player, toolTip, advancedToolTips);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,12 @@ package com.glodblock.github.common.item;
|
||||
|
||||
import static appeng.util.item.AEFluidStackType.FLUID_STACK_TYPE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -10,9 +15,17 @@ import com.glodblock.github.common.storage.CellType;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.items.AEBaseCell;
|
||||
import appeng.util.Platform;
|
||||
import appeng.me.storage.FluidCellInventoryHandler;
|
||||
import appeng.util.IterationCounter;
|
||||
import appeng.util.ReadableNumberConverter;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public abstract class FCBaseItemCell extends AEBaseCell {
|
||||
|
||||
@@ -32,6 +45,38 @@ public abstract class FCBaseItemCell extends AEBaseCell {
|
||||
return FLUID_STACK_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addCheckedInformation(final ItemStack stack, final EntityPlayer player, final List<String> lines,
|
||||
final boolean displayMoreInfo) {
|
||||
super.addCheckedInformation(stack, player, lines, displayMoreInfo);
|
||||
|
||||
final IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell()
|
||||
.getCellInventory(stack, null, getStackType());
|
||||
if (!(inventory instanceof FluidCellInventoryHandler handler) || handler.getCellInv().getTotalItemTypes() != 1
|
||||
|| handler.getCellInv().getStoredItemTypes() == 0)
|
||||
return;
|
||||
|
||||
final IAEFluidStack content = handler
|
||||
.getAvailableItems(FLUID_STACK_TYPE.createPrimitiveList(), IterationCounter.fetchNewId())
|
||||
.getFirstItem();
|
||||
final String oldLine = GuiText.Contains.getLocal() + ": " + content.getDisplayName();
|
||||
final int oldLineIndex = lines.lastIndexOf(oldLine);
|
||||
if (oldLineIndex >= 0) {
|
||||
if (!GuiScreen.isCtrlKeyDown()) {
|
||||
lines.set(oldLineIndex, EnumChatFormatting.GRAY + GuiText.HoldCtrlForContents.getLocal());
|
||||
return;
|
||||
}
|
||||
final String unit = FLUID_STACK_TYPE.getDisplayUnit();
|
||||
lines.set(
|
||||
oldLineIndex,
|
||||
" " + content.getDisplayName()
|
||||
+ " x"
|
||||
+ ReadableNumberConverter.INSTANCE.toWideReadableForm(content.getStackSize())
|
||||
+ (unit.isEmpty() ? "" : " " + unit));
|
||||
}
|
||||
}
|
||||
|
||||
public FCBaseItemCell(Optional subName) {
|
||||
super(subName);
|
||||
}
|
||||
@@ -53,18 +98,7 @@ public abstract class FCBaseItemCell extends AEBaseCell {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCellData(ItemStack is) {
|
||||
return totalBytes + ","
|
||||
+ this.getTotalTypes(null)
|
||||
+ ","
|
||||
+ perType
|
||||
+ ","
|
||||
+ 8 * 256
|
||||
+ ","
|
||||
+ Platform.openNbtData(is).getByte("cellRestrictionTypes")
|
||||
+ ","
|
||||
+ Platform.openNbtData(is).getLong("cellRestrictionAmount")
|
||||
+ ","
|
||||
+ "fluid";
|
||||
public boolean storableInStorageCell() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package com.glodblock.github.common.item;
|
||||
|
||||
import static com.glodblock.github.common.item.ItemWirelessUltraTerminal.MODE;
|
||||
import static com.glodblock.github.loader.recipe.WirelessTerminalEnergyRecipe.getEnergyCard;
|
||||
import static com.glodblock.github.loader.recipe.WirelessTerminalRecipe.getInfinityBoosterCard;
|
||||
import static com.glodblock.github.loader.recipe.WirelessTerminalQuantumBridgeRecipe.getQuantumBridgeCard;
|
||||
import static com.glodblock.github.util.Util.DimensionalCoordSide.hasEnergyCard;
|
||||
import static com.glodblock.github.util.Util.hasInfinityBoosterCard;
|
||||
|
||||
@@ -48,15 +48,16 @@ public class ItemBaseWirelessTerminal extends ToolWirelessTerminal implements II
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(final ItemStack item, final World w, final EntityPlayer player) {
|
||||
if (player.isSneaking()) return removeInfinityBoosterCard(player, item); // todo: doesn't work in universal
|
||||
// terminal
|
||||
if (player.isSneaking()) return removeQuantumBridgeCard(player, item); // todo: doesn't work in universal
|
||||
// terminal
|
||||
return super.onItemRightClick(item, w, player);
|
||||
}
|
||||
|
||||
private ItemStack removeInfinityBoosterCard(final EntityPlayer player, ItemStack is) {
|
||||
private ItemStack removeQuantumBridgeCard(final EntityPlayer player, ItemStack is) {
|
||||
if (hasInfinityBoosterCard(is)) {
|
||||
if (!player.inventory.addItemStackToInventory(getInfinityBoosterCard())) {
|
||||
player.entityDropItem(getInfinityBoosterCard(), 0);
|
||||
ItemStack quantumBridgeCardStack = getQuantumBridgeCard().copy();
|
||||
if (!player.inventory.addItemStackToInventory(quantumBridgeCardStack)) {
|
||||
player.entityDropItem(quantumBridgeCardStack, 0);
|
||||
}
|
||||
is.getTagCompound().setBoolean(infinityBoosterCard, false);
|
||||
}
|
||||
@@ -71,7 +72,7 @@ public class ItemBaseWirelessTerminal extends ToolWirelessTerminal implements II
|
||||
if (GuiScreen.isCtrlKeyDown()) {
|
||||
lines.add(NameConst.i18n(NameConst.TT_WIRELESS_INSTALLED));
|
||||
if (hasInfinityBoosterCard(stack)) {
|
||||
lines.add(" " + EnumChatFormatting.GOLD + getInfinityBoosterCard().getDisplayName());
|
||||
lines.add(" " + EnumChatFormatting.GOLD + getQuantumBridgeCard().getDisplayName());
|
||||
}
|
||||
if (hasEnergyCard(stack)) {
|
||||
lines.add(" " + EnumChatFormatting.GOLD + getEnergyCard().getDisplayName());
|
||||
@@ -102,7 +103,7 @@ public class ItemBaseWirelessTerminal extends ToolWirelessTerminal implements II
|
||||
Item item = is.getItem();
|
||||
if (item instanceof ItemWirelessUltraTerminal) {
|
||||
if (!is.hasTagCompound()) is.setTagCompound(new NBTTagCompound());
|
||||
return UltraTerminalModes.values()[is.getTagCompound().getInteger(MODE)];
|
||||
return UltraTerminalModes.VALUES[is.getTagCompound().getInteger(MODE)];
|
||||
} else if (item instanceof ItemWirelessPatternTerminal) {
|
||||
return UltraTerminalModes.PATTERN;
|
||||
} else if (item instanceof ItemWirelessInterfaceTerminal) {
|
||||
|
||||
+10
-10
@@ -8,7 +8,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
import com.glodblock.github.common.parts.PartFluidConversionMonitor;
|
||||
import com.glodblock.github.common.parts.PartFluidAnnihilationPlane;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
@@ -18,30 +18,30 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemFluidConversionMonitor extends FCBaseItem implements IPartItem {
|
||||
public class ItemFluidAnnihilationPlane extends FCBaseItem implements IPartItem {
|
||||
|
||||
public ItemFluidConversionMonitor() {
|
||||
public ItemFluidAnnihilationPlane() {
|
||||
this.setMaxStackSize(64);
|
||||
this.setUnlocalizedName(NameConst.ITEM_PART_FLUID_CONVERSION_MONITOR);
|
||||
this.setUnlocalizedName(NameConst.ITEM_PART_FLUID_ANNIHILATION_PLANE);
|
||||
AEApi.instance().partHelper().setItemBusRenderer(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||
float xOffset, float yOffset, float zOffset) {
|
||||
return AEApi.instance().partHelper().placeBus(player.getHeldItem(), x, y, z, side, player, world);
|
||||
return AEApi.instance().partHelper().placeBus(stack, x, y, z, side, player, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemFluidConversionMonitor register() {
|
||||
GameRegistry.registerItem(this, NameConst.ITEM_PART_FLUID_CONVERSION_MONITOR, FluidCraft.MODID);
|
||||
public ItemFluidAnnihilationPlane register() {
|
||||
GameRegistry.registerItem(this, NameConst.ITEM_PART_FLUID_ANNIHILATION_PLANE, FluidCraft.MODID);
|
||||
setCreativeTab(FluidCraftingTabs.INSTANCE);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconIndex(ItemStack p_77650_1_) {
|
||||
return FCPartsTexture.PartTerminalBroad.getIcon();
|
||||
return FCPartsTexture.PartFluidAnnihilationPlane.getIcon();
|
||||
}
|
||||
|
||||
public void registerIcons(IIconRegister _iconRegister) {}
|
||||
@@ -52,7 +52,7 @@ public class ItemFluidConversionMonitor extends FCBaseItem implements IPartItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public PartFluidConversionMonitor createPartFromItemStack(ItemStack is) {
|
||||
return new PartFluidConversionMonitor(is);
|
||||
public PartFluidAnnihilationPlane createPartFromItemStack(ItemStack is) {
|
||||
return new PartFluidAnnihilationPlane(is);
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ public class ItemFluidExportBus extends FCBaseItem implements IPartItem {
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||
float xOffset, float yOffset, float zOffset) {
|
||||
return AEApi.instance().partHelper().placeBus(player.getHeldItem(), x, y, z, side, player, world);
|
||||
return AEApi.instance().partHelper().placeBus(stack, x, y, z, side, player, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+10
-10
@@ -8,7 +8,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
import com.glodblock.github.common.parts.PartFluidStorageMonitor;
|
||||
import com.glodblock.github.common.parts.PartFluidFormationPlane;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
@@ -18,30 +18,30 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemFluidStorageMonitor extends FCBaseItem implements IPartItem {
|
||||
public class ItemFluidFormationPlane extends FCBaseItem implements IPartItem {
|
||||
|
||||
public ItemFluidStorageMonitor() {
|
||||
public ItemFluidFormationPlane() {
|
||||
this.setMaxStackSize(64);
|
||||
this.setUnlocalizedName(NameConst.ITEM_PART_FLUID_STORAGE_MONITOR);
|
||||
this.setUnlocalizedName(NameConst.ITEM_PART_FLUID_FORMATION_PLANE);
|
||||
AEApi.instance().partHelper().setItemBusRenderer(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||
float xOffset, float yOffset, float zOffset) {
|
||||
return AEApi.instance().partHelper().placeBus(player.getHeldItem(), x, y, z, side, player, world);
|
||||
return AEApi.instance().partHelper().placeBus(stack, x, y, z, side, player, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemFluidStorageMonitor register() {
|
||||
GameRegistry.registerItem(this, NameConst.ITEM_PART_FLUID_STORAGE_MONITOR, FluidCraft.MODID);
|
||||
public ItemFluidFormationPlane register() {
|
||||
GameRegistry.registerItem(this, NameConst.ITEM_PART_FLUID_FORMATION_PLANE, FluidCraft.MODID);
|
||||
setCreativeTab(FluidCraftingTabs.INSTANCE);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconIndex(ItemStack p_77650_1_) {
|
||||
return FCPartsTexture.PartTerminalBroad.getIcon();
|
||||
return FCPartsTexture.PartFluidFormationPlane.getIcon();
|
||||
}
|
||||
|
||||
public void registerIcons(IIconRegister _iconRegister) {}
|
||||
@@ -52,7 +52,7 @@ public class ItemFluidStorageMonitor extends FCBaseItem implements IPartItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PartFluidStorageMonitor createPartFromItemStack(ItemStack is) {
|
||||
return new PartFluidStorageMonitor(is);
|
||||
public PartFluidFormationPlane createPartFromItemStack(ItemStack is) {
|
||||
return new PartFluidFormationPlane(is);
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ public class ItemFluidImportBus extends FCBaseItem implements IPartItem {
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||
float xOffset, float yOffset, float zOffset) {
|
||||
return AEApi.instance().partHelper().placeBus(player.getHeldItem(), x, y, z, side, player, world);
|
||||
return AEApi.instance().partHelper().placeBus(stack, x, y, z, side, player, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
package com.glodblock.github.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
import com.glodblock.github.common.parts.PartFluidLevelEmitter;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartItem;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemFluidLevelEmitter extends FCBaseItem implements IPartItem {
|
||||
|
||||
public ItemFluidLevelEmitter() {
|
||||
this.setMaxStackSize(64);
|
||||
this.setUnlocalizedName(NameConst.ITEM_PART_FLUID_LEVEL_EMITTER);
|
||||
AEApi.instance().partHelper().setItemBusRenderer(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IPart createPartFromItemStack(ItemStack is) {
|
||||
return new PartFluidLevelEmitter(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||
float xOffset, float yOffset, float zOffset) {
|
||||
return AEApi.instance().partHelper().placeBus(player.getHeldItem(), x, y, z, side, player, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemFluidLevelEmitter register() {
|
||||
GameRegistry.registerItem(this, NameConst.ITEM_PART_FLUID_LEVEL_EMITTER, FluidCraft.MODID);
|
||||
setCreativeTab(FluidCraftingTabs.INSTANCE);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconIndex(ItemStack is) {
|
||||
return FCPartsTexture.PartFluidLevelEmitter.getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getSpriteNumber() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(final ItemStack stack, final EntityPlayer player, final List<String> lines,
|
||||
final boolean displayMoreInfo) {
|
||||
lines.add("§4Deprecated, use regular level emitter, hold CTRL for get fluid of container.");
|
||||
super.addInformation(stack, player, lines, displayMoreInfo);
|
||||
}
|
||||
}
|
||||
@@ -104,6 +104,8 @@ public class ItemFluidPacket extends FCBaseItem {
|
||||
} else {
|
||||
tooltip.add(EnumChatFormatting.RED + StatCollector.translateToLocalFormatted(NameConst.TT_INVALID_FLUID));
|
||||
}
|
||||
|
||||
tooltip.add(StatCollector.translateToLocal(NameConst.TT_FLUID_PACKET_TIPS));
|
||||
}
|
||||
|
||||
public static void setFluidAmount(ItemStack stack, long amount) {
|
||||
|
||||
@@ -34,7 +34,7 @@ public class ItemPartFluidInterface extends FCBaseItem implements IPartItem {
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||
float xOffset, float yOffset, float zOffset) {
|
||||
return AEApi.instance().partHelper().placeBus(player.getHeldItem(), x, y, z, side, player, world);
|
||||
return AEApi.instance().partHelper().placeBus(stack, x, y, z, side, player, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,7 +46,7 @@ public class ItemPartFluidInterface extends FCBaseItem implements IPartItem {
|
||||
|
||||
@Override
|
||||
protected String getIconString() {
|
||||
return NameConst.RES_KEY + "fluid_interface";
|
||||
return NameConst.RES_KEY + "part_fluid_interface";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,7 +40,7 @@ public class ItemPartFluidP2PInterface extends FCBaseItem implements IPartItem {
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||
float xOffset, float yOffset, float zOffset) {
|
||||
return AEApi.instance().partHelper().placeBus(player.getHeldItem(), x, y, z, side, player, world);
|
||||
return AEApi.instance().partHelper().placeBus(stack, x, y, z, side, player, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.glodblock.github.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.parts.IPartItem;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemPartFluidPatternTerminal extends FCBaseItem implements IPartItem {
|
||||
|
||||
public ItemPartFluidPatternTerminal() {
|
||||
this.setMaxStackSize(64);
|
||||
this.setUnlocalizedName(NameConst.ITEM_PART_FLUID_PATTERN_TERMINAL);
|
||||
AEApi.instance().partHelper().setItemBusRenderer(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public PartFluidPatternTerminal createPartFromItemStack(ItemStack is) {
|
||||
return new PartFluidPatternTerminal(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||
float xOffset, float yOffset, float zOffset) {
|
||||
return AEApi.instance().partHelper().placeBus(player.getHeldItem(), x, y, z, side, player, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemPartFluidPatternTerminal register() {
|
||||
GameRegistry.registerItem(this, NameConst.ITEM_PART_FLUID_PATTERN_TERMINAL, FluidCraft.MODID);
|
||||
setCreativeTab(FluidCraftingTabs.INSTANCE);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister _iconRegister) {}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getSpriteNumber() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> toolTip, boolean flag) {
|
||||
toolTip.add("§4DEPRECATED!");
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.glodblock.github.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.parts.IPartItem;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemPartFluidPatternTerminalEx extends FCBaseItem implements IPartItem {
|
||||
|
||||
public ItemPartFluidPatternTerminalEx() {
|
||||
this.setMaxStackSize(64);
|
||||
this.setUnlocalizedName(NameConst.ITEM_PART_FLUID_PATTERN_TERMINAL_EX);
|
||||
AEApi.instance().partHelper().setItemBusRenderer(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public PartFluidPatternTerminalEx createPartFromItemStack(ItemStack is) {
|
||||
return new PartFluidPatternTerminalEx(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||
float xOffset, float yOffset, float zOffset) {
|
||||
return AEApi.instance().partHelper().placeBus(player.getHeldItem(), x, y, z, side, player, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemPartFluidPatternTerminalEx register() {
|
||||
GameRegistry.registerItem(this, NameConst.ITEM_PART_FLUID_PATTERN_TERMINAL_EX, FluidCraft.MODID);
|
||||
setCreativeTab(FluidCraftingTabs.INSTANCE);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister _iconRegister) {}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getSpriteNumber() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> toolTip, boolean flag) {
|
||||
toolTip.add("§4DEPRECATED!");
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ public class ItemPartFluidStorageBus extends FCBaseItem implements IPartItem {
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||
float xOffset, float yOffset, float zOffset) {
|
||||
return AEApi.instance().partHelper().placeBus(player.getHeldItem(), x, y, z, side, player, world);
|
||||
return AEApi.instance().partHelper().placeBus(stack, x, y, z, side, player, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
package com.glodblock.github.common.item;
|
||||
|
||||
import static net.minecraft.client.gui.GuiScreen.isShiftKeyDown;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.parts.PartFluidTerminal;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.parts.IPartItem;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ItemPartFluidTerminal extends FCBaseItem implements IPartItem {
|
||||
|
||||
public ItemPartFluidTerminal() {
|
||||
this.setMaxStackSize(64);
|
||||
this.setUnlocalizedName(NameConst.ITEM_PART_FLUID_TERMINAL);
|
||||
AEApi.instance().partHelper().setItemBusRenderer(this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public PartFluidTerminal createPartFromItemStack(ItemStack is) {
|
||||
return new PartFluidTerminal(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||
float xOffset, float yOffset, float zOffset) {
|
||||
return AEApi.instance().partHelper().placeBus(player.getHeldItem(), x, y, z, side, player, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> toolTip, boolean flag) {
|
||||
toolTip.add("§4DEPRECATED!");
|
||||
if (isShiftKeyDown()) {
|
||||
toolTip.add(NameConst.i18n(NameConst.TT_FLUID_TERMINAL));
|
||||
} else {
|
||||
toolTip.add(NameConst.i18n(NameConst.TT_SHIFT_FOR_MORE));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemPartFluidTerminal register() {
|
||||
GameRegistry.registerItem(this, NameConst.ITEM_PART_FLUID_TERMINAL, FluidCraft.MODID);
|
||||
setCreativeTab(FluidCraftingTabs.INSTANCE);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons(IIconRegister _iconRegister) {}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getSpriteNumber() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,7 +39,7 @@ public class ItemPartLevelTerminal extends FCBaseItem implements IPartItem {
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side,
|
||||
float xOffset, float yOffset, float zOffset) {
|
||||
return AEApi.instance().partHelper().placeBus(player.getHeldItem(), x, y, z, side, player, world);
|
||||
return AEApi.instance().partHelper().placeBus(stack, x, y, z, side, player, world);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.glodblock.github.common.item;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.loader.IRegister;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.core.features.AEFeature;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class ItemWirelessFluidTerminal extends ItemBaseWirelessTerminal
|
||||
implements IRegister<ItemWirelessFluidTerminal> {
|
||||
|
||||
public ItemWirelessFluidTerminal() {
|
||||
super(null);
|
||||
AEApi.instance().registries().wireless().registerWirelessHandler(this);
|
||||
this.setFeature(EnumSet.of(AEFeature.WirelessAccessTerminal, AEFeature.PoweredTools));
|
||||
setUnlocalizedName(NameConst.ITEM_WIRELESS_FLUID_TERMINAL);
|
||||
setTextureName(FluidCraft.resource(NameConst.ITEM_WIRELESS_FLUID_TERMINAL).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemWirelessFluidTerminal register() {
|
||||
GameRegistry.registerItem(this, NameConst.ITEM_WIRELESS_FLUID_TERMINAL, FluidCraft.MODID);
|
||||
setCreativeTab(FluidCraftingTabs.INSTANCE);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getInventory(ItemStack stack, World world, int x, int y, int z, EntityPlayer player) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCheckedInformation(ItemStack stack, EntityPlayer player, List<String> lines,
|
||||
boolean displayMoreInfo) {
|
||||
lines.add("§4DEPRECATED!");
|
||||
super.addCheckedInformation(stack, player, lines, displayMoreInfo);
|
||||
}
|
||||
}
|
||||
@@ -167,15 +167,6 @@ public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
|
||||
this.openGui(is, w, player, mode, Integer.MIN_VALUE);
|
||||
}
|
||||
|
||||
public static boolean hasInfinityBoosterCard(EntityPlayer player) {
|
||||
ImmutablePair<Integer, ItemStack> term = Util.getUltraWirelessTerm(player);
|
||||
if (term == null) return false;
|
||||
if (term.getRight().getItem() instanceof ItemWirelessUltraTerminal) {
|
||||
return Util.hasInfinityBoosterCard(term.getRight());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWornTick(ItemStack itemStack, EntityLivingBase entityLivingBase) {
|
||||
if (Platform.isServer() && entityLivingBase instanceof EntityPlayer player) {
|
||||
@@ -203,7 +194,7 @@ public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
|
||||
public IGuiItemObject getGuiObject(ItemStack is, World world, EntityPlayer p, int x, int y, int z) {
|
||||
final IWirelessTermHandler wh = AEApi.instance().registries().wireless().getWirelessTerminalHandler(is);
|
||||
if (wh == null) return null;
|
||||
return switch (y != Integer.MIN_VALUE ? UltraTerminalModes.values()[y] : getMode(is)) {
|
||||
return switch (y != Integer.MIN_VALUE ? UltraTerminalModes.VALUES[y] : getMode(is)) {
|
||||
case CRAFTING -> new WirelessCraftingTerminalGuiObject(wh, is, p, world, x, y, z);
|
||||
case PATTERN, PATTERN_EX -> new WirelessPatternTerminalGuiObject(wh, is, p, world, x, y, z);
|
||||
case INTERFACE -> new WirelessInterfaceTerminalGuiObject(wh, is, x);
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.glodblock.github.common.parts;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
|
||||
import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.parts.automation.PartBaseAnnihilationPlane;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class PartFluidAnnihilationPlane extends PartBaseAnnihilationPlane {
|
||||
|
||||
public PartFluidAnnihilationPlane(ItemStack is) {
|
||||
super(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChanged() {
|
||||
final DimensionalCoord self = this.getLocation();
|
||||
final IMEMonitor<IAEFluidStack> monitor;
|
||||
final IEnergyGrid power;
|
||||
|
||||
try {
|
||||
monitor = this.getProxy().getStorage().getFluidInventory();
|
||||
power = this.getProxy().getEnergy();
|
||||
} catch (GridAccessException ignored) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (monitor == null || power == null) return;
|
||||
final World world = this.tile.getWorldObj();
|
||||
final ForgeDirection side = getSide();
|
||||
final Block fluidBlock = world.getBlock(self.x + side.offsetX, self.y + side.offsetY, self.z + side.offsetZ);
|
||||
final int meta = world.getBlockMetadata(self.x + side.offsetX, self.y + side.offsetY, self.z + side.offsetZ);
|
||||
final BaseActionSource src = new MachineSource(this);
|
||||
|
||||
if (fluidBlock instanceof IFluidBlock block) {
|
||||
final FluidStack drained = block
|
||||
.drain(world, self.x + side.offsetX, self.y + side.offsetY, self.z + side.offsetZ, false);
|
||||
if (drained == null) return;
|
||||
final IAEFluidStack toInject = Util.FluidUtil.createAEFluidStack(drained);
|
||||
final IAEFluidStack notInjected = Platform
|
||||
.poweredInsert(power, monitor, toInject, src, Actionable.SIMULATE);
|
||||
if (notInjected != null) return;
|
||||
Platform.poweredInsert(power, monitor, toInject, src, Actionable.MODULATE);
|
||||
block.drain(world, self.x + side.offsetX, self.y + side.offsetY, self.z + side.offsetZ, true);
|
||||
} else if (meta == 0) {
|
||||
if (fluidBlock == Blocks.flowing_water || fluidBlock == Blocks.water) {
|
||||
final IAEFluidStack toInject = Util.FluidUtil.createAEFluidStack(FluidRegistry.WATER);
|
||||
final IAEFluidStack notInjected = Platform
|
||||
.poweredInsert(power, monitor, toInject, src, Actionable.SIMULATE);
|
||||
if (notInjected != null) return;
|
||||
Platform.poweredInsert(power, monitor, toInject, src, Actionable.MODULATE);
|
||||
world.setBlockToAir(self.x + side.offsetX, self.y + side.offsetY, self.z + side.offsetZ);
|
||||
} else if (fluidBlock == Blocks.flowing_lava || fluidBlock == Blocks.lava) {
|
||||
final IAEFluidStack toInject = Util.FluidUtil.createAEFluidStack(FluidRegistry.LAVA);
|
||||
final IAEFluidStack notInjected = Platform
|
||||
.poweredInsert(power, monitor, toInject, src, Actionable.SIMULATE);
|
||||
if (notInjected != null) return;
|
||||
Platform.poweredInsert(power, monitor, toInject, src, Actionable.MODULATE);
|
||||
world.setBlockToAir(self.x + side.offsetX, self.y + side.offsetY, self.z + side.offsetZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getActiveIcon() {
|
||||
return FCPartsTexture.PartFluidAnnihilationPlaneOn.getIcon();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package com.glodblock.github.common.parts;
|
||||
|
||||
import static appeng.util.item.AEFluidStackType.FLUID_STACK_TYPE;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
|
||||
import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.parts.automation.PartBaseFormationPlane;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class PartFluidFormationPlane extends PartBaseFormationPlane implements IGridTickable {
|
||||
|
||||
public PartFluidFormationPlane(ItemStack is) {
|
||||
super(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(IGridNode iGridNode) {
|
||||
return new TickingRequest(2, 120, false, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(IGridNode iGridNode, int ing) {
|
||||
return this.doWork() ? TickRateModulation.SLEEP : TickRateModulation.SAME;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChanged() {
|
||||
final TileEntity te = this.getHost().getTile();
|
||||
final World w = te.getWorldObj();
|
||||
if (w == null) return;
|
||||
final ForgeDirection side = this.getSide();
|
||||
|
||||
final int x = te.xCoord + side.offsetX;
|
||||
final int y = te.yCoord + side.offsetY;
|
||||
final int z = te.zCoord + side.offsetZ;
|
||||
|
||||
final Block worldBlock = w.getBlock(x, y, z);
|
||||
this.blocked = worldBlock != null && worldBlock != Blocks.air;
|
||||
|
||||
if (!this.blocked) {
|
||||
try {
|
||||
this.getProxy().getTick().alertDevice(this.getProxy().getNode());
|
||||
} catch (GridAccessException ignored) {}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateHandler() {
|
||||
if (this.getProxy().isReady()) {
|
||||
this.onNeighborChanged();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean doWork() {
|
||||
if (this.blocked) return true;
|
||||
|
||||
final DimensionalCoord self = this.getLocation();
|
||||
final int x = self.x + side.offsetX;
|
||||
final int y = self.y + side.offsetY;
|
||||
final int z = self.z + side.offsetZ;
|
||||
|
||||
final World world = this.tile.getWorldObj();
|
||||
final Block worldBlock = world.getBlock(x, y, z);
|
||||
if (worldBlock != null && worldBlock != Blocks.air) return this.blocked = true;
|
||||
|
||||
final IMEMonitor<IAEFluidStack> monitor;
|
||||
final IEnergyGrid power;
|
||||
|
||||
try {
|
||||
monitor = this.getProxy().getStorage().getFluidInventory();
|
||||
power = this.getProxy().getEnergy();
|
||||
} catch (GridAccessException ignored) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (monitor == null || power == null) return true;
|
||||
|
||||
final BaseActionSource src = new MachineSource(this);
|
||||
|
||||
boolean stockOut = false;
|
||||
|
||||
for (int i = 0; i < this.Config.getSizeInventory(); i++) {
|
||||
if (!(this.Config.getAEStackInSlot(i) instanceof IAEFluidStack ifs)) continue;
|
||||
final IAEFluidStack fluid = ifs.copy().setStackSize(FluidContainerRegistry.BUCKET_VOLUME);
|
||||
final IAEFluidStack canDrain = Platform.poweredExtraction(power, monitor, fluid, src, Actionable.SIMULATE);
|
||||
if (canDrain == null || canDrain.getStackSize() < FluidContainerRegistry.BUCKET_VOLUME) {
|
||||
stockOut = true;
|
||||
continue;
|
||||
}
|
||||
Platform.poweredExtraction(power, monitor, fluid, src, Actionable.MODULATE);
|
||||
final Block fluidWorldBlock = fluid.getFluid().getBlock();
|
||||
world.setBlock(x, y, z, fluidWorldBlock);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
return true;
|
||||
}
|
||||
|
||||
return !stockOut;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEStackType<?> getStackType() {
|
||||
return FLUID_STACK_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportItemDrop() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportFuzzy() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getActiveIcon() {
|
||||
return FCPartsTexture.PartFluidFormationPlaneOn.getIcon();
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,13 @@
|
||||
package com.glodblock.github.common.parts;
|
||||
|
||||
import static appeng.util.item.AEFluidStackType.FLUID_STACK_TYPE;
|
||||
import static appeng.util.item.AEItemStackType.ITEM_STACK_TYPE;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -11,27 +16,37 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.glodblock.github.client.FluidInterfaceButtons;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.inventory.AEFluidInventory;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import com.glodblock.github.inventory.IDualHost;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.DualHostSettings;
|
||||
import com.glodblock.github.util.DualityFluidInterface;
|
||||
import com.glodblock.github.util.Util;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.helpers.ICustomButtonDataObject;
|
||||
import appeng.helpers.ICustomButtonProvider;
|
||||
import appeng.parts.misc.PartInterface;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.util.SettingsFrom;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -50,6 +65,12 @@ public class PartFluidInterface extends PartInterface implements IDualHost, ICus
|
||||
this.customButtonDataObject = new FluidInterfaceButtons(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(final List<ItemStack> drops, final boolean wrenched) {
|
||||
this.fluidDuality.addDrops(drops);
|
||||
super.getDrops(drops, wrenched);
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void stateChange(final MENetworkChannelsChanged c) {
|
||||
fluidDuality.onChannelStateChange(c);
|
||||
@@ -78,6 +99,23 @@ public class PartFluidInterface extends PartInterface implements IDualHost, ICus
|
||||
return fluidDuality.getTanks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory() {
|
||||
return this.fluidDuality.getFluidInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IMEMonitor<?> getMEMonitor(@NotNull IAEStackType<?> type) {
|
||||
if (type == ITEM_STACK_TYPE) {
|
||||
return this.getItemInventory();
|
||||
} else if (type == FLUID_STACK_TYPE) {
|
||||
return this.getFluidInventory();
|
||||
}
|
||||
|
||||
return this.fluidDuality.getMEMonitor(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppEngInternalAEInventory getConfig() {
|
||||
Util.mirrorFluidToPacket(this.config, fluidDuality.getConfig());
|
||||
@@ -115,6 +153,7 @@ public class PartFluidInterface extends PartInterface implements IDualHost, ICus
|
||||
config.readFromNBT(data, "ConfigInv");
|
||||
fluidDuality.loadConfigFromPacket(this.config);
|
||||
getInternalFluid().readFromNBT(data, "FluidInv");
|
||||
fluidDuality.readCraftingTrackerFromNBT(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,6 +161,21 @@ public class PartFluidInterface extends PartInterface implements IDualHost, ICus
|
||||
super.writeToNBT(data);
|
||||
config.writeToNBT(data, "ConfigInv");
|
||||
getInternalFluid().writeToNBT(data, "FluidInv");
|
||||
fluidDuality.writeCraftingTrackerToNBT(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadSettings(@NotNull SettingsFrom from, @NotNull NBTTagCompound compound) {
|
||||
super.uploadSettings(from, compound);
|
||||
DualHostSettings.uploadSettings(this, compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public NBTTagCompound downloadSettings(SettingsFrom from) {
|
||||
NBTTagCompound output = super.downloadSettings(from);
|
||||
DualHostSettings.downloadSettings(this, output);
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -129,6 +183,26 @@ public class PartFluidInterface extends PartInterface implements IDualHost, ICus
|
||||
return getInterfaceDuality().getInstalledUpgrades(u);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableSet<ICraftingLink> getRequestedJobs() {
|
||||
return ImmutableSet.<ICraftingLink>builder().addAll(super.getRequestedJobs())
|
||||
.addAll(fluidDuality.getRequestedJobs()).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEStack<?> injectCraftedItems(final ICraftingLink link, final IAEStack<?> items, final Actionable mode) {
|
||||
if (items instanceof IAEFluidStack) {
|
||||
return fluidDuality.injectCraftedItems(link, items, mode);
|
||||
}
|
||||
return super.injectCraftedItems(link, items, mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jobStateChange(final ICraftingLink link) {
|
||||
super.jobStateChange(link);
|
||||
fluidDuality.jobStateChange(link);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
return fluidDuality.fill(from, resource, doFill);
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.glodblock.github.common.parts;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
|
||||
import appeng.api.storage.StorageName;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.helpers.Reflected;
|
||||
import appeng.parts.automation.PartLevelEmitter;
|
||||
|
||||
public class PartFluidLevelEmitter extends PartLevelEmitter {
|
||||
|
||||
@Reflected
|
||||
public PartFluidLevelEmitter(final ItemStack is) {
|
||||
super(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound data) {
|
||||
super.readFromNBT(data);
|
||||
|
||||
final IAEStack<?> aes = this.getAEInventoryByName(StorageName.CONFIG).getAEStackInSlot(0);
|
||||
if (aes instanceof IAEItemStack ais && ais.getItem() instanceof ItemFluidPacket) {
|
||||
this.getAEInventoryByName(StorageName.CONFIG).putAEStackInSlot(0, ItemFluidPacket.getFluidAEStack(ais));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
package com.glodblock.github.common.parts;
|
||||
|
||||
import static appeng.util.item.AEFluidStackType.FLUID_STACK_TYPE;
|
||||
import static appeng.util.item.AEItemStackType.ITEM_STACK_TYPE;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -12,20 +17,29 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.glodblock.github.client.FluidInterfaceButtons;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.inventory.AEFluidInventory;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import com.glodblock.github.inventory.IDualHost;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.DualHostSettings;
|
||||
import com.glodblock.github.util.DualityFluidInterface;
|
||||
import com.glodblock.github.util.Util;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.implementations.items.IMemoryCard;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.helpers.DualityInterface;
|
||||
import appeng.helpers.ICustomButtonDataObject;
|
||||
@@ -34,6 +48,7 @@ import appeng.parts.p2p.PartP2PInterface;
|
||||
import appeng.parts.p2p.PartP2PTunnel;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.SettingsFrom;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -50,12 +65,25 @@ public class PartFluidP2PInterface extends PartP2PInterface implements IDualHost
|
||||
this.customButtonDataObject = new FluidInterfaceButtons(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(final List<ItemStack> drops, final boolean wrenched) {
|
||||
this.dualityFluid.addDrops(drops);
|
||||
super.getDrops(drops, wrenched);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getTypeTexture() {
|
||||
return ItemAndBlockHolder.INTERFACE.getBlockTextureFromSide(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getMemoryCardData() {
|
||||
NBTTagCompound output = super.getMemoryCardData();
|
||||
DualHostSettings.downloadSettings(this, output);
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PartP2PTunnel<?> applyMemoryCard(EntityPlayer player, IMemoryCard memoryCard, ItemStack is) {
|
||||
PartP2PTunnel<?> newTunnel = super.applyMemoryCard(player, memoryCard, is);
|
||||
@@ -63,6 +91,7 @@ public class PartFluidP2PInterface extends PartP2PInterface implements IDualHost
|
||||
NBTTagCompound data = memoryCard.getData(is);
|
||||
if (newTunnel instanceof PartFluidP2PInterface p2PInterface) {
|
||||
p2PInterface.duality.getConfigManager().readFromNBT(data);
|
||||
DualHostSettings.uploadSettings(p2PInterface, data);
|
||||
}
|
||||
return newTunnel;
|
||||
}
|
||||
@@ -75,9 +104,41 @@ public class PartFluidP2PInterface extends PartP2PInterface implements IDualHost
|
||||
IConfigManager config = fromInterface.duality.getConfigManager();
|
||||
config.getSettings()
|
||||
.forEach(setting -> newDuality.getConfigManager().putSetting(setting, config.getSetting(setting)));
|
||||
DualHostSettings.copySettings(this, fromInterface);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadSettings(@NotNull SettingsFrom from, @NotNull NBTTagCompound compound) {
|
||||
super.uploadSettings(from, compound);
|
||||
DualHostSettings.uploadSettings(this, compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public NBTTagCompound downloadSettings(SettingsFrom from) {
|
||||
NBTTagCompound output = super.downloadSettings(from);
|
||||
DualHostSettings.downloadSettings(this, output);
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound data) {
|
||||
super.readFromNBT(data);
|
||||
config.readFromNBT(data, "ConfigInv");
|
||||
dualityFluid.loadConfigFromPacket(this.config);
|
||||
dualityFluid.getInternalFluid().readFromNBT(data, "FluidInv");
|
||||
dualityFluid.readCraftingTrackerFromNBT(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(final NBTTagCompound data) {
|
||||
super.writeToNBT(data);
|
||||
config.writeToNBT(data, "ConfigInv");
|
||||
dualityFluid.getInternalFluid().writeToNBT(data, "FluidInv");
|
||||
dualityFluid.writeCraftingTrackerToNBT(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(IGridNode node) {
|
||||
TickingRequest item = duality.getTickingRequest(node);
|
||||
@@ -100,6 +161,26 @@ public class PartFluidP2PInterface extends PartP2PInterface implements IDualHost
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableSet<ICraftingLink> getRequestedJobs() {
|
||||
return ImmutableSet.<ICraftingLink>builder().addAll(super.getRequestedJobs())
|
||||
.addAll(dualityFluid.getRequestedJobs()).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEStack<?> injectCraftedItems(final ICraftingLink link, final IAEStack<?> items, final Actionable mode) {
|
||||
if (items instanceof IAEFluidStack) {
|
||||
return dualityFluid.injectCraftedItems(link, items, mode);
|
||||
}
|
||||
return super.injectCraftedItems(link, items, mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jobStateChange(final ICraftingLink link) {
|
||||
super.jobStateChange(link);
|
||||
dualityFluid.jobStateChange(link);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
return dualityFluid.fill(from, resource, doFill);
|
||||
@@ -147,6 +228,23 @@ public class PartFluidP2PInterface extends PartP2PInterface implements IDualHost
|
||||
return dualityFluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory() {
|
||||
return this.dualityFluid.getFluidInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IMEMonitor<?> getMEMonitor(@NotNull IAEStackType<?> type) {
|
||||
if (type == ITEM_STACK_TYPE) {
|
||||
return this.getItemInventory();
|
||||
} else if (type == FLUID_STACK_TYPE) {
|
||||
return this.getFluidInventory();
|
||||
}
|
||||
|
||||
return this.dualityFluid.getMEMonitor(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppEngInternalAEInventory getConfig() {
|
||||
Util.mirrorFluidToPacket(config, dualityFluid.getConfig());
|
||||
|
||||
@@ -3,7 +3,14 @@ package com.glodblock.github.common.parts;
|
||||
import static appeng.util.item.AEFluidStackType.FLUID_STACK_TYPE;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.storage.StorageName;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.parts.misc.PartStorageBus;
|
||||
|
||||
@@ -17,4 +24,20 @@ public class PartFluidStorageBus extends PartStorageBus {
|
||||
public IAEStackType<?> getStackType() {
|
||||
return FLUID_STACK_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound data) {
|
||||
super.readFromNBT(data);
|
||||
|
||||
// Migrate from old data
|
||||
var config = this.getAEInventoryByName(StorageName.CONFIG);
|
||||
for (int i = 0; i < config.getSizeInventory(); i++) {
|
||||
IAEStack<?> stack = config.getAEStackInSlot(i);
|
||||
|
||||
if (stack instanceof IAEItemStack ais) {
|
||||
IAEFluidStack afs = Util.getAEFluidFromItem(ais.getItemStack());
|
||||
config.putAEStackInSlot(i, afs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
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 appeng.core.sync.GuiBridge;
|
||||
|
||||
public class PartFluidTerminal extends FCPart {
|
||||
|
||||
private static final FCPartsTexture FRONT_BRIGHT_ICON = FCPartsTexture.PartFluidTerminal_Bright;
|
||||
private static final FCPartsTexture FRONT_DARK_ICON = FCPartsTexture.PartFluidTerminal_Colored;
|
||||
private static final FCPartsTexture FRONT_COLORED_ICON = FCPartsTexture.PartFluidTerminal_Dark;
|
||||
|
||||
public PartFluidTerminal(ItemStack is) {
|
||||
super(is, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FCPartsTexture getFrontBright() {
|
||||
return FRONT_BRIGHT_ICON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FCPartsTexture getFrontColored() {
|
||||
return FRONT_COLORED_ICON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FCPartsTexture getFrontDark() {
|
||||
return FRONT_DARK_ICON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLightSource() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBooting() {
|
||||
return super.isBooting();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiBridge getGui() {
|
||||
return GuiBridge.GUI_ME;
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,8 @@ public enum CellType {
|
||||
Cell4096kPart(6, AEFeature.StorageCells),
|
||||
Cell16384kPart(7, AEFeature.StorageCells);
|
||||
|
||||
public static final CellType[] VALUES = values();
|
||||
|
||||
private final EnumSet<AEFeature> features;
|
||||
private int damageValue;
|
||||
private Item itemInstance;
|
||||
@@ -53,7 +55,7 @@ public enum CellType {
|
||||
}
|
||||
|
||||
public static EnumChatFormatting getTypeColor(int type) {
|
||||
return getTypeColor(CellType.values()[type % CellType.values().length]);
|
||||
return getTypeColor(CellType.VALUES[type % CellType.VALUES.length]);
|
||||
}
|
||||
|
||||
public static EnumChatFormatting getTypeColor(CellType type) {
|
||||
|
||||
@@ -70,7 +70,8 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
return mainTank.drain(fluid, amount, doDrain, false);
|
||||
}
|
||||
|
||||
if (this.getFluid() == null) {
|
||||
Fluid currentFluid = this.getFluid();
|
||||
if (currentFluid == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -84,10 +85,10 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
if (drained < amount) {
|
||||
TileCertusQuartzTank tankBelow = this.getTankBelow();
|
||||
if (tankBelow != null) {
|
||||
FluidStack externallyDrained = tankBelow.drain(this.getFluid(), amount - drained, doDrain, false);
|
||||
FluidStack externallyDrained = tankBelow.drain(currentFluid, amount - drained, doDrain, false);
|
||||
|
||||
if (externallyDrained != null) {
|
||||
return new FluidStack(this.getFluid(), drained + externallyDrained.amount);
|
||||
return new FluidStack(currentFluid, drained + externallyDrained.amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,15 +77,27 @@ public class TileFluidAutoFiller extends AENetworkInvTile
|
||||
public TileFluidAutoFiller() {
|
||||
getProxy().setIdlePowerUsage(1D);
|
||||
getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
|
||||
inventory.setInventorySlotContents(0, BUCKET);
|
||||
inventory.setInventorySlotContents(0, BUCKET.copy());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ItemStack getContainerItem() {
|
||||
normalizeContainerItem();
|
||||
return getInventory().getStackInSlot(0);
|
||||
}
|
||||
|
||||
public void setContainerItem(ItemStack is) {
|
||||
getInventory().setInventorySlotContents(0, is);
|
||||
normalizeContainerItem();
|
||||
}
|
||||
|
||||
private void normalizeContainerItem() {
|
||||
ItemStack is = getInventory().getStackInSlot(0);
|
||||
if (is == null) {
|
||||
is = BUCKET.copy();
|
||||
getInventory().setInventorySlotContents(0, is);
|
||||
}
|
||||
is.stackSize = 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -102,18 +114,15 @@ public class TileFluidAutoFiller extends AENetworkInvTile
|
||||
}
|
||||
|
||||
public void updatePattern() {
|
||||
ItemStack is = inventory.getStackInSlot(0);
|
||||
if (is == null) return;
|
||||
this.setContainerItem(is);
|
||||
normalizeContainerItem();
|
||||
postEvent();
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBTEvent(NBTTagCompound data) {
|
||||
inventory.readFromNBT(data, "Inv");
|
||||
if (inventory.getStackInSlot(0) == null) {
|
||||
inventory.setInventorySlotContents(0, BUCKET);
|
||||
}
|
||||
ItemStack container = inventory.getStackInSlot(0);
|
||||
this.setContainerItem(container);
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
@@ -150,21 +159,21 @@ public class TileFluidAutoFiller extends AENetworkInvTile
|
||||
public void provideCrafting(ICraftingProviderHelper craftingTracker) {
|
||||
IStorageGrid storage = getStorageGrid();
|
||||
if (storage == null) return;
|
||||
ItemStack containerItem = this.getContainerItem();
|
||||
|
||||
if (this.fluids.isEmpty()) {
|
||||
this.fluids = storage.getFluidInventory().getStorageList();
|
||||
}
|
||||
for (IAEFluidStack fluidStack : this.fluids) {
|
||||
Fluid fluid = fluidStack.getFluid();
|
||||
if (fluid == null) continue;
|
||||
int maxCapacity = Util.FluidUtil.getCapacity(this.getContainerItem(), fluid);
|
||||
int maxCapacity = Util.FluidUtil.getCapacity(containerItem, fluid);
|
||||
if (maxCapacity == 0) continue;
|
||||
MutablePair<Integer, ItemStack> filled = Util.FluidUtil
|
||||
.fillStack(this.getContainerItem().copy(), new FluidStack(fluid, maxCapacity));
|
||||
.fillStack(containerItem.copy(), new FluidStack(fluid, maxCapacity));
|
||||
if (filled == null) continue;
|
||||
if (filled.right == null) continue;
|
||||
ItemStack pattern = getPattern(
|
||||
this.getContainerItem(),
|
||||
filled.right,
|
||||
fluidStack.copy().setStackSize(maxCapacity));
|
||||
ItemStack pattern = getPattern(containerItem, filled.right, fluidStack.copy().setStackSize(maxCapacity));
|
||||
ICraftingPatternItem patter = (ICraftingPatternItem) pattern.getItem();
|
||||
craftingTracker.addCraftingOption(this, patter.getPatternForItem(pattern, getWorldObj()));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.glodblock.github.common.tile;
|
||||
|
||||
import static appeng.util.item.AEFluidStackType.FLUID_STACK_TYPE;
|
||||
import static appeng.util.item.AEItemStackType.ITEM_STACK_TYPE;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@@ -14,25 +17,34 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.glodblock.github.client.FluidInterfaceButtons;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.inventory.AEFluidInventory;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import com.glodblock.github.inventory.IDualHost;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.DualHostSettings;
|
||||
import com.glodblock.github.util.DualityFluidInterface;
|
||||
import com.glodblock.github.util.Util;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SidelessMode;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.helpers.ICustomButtonDataObject;
|
||||
import appeng.helpers.ICustomButtonProvider;
|
||||
@@ -40,6 +52,7 @@ import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
import appeng.util.SettingsFrom;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -98,12 +111,29 @@ public class TileFluidInterface extends TileInterface implements IDualHost, ICus
|
||||
return fluidDuality.getTanks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory() {
|
||||
return this.fluidDuality.getFluidInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppEngInternalAEInventory getConfig() {
|
||||
Util.mirrorFluidToPacket(this.config, fluidDuality.getConfig());
|
||||
return config;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IMEMonitor<?> getMEMonitor(@NotNull IAEStackType<?> type) {
|
||||
if (type == ITEM_STACK_TYPE) {
|
||||
return this.getItemInventory();
|
||||
} else if (type == FLUID_STACK_TYPE) {
|
||||
return this.getFluidInventory();
|
||||
}
|
||||
|
||||
return this.fluidDuality.getMEMonitor(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(IGridNode node) {
|
||||
TickingRequest item = super.getTickingRequest(node);
|
||||
@@ -154,15 +184,31 @@ public class TileFluidInterface extends TileInterface implements IDualHost, ICus
|
||||
config.readFromNBT(data, "ConfigInv");
|
||||
fluidDuality.loadConfigFromPacket(this.config);
|
||||
getInternalFluid().readFromNBT(data, "FluidInv");
|
||||
fluidDuality.readCraftingTrackerFromNBT(data);
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public NBTTagCompound writeToNBTEvent(NBTTagCompound data) {
|
||||
config.writeToNBT(data, "ConfigInv");
|
||||
getInternalFluid().writeToNBT(data, "FluidInv");
|
||||
fluidDuality.writeCraftingTrackerToNBT(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadSettings(SettingsFrom from, NBTTagCompound compound) {
|
||||
super.uploadSettings(from, compound);
|
||||
DualHostSettings.uploadSettings(this, compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound downloadSettings(SettingsFrom from) {
|
||||
NBTTagCompound output = super.downloadSettings(from);
|
||||
output = output == null ? new NBTTagCompound() : output;
|
||||
DualHostSettings.downloadSettings(this, output);
|
||||
return output;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected ItemStack getItemFromTile(final Object obj) {
|
||||
if (obj instanceof TileFluidInterface) {
|
||||
@@ -176,6 +222,26 @@ public class TileFluidInterface extends TileInterface implements IDualHost, ICus
|
||||
return getInterfaceDuality().getInstalledUpgrades(u);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableSet<ICraftingLink> getRequestedJobs() {
|
||||
return ImmutableSet.<ICraftingLink>builder().addAll(super.getRequestedJobs())
|
||||
.addAll(fluidDuality.getRequestedJobs()).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEStack<?> injectCraftedItems(final ICraftingLink link, final IAEStack<?> items, final Actionable mode) {
|
||||
if (items instanceof IAEFluidStack) {
|
||||
return fluidDuality.injectCraftedItems(link, items, mode);
|
||||
}
|
||||
return super.injectCraftedItems(link, items, mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jobStateChange(final ICraftingLink link) {
|
||||
super.jobStateChange(link);
|
||||
fluidDuality.jobStateChange(link);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
return fluidDuality.fill(from, resource, doFill);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.glodblock.github.common.tile;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -10,6 +11,7 @@ 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 appeng.api.networking.GridFlags;
|
||||
@@ -60,13 +62,22 @@ public class TileFluidPacketDecoder extends AENetworkTile
|
||||
return new TickingRequest(5, 120, false, true);
|
||||
}
|
||||
|
||||
private FluidStack getFluidStack() {
|
||||
final ItemStack stack = inventory.getStackInSlot(0);
|
||||
if (stack == null) return null;
|
||||
|
||||
if (stack.getItem() instanceof ItemFluidPacket) {
|
||||
return ItemFluidPacket.getFluidStack(stack);
|
||||
} else if (stack.getItem() instanceof ItemFluidDrop) {
|
||||
return ItemFluidDrop.getFluidStack(stack);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(IGridNode node, int ticksSinceLastCall) {
|
||||
ItemStack stack = inventory.getStackInSlot(0);
|
||||
if (stack == null || !(stack.getItem() instanceof ItemFluidPacket)) {
|
||||
return TickRateModulation.SLEEP;
|
||||
}
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(stack);
|
||||
final FluidStack fluid = getFluidStack();
|
||||
if (fluid == null || fluid.amount <= 0) {
|
||||
inventory.setInventorySlotContents(0, null);
|
||||
return TickRateModulation.SLEEP;
|
||||
@@ -162,12 +173,13 @@ public class TileFluidPacketDecoder extends AENetworkTile
|
||||
|
||||
@Override
|
||||
public void closeInventory() {
|
||||
inventory.openInventory();
|
||||
inventory.closeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return stack.getItem() instanceof ItemFluidPacket;
|
||||
final Item item = stack.getItem();
|
||||
return item instanceof ItemFluidPacket || item instanceof ItemFluidDrop;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -182,34 +194,27 @@ public class TileFluidPacketDecoder extends AENetworkTile
|
||||
|
||||
private FluidStack drain(FluidStack requestFluid, boolean doDrain) {
|
||||
if (requestFluid == null || requestFluid.amount <= 0) return null;
|
||||
ItemStack fluidPacket = this.inventory.getStackInSlot(0);
|
||||
if (fluidPacket != null) {
|
||||
FluidStack fs = ItemFluidPacket.getFluidStack(fluidPacket);
|
||||
if (fs == null) return null;
|
||||
if (fs.isFluidEqual(requestFluid)) {
|
||||
if (fs.amount > requestFluid.amount) {
|
||||
fs.amount -= requestFluid.amount;
|
||||
if (doDrain) this.inventory.setInventorySlotContents(0, ItemFluidPacket.newStack(fs));
|
||||
return requestFluid;
|
||||
} else {
|
||||
if (doDrain) this.inventory.setInventorySlotContents(0, null);
|
||||
return fs;
|
||||
}
|
||||
final FluidStack fs = this.getFluidStack();
|
||||
if (fs != null && fs.isFluidEqual(requestFluid)) {
|
||||
if (fs.amount > requestFluid.amount) {
|
||||
fs.amount -= requestFluid.amount;
|
||||
if (doDrain) this.inventory.setInventorySlotContents(0, ItemFluidPacket.newStack(fs));
|
||||
return requestFluid;
|
||||
} else {
|
||||
if (doDrain) this.inventory.setInventorySlotContents(0, null);
|
||||
return fs;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
ItemStack fluidPacket = this.inventory.getStackInSlot(0);
|
||||
if (fluidPacket != null) {
|
||||
FluidStack requestFluid = ItemFluidPacket.getFluidStack(fluidPacket);
|
||||
if (requestFluid == null) return null;
|
||||
requestFluid.amount = maxDrain;
|
||||
return this.drain(requestFluid, doDrain);
|
||||
}
|
||||
return null;
|
||||
final FluidStack requestFluid = this.getFluidStack();
|
||||
if (requestFluid == null) return null;
|
||||
requestFluid.amount = maxDrain;
|
||||
return this.drain(requestFluid, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -224,13 +229,8 @@ public class TileFluidPacketDecoder extends AENetworkTile
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
ItemStack fluidPacket = this.inventory.getStackInSlot(0);
|
||||
if (fluidPacket == null) {
|
||||
return new FluidTankInfo[0];
|
||||
} else {
|
||||
FluidStack fs = ItemFluidPacket.getFluidStack(fluidPacket);
|
||||
if (fs == null) return new FluidTankInfo[0];
|
||||
return new FluidTankInfo[] { new FluidTankInfo(fs, fs.amount) };
|
||||
}
|
||||
final FluidStack fs = this.getFluidStack();
|
||||
if (fs == null) return new FluidTankInfo[0];
|
||||
return new FluidTankInfo[] { new FluidTankInfo(fs, fs.amount) };
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,8 @@ import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.CraftingAllow;
|
||||
import appeng.api.config.CraftingMode;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.features.ILevelViewable;
|
||||
import appeng.api.features.LevelItemInfo;
|
||||
@@ -50,6 +52,8 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.core.AELog;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.cache.CraftingGridCache;
|
||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.grid.AENetworkTile;
|
||||
@@ -72,12 +76,15 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
public static final String NBT_ENABLE = "enable";
|
||||
public static final String NBT_STATE = "state";
|
||||
public static final String NBT_LINK = "link";
|
||||
public static final String NBT_LITE_MODE = "lite_mode";
|
||||
|
||||
public final RequestInfo[] requests = new RequestInfo[REQ_COUNT];
|
||||
private final LevelMaintainerInventory inventory = new LevelMaintainerInventory(requests);
|
||||
private int firstRequest = 0;
|
||||
private final BaseActionSource source;
|
||||
private boolean isPowered = false;
|
||||
private boolean isLiteModeOverridden = false;
|
||||
private boolean isLiteMode = false;
|
||||
|
||||
public TileLevelMaintainer() {
|
||||
getProxy().setIdlePowerUsage(1D);
|
||||
@@ -164,6 +171,7 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
}
|
||||
try {
|
||||
final ICraftingGrid craftingGrid = getProxy().getCrafting();
|
||||
final CraftingGridCache craftingGridCache = (CraftingGridCache) craftingGrid;
|
||||
final IGrid grid = getProxy().getGrid();
|
||||
|
||||
// Check there are available crafting CPUs before doing any work.
|
||||
@@ -171,7 +179,7 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
// crafting tasks that cannot be successfully submitted.
|
||||
boolean allBusy = true;
|
||||
for (final ICraftingCPU cpu : craftingGrid.getCpus()) {
|
||||
if (!cpu.isBusy()) {
|
||||
if (canAcceptMachineJob(cpu)) {
|
||||
allBusy = false;
|
||||
break;
|
||||
}
|
||||
@@ -184,7 +192,7 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
IAEStack<?> itemToBegin = null;
|
||||
int itemToBeginIdx = -1;
|
||||
|
||||
for (int j = 0; j < REQ_COUNT; ++j) {
|
||||
req: for (int j = 0; j < REQ_COUNT; ++j) {
|
||||
int i = (firstRequest + j) % REQ_COUNT;
|
||||
if (requests[i] == null) continue;
|
||||
|
||||
@@ -197,41 +205,54 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!this.isDone(i)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IAEStack<?> craftItem = requests[i].stack.copy();
|
||||
craftItem.setStackSize(batchSize);
|
||||
|
||||
final boolean isCraftable = isCraftable(craftingGrid, craftItem);
|
||||
|
||||
if (this.requests[i].state != LevelState.Idle) {
|
||||
this.updateState(i, LevelState.Idle);
|
||||
}
|
||||
if (this.requests[i].link != null) {
|
||||
this.updateLink(i, null);
|
||||
}
|
||||
if (!isCraftable) {
|
||||
updateState(i, LevelState.NotFound);
|
||||
}
|
||||
|
||||
// A free CPU is required before it is worth looking at the stock:
|
||||
if (allBusy || !isCraftable) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Single hash lookup on the emitable mediums, so it is cheaper
|
||||
// than reading the stock and can run first.
|
||||
if (craftingGrid.canEmitFor(craftItem)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IMEMonitor monitor = getProxy().getStorage().getMEMonitor(craftItem.getStackType());
|
||||
if (monitor == null) continue;
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
IAEStack<?> stackInStorage = monitor.getStorageList().findPrecise(craftItem);
|
||||
|
||||
long stackSize = stackInStorage == null ? 0 : stackInStorage.getStackSize();
|
||||
|
||||
boolean isDone = this.isDone(i);
|
||||
boolean isCraftable = stackInStorage != null && stackInStorage.isCraftable();
|
||||
boolean shouldCraft = isCraftable && stackSize < quantity;
|
||||
|
||||
if (isDone) {
|
||||
if (this.requests[i].state != LevelState.Idle) {
|
||||
this.updateState(i, LevelState.Idle);
|
||||
}
|
||||
if (this.requests[i].link != null) {
|
||||
this.updateLink(i, null);
|
||||
}
|
||||
if (!isCraftable) {
|
||||
updateState(i, LevelState.NotFound);
|
||||
}
|
||||
}
|
||||
|
||||
if (allBusy || !isDone || !shouldCraft) {
|
||||
if (stackSize >= quantity) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (craftingGrid.canEmitFor(stackInStorage)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (craftingGrid.isRequesting(stackInStorage)) {
|
||||
continue;
|
||||
// Walking every CPU to see whether the item is already being
|
||||
// made is comparatively expensive
|
||||
for (ICraftingCPU cpu : craftingGrid.getCpus()) {
|
||||
IAEStack<?> output = cpu.getFinalMultiOutput();
|
||||
if (output != null && output.isSameType(craftItem)) {
|
||||
continue req;
|
||||
}
|
||||
}
|
||||
|
||||
// do crafting
|
||||
@@ -273,9 +294,14 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
}
|
||||
} else if (itemToBegin != null) {
|
||||
// No jobs to submit, start calculating some item.
|
||||
|
||||
requests[itemToBeginIdx].job = craftingGrid
|
||||
.beginCraftingJob(this.worldObj, grid, source, itemToBegin, null);
|
||||
requests[itemToBeginIdx].job = craftingGridCache.beginCraftingJob(
|
||||
this.worldObj,
|
||||
grid,
|
||||
source,
|
||||
itemToBegin,
|
||||
CraftingMode.STANDARD,
|
||||
isLiteMode(),
|
||||
null);
|
||||
this.updateState(itemToBeginIdx, LevelState.Craft);
|
||||
|
||||
// Try the next item next time.
|
||||
@@ -292,6 +318,21 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
return TickRateModulation.SAME;
|
||||
}
|
||||
|
||||
private static boolean isCraftable(final ICraftingGrid craftingGrid, final IAEStack<?> stack) {
|
||||
if (stack == null) return false;
|
||||
return craftingGrid.canEmitFor(stack) || craftingGrid.getCraftingMultiPatterns().containsKey(stack);
|
||||
}
|
||||
|
||||
private static boolean canAcceptMachineJob(final ICraftingCPU cpu) {
|
||||
if (cpu.isBusy()) {
|
||||
return false;
|
||||
}
|
||||
if (!(cpu instanceof CraftingCPUCluster cluster)) {
|
||||
return true;
|
||||
}
|
||||
return cluster.isActive() && cluster.getCraftingAllowMode() != CraftingAllow.ONLY_PLAYER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveChanges() {
|
||||
super.saveChanges();
|
||||
@@ -369,6 +410,35 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
this.saveChanges();
|
||||
}
|
||||
|
||||
private boolean getLiteModeDefault() {
|
||||
try {
|
||||
final ICraftingGrid craftingGrid = getProxy().getCrafting();
|
||||
if (craftingGrid instanceof CraftingGridCache cache) {
|
||||
return cache.getLiteCraftingDefault();
|
||||
}
|
||||
} catch (GridAccessException ignored) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isLiteMode() {
|
||||
return this.isLiteModeOverridden ? this.isLiteMode : getLiteModeDefault();
|
||||
}
|
||||
|
||||
public void setLiteMode(boolean liteMode) {
|
||||
this.isLiteModeOverridden = true;
|
||||
this.isLiteMode = liteMode;
|
||||
this.saveChanges();
|
||||
}
|
||||
|
||||
public void toggleLiteMode() {
|
||||
this.setLiteMode(!this.isLiteMode());
|
||||
}
|
||||
|
||||
public void clearLiteMode() {
|
||||
this.isLiteModeOverridden = false;
|
||||
this.saveChanges();
|
||||
}
|
||||
|
||||
private void updateLink(int idx, @Nullable ICraftingLink link) {
|
||||
if (requests[idx] == null) return;
|
||||
requests[idx].link = link;
|
||||
@@ -416,6 +486,9 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
}
|
||||
}
|
||||
data.setTag(NBT_REQUESTS, tagList);
|
||||
if (this.isLiteModeOverridden) {
|
||||
data.setBoolean(NBT_LITE_MODE, this.isLiteMode);
|
||||
}
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
@@ -499,6 +572,10 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
this.requests[i].quantity = quantyties[i];
|
||||
}
|
||||
}
|
||||
if (data.hasKey(NBT_LITE_MODE)) {
|
||||
this.isLiteModeOverridden = true;
|
||||
this.isLiteMode = data.getBoolean(NBT_LITE_MODE);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove old format NBT data from ItemStack
|
||||
@@ -541,6 +618,12 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
}
|
||||
}
|
||||
}
|
||||
if (compound.hasKey(NBT_LITE_MODE)) {
|
||||
this.isLiteModeOverridden = true;
|
||||
this.isLiteMode = compound.getBoolean(NBT_LITE_MODE);
|
||||
} else {
|
||||
this.isLiteModeOverridden = false;
|
||||
}
|
||||
this.saveChanges();
|
||||
}
|
||||
|
||||
@@ -557,6 +640,9 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
}
|
||||
}
|
||||
compound.setTag(NBT_REQUESTS, tagList);
|
||||
if (isLiteModeOverridden) {
|
||||
compound.setBoolean(NBT_LITE_MODE, isLiteMode);
|
||||
}
|
||||
return compound;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,25 +5,32 @@ import java.util.stream.IntStream;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
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 net.minecraftforge.common.util.Constants;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import com.glodblock.github.common.item.FCBaseItemCell;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.inventory.AEFluidInventory;
|
||||
import com.glodblock.github.inventory.IAEFluidInventory;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import com.gtnewhorizon.gtnhlib.item.ItemStackNBT;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.implementations.IPowerChannelState;
|
||||
import appeng.api.implementations.items.IStorageCell;
|
||||
import appeng.api.implementations.tiles.IColorableTile;
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.events.MENetworkBootingStatusChange;
|
||||
@@ -36,60 +43,110 @@ import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.storage.StorageName;
|
||||
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.api.util.AEColor;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.core.AELog;
|
||||
import appeng.items.storage.ItemBasicStorageCell;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.grid.AENetworkInvTile;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.tile.inventory.BiggerAppEngInventory;
|
||||
import appeng.tile.inventory.IAEStackInventory;
|
||||
import appeng.tile.inventory.IIAEStackInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
implements IAEFluidInventory, IFluidHandler, IPowerChannelState, IGridTickable, ITerminalHost {
|
||||
public class TileSuperStockReplenisher extends AENetworkInvTile implements IAEFluidInventory, IFluidHandler,
|
||||
IPowerChannelState, IGridTickable, ITerminalHost, IIAEStackInventory, IColorableTile {
|
||||
|
||||
private final AppEngInternalInventory cell = new AppEngInternalInventory(this, 1);
|
||||
private final BiggerAppEngInventory invItems = new BiggerAppEngInventory(this, 63);
|
||||
private final AEFluidInventory invFluids = new AEFluidInventory(this, 9, Integer.MAX_VALUE);
|
||||
private final AppEngInternalAEInventory configFluids = new AppEngInternalAEInventory(this, 9);
|
||||
private final AppEngInternalAEInventory configItems = new AppEngInternalAEInventory(this, 63);
|
||||
private final IAEStackInventory configItems = new IAEStackInventory(this, 63, StorageName.CONFIG);
|
||||
private final IAEStackInventory configFluids = new IAEStackInventory(this, 9, StorageName.NONE) {
|
||||
|
||||
@Override
|
||||
public void readFromNBT(@Nullable NBTTagCompound data, String name) {
|
||||
super.readFromNBT(data, name);
|
||||
|
||||
for (int i = 0; i < this.getSizeInventory(); i++) {
|
||||
final IAEStack<?> aes = this.getAEStackInSlot(i);
|
||||
if (aes instanceof IAEItemStack ais && ais.getItem() instanceof ItemFluidPacket) {
|
||||
final IAEFluidStack ifs = ItemFluidPacket.getFluidAEStack(ais);
|
||||
if (ifs != null && ifs.getStackSize() > Integer.MAX_VALUE) ifs.setStackSize(Integer.MAX_VALUE);
|
||||
this.putAEStackInSlot(i, ifs);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
private final BaseActionSource source;
|
||||
private boolean isPowered;
|
||||
private AEColor paintedColor = AEColor.Transparent;
|
||||
private long totalBytes;
|
||||
private long storedFluidCount;
|
||||
private long storedItemCount;
|
||||
protected boolean isFullStockMode;
|
||||
protected boolean isSlotsAccessible;
|
||||
protected boolean isNeedsFullyStocked;
|
||||
protected boolean modeChange;
|
||||
|
||||
private boolean needReCountStoredFluids = true;
|
||||
private boolean needReCountStoredItems = true;
|
||||
|
||||
public TileSuperStockReplenisher() {
|
||||
super(false);
|
||||
getProxy().setIdlePowerUsage(4D);
|
||||
getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
|
||||
this.getProxy().setIdlePowerUsage(4D);
|
||||
this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
|
||||
this.source = new MachineSource(this);
|
||||
invItems.setMaxStackSize(Integer.MAX_VALUE);
|
||||
this.isFullStockMode = false;
|
||||
this.isSlotsAccessible = true;
|
||||
this.isNeedsFullyStocked = false;
|
||||
this.modeChange = false;
|
||||
}
|
||||
|
||||
private TickRateModulation doWork() {
|
||||
final TickRateModulation tickRateModulation;
|
||||
|
||||
if (this.isFullStockMode()) {
|
||||
if (this.isNeedsFullyStocked()) {
|
||||
tickRateModulation = TickRateModulation.FASTER;
|
||||
} else tickRateModulation = TickRateModulation.SLOWER;
|
||||
} else tickRateModulation = TickRateModulation.IDLE;
|
||||
|
||||
this.fletchFluids();
|
||||
this.fletchItems();
|
||||
|
||||
this.needReCountStoredFluids = true;
|
||||
this.needReCountStoredItems = true;
|
||||
|
||||
return tickRateModulation;
|
||||
}
|
||||
|
||||
private void fletchFluids() {
|
||||
for (int i = 0; i < 9; i++) {
|
||||
IAEFluidStack invFluid = invFluids.getFluidInSlot(i);
|
||||
IAEItemStack configFluid = configFluids.getAEStackInSlot(i);
|
||||
if (configFluid != null) {
|
||||
IAEFluidStack fs = AEFluidStack.create(ItemFluidPacket.getFluidStack(configFluid));
|
||||
if (invFluid == null) requestFluid(fs, i);
|
||||
else if (invFluid.equals(fs)) {
|
||||
IAEStack<?> configFluid = configFluids.getAEStackInSlot(i);
|
||||
if (configFluid instanceof IAEFluidStack fs) {
|
||||
IAEFluidStack ifs = fs.copy();
|
||||
if (invFluid == null) requestFluid(ifs, i);
|
||||
else if (invFluid.equals(ifs)) {
|
||||
long invSize = invFluid.getStackSize();
|
||||
long confSize = fs.getStackSize();
|
||||
if (invSize < confSize / 2f) {
|
||||
fs.setStackSize(confSize - invSize);
|
||||
requestFluid(fs, i);
|
||||
long confSize = ifs.getStackSize();
|
||||
if (!this.isFullStockMode() && (invSize < confSize / 2f)
|
||||
|| (this.isFullStockMode() && (invSize < confSize))) {
|
||||
ifs.setStackSize(confSize - invSize);
|
||||
requestFluid(ifs, i);
|
||||
} else if (invSize > confSize) {
|
||||
returnFluid(i, invSize - confSize);
|
||||
}
|
||||
@@ -100,18 +157,21 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
returnFluid(i, Long.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fletchItems() {
|
||||
for (int i = 0; i < 63; i++) {
|
||||
ItemStack invItem = invItems.getStackInSlot(i);
|
||||
IAEItemStack configItem = configItems.getAEStackInSlot(i);
|
||||
|
||||
if (configItem != null) {
|
||||
IAEItemStack is = configItem.copy();
|
||||
IAEStack<?> configItem = configItems.getAEStackInSlot(i);
|
||||
if (configItem instanceof IAEItemStack ais) {
|
||||
IAEItemStack is = ais.copy();
|
||||
if (invItem == null) requestItem(is, i);
|
||||
else if (is.equals(invItem)) {
|
||||
int invSize = invItem.stackSize;
|
||||
int confSize = (int) is.getStackSize();
|
||||
if (invItem.stackSize < confSize / 2f) {
|
||||
is.setStackSize(confSize - invItem.stackSize);
|
||||
if ((!this.isFullStockMode() && (invSize < confSize / 2f))
|
||||
|| ((this.isFullStockMode()) && (invSize < confSize))) {
|
||||
is.setStackSize(confSize - invSize);
|
||||
requestItem(is, i);
|
||||
} else if (invItem.stackSize > confSize) {
|
||||
returnItem(i, invItem.stackSize - confSize);
|
||||
@@ -123,8 +183,28 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
returnItem(i, Integer.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TickRateModulation.SAME;
|
||||
private void countFluids() {
|
||||
if (this.needReCountStoredFluids) {
|
||||
this.needReCountStoredFluids = false;
|
||||
this.storedFluidCount = 0;
|
||||
for (int i = 0; i < this.invFluids.getSlots(); i++) {
|
||||
final IAEFluidStack fs = this.invFluids.getFluidInSlot(i);
|
||||
if (fs != null) this.storedFluidCount += fs.getStackSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void countItems() {
|
||||
if (this.needReCountStoredItems) {
|
||||
this.needReCountStoredItems = false;
|
||||
this.storedItemCount = 0;
|
||||
for (int i = 0; i < this.invItems.getSizeInventory(); i++) {
|
||||
final ItemStack is = this.invItems.getStackInSlot(i);
|
||||
if (is != null) this.storedItemCount += is.stackSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void returnFluid(int index, long amount) {
|
||||
@@ -136,6 +216,7 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
if (notInserted != null) {
|
||||
invFluids.fill(index, notInserted, true);
|
||||
storedFluidCount += notInserted.getStackSize();
|
||||
checkSlotsAccessible();
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
}
|
||||
@@ -150,6 +231,7 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
if (extracted != null) {
|
||||
storedFluidCount += extracted.getStackSize();
|
||||
invFluids.fill(index, extracted, true);
|
||||
checkSlotsAccessible();
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
}
|
||||
@@ -161,21 +243,25 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
is.stackSize = is.stackSize - amount;
|
||||
is = is.copy();
|
||||
is.stackSize = amount;
|
||||
storedItemCount -= is.stackSize;
|
||||
} else {
|
||||
invItems.setInventorySlotContents(index, null);
|
||||
}
|
||||
|
||||
this.storedItemCount -= is.stackSize;
|
||||
|
||||
IAEItemStack notInserted = this.getProxy().getStorage().getItemInventory()
|
||||
.injectItems(AEItemStack.create(is), Actionable.MODULATE, this.source);
|
||||
if (notInserted != null) {
|
||||
ItemStack tempStack = invItems.getStackInSlot(index);
|
||||
if (tempStack != null) {
|
||||
if (invItems.getStackInSlot(index) != null) {
|
||||
ItemStack tempStack = invItems.getStackInSlot(index).copy();
|
||||
tempStack.stackSize = tempStack.stackSize + (int) notInserted.getStackSize();
|
||||
storedItemCount += notInserted.getStackSize();
|
||||
|
||||
saveChanges();
|
||||
} else invItems.setInventorySlotContents(index, notInserted.getItemStack());
|
||||
invItems.setInventorySlotContents(index, tempStack);
|
||||
checkSlotsAccessible();
|
||||
} else {
|
||||
invItems.setInventorySlotContents(index, notInserted.getItemStack());
|
||||
checkSlotsAccessible();
|
||||
}
|
||||
this.storedItemCount += notInserted.getStackSize();
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
}
|
||||
@@ -188,20 +274,160 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
IAEItemStack extracted = this.getProxy().getStorage().getItemInventory()
|
||||
.extractItems(is, Actionable.MODULATE, this.source);
|
||||
if (extracted != null) {
|
||||
ItemStack tempStack = invItems.getStackInSlot(index);
|
||||
if (tempStack != null) {
|
||||
if (invItems.getStackInSlot(index) != null) {
|
||||
ItemStack tempStack = invItems.getStackInSlot(index).copy();
|
||||
tempStack.stackSize = tempStack.stackSize + (int) extracted.getStackSize();
|
||||
storedItemCount += extracted.getStackSize();
|
||||
invItems.setInventorySlotContents(index, tempStack);
|
||||
checkSlotsAccessible();
|
||||
|
||||
saveChanges();
|
||||
} else invItems.setInventorySlotContents(index, extracted.getItemStack());
|
||||
} else {
|
||||
invItems.setInventorySlotContents(index, extracted.getItemStack());
|
||||
checkSlotsAccessible();
|
||||
|
||||
}
|
||||
|
||||
this.storedItemCount += extracted.getStackSize();
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
}
|
||||
|
||||
public boolean isFullStockMode() {
|
||||
return this.isFullStockMode;
|
||||
}
|
||||
|
||||
public void setFullStockMode(boolean fullStockMode) {
|
||||
|
||||
if (this.isFullStockMode == fullStockMode) return;
|
||||
|
||||
if (fullStockMode) this.modeChange = true;
|
||||
|
||||
this.isFullStockMode = fullStockMode;
|
||||
checkSlotsAccessible();
|
||||
this.modeChange = false;
|
||||
}
|
||||
|
||||
public boolean isSlotsAccessible() {
|
||||
return this.isSlotsAccessible;
|
||||
}
|
||||
|
||||
public boolean isNeedsFullyStocked() {
|
||||
return this.isNeedsFullyStocked;
|
||||
}
|
||||
|
||||
public boolean hasModeChangedToTrue() {
|
||||
return this.modeChange;
|
||||
}
|
||||
|
||||
public void setSlotsAccessible() {
|
||||
if (this.isFullStockMode()) {
|
||||
|
||||
if (this.hasModeChangedToTrue()) {
|
||||
|
||||
this.isSlotsAccessible = false;
|
||||
|
||||
}
|
||||
if (this.isSlotsAccessible()) {
|
||||
|
||||
if ((this.needsFullyStocked())) this.isSlotsAccessible = false;
|
||||
|
||||
} else {
|
||||
|
||||
if (this.isFullyStocked()) this.isSlotsAccessible = true;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
this.isSlotsAccessible = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void checkSlotsAccessible() {
|
||||
this.setSlotsAccessible();
|
||||
this.notifyNeighbors();
|
||||
}
|
||||
|
||||
private boolean needsFullyStocked() {
|
||||
int configSlots = 0;
|
||||
int emptySlots = 0;
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
IAEStack<?> config = configFluids.getAEStackInSlot(i);
|
||||
|
||||
if (config instanceof IAEFluidStack cfg) {
|
||||
configSlots++;
|
||||
IAEFluidStack inv = invFluids.getFluidInSlot(i);
|
||||
|
||||
if (inv == null) {
|
||||
emptySlots++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 63; i++) {
|
||||
IAEStack<?> config = configItems.getAEStackInSlot(i);
|
||||
|
||||
if (config instanceof IAEItemStack cfg) {
|
||||
configSlots++;
|
||||
ItemStack inv = invItems.getStackInSlot(i);
|
||||
|
||||
if (inv == null) {
|
||||
emptySlots++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.isNeedsFullyStocked = (emptySlots == configSlots) && (configSlots > 0);
|
||||
|
||||
return isNeedsFullyStocked;
|
||||
}
|
||||
|
||||
private boolean isFullyStocked() {
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
IAEStack<?> config = configFluids.getAEStackInSlot(i);
|
||||
|
||||
if (config instanceof IAEFluidStack cfg) {
|
||||
IAEFluidStack cfgFis = cfg.copy();
|
||||
IAEFluidStack inv = invFluids.getFluidInSlot(i);
|
||||
|
||||
if (inv == null || inv.getStackSize() < cfgFis.getStackSize()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 63; i++) {
|
||||
IAEStack<?> config = configItems.getAEStackInSlot(i);
|
||||
|
||||
if (config instanceof IAEItemStack cfg) {
|
||||
IAEItemStack cfgIs = cfg.copy();
|
||||
ItemStack inv = invItems.getStackInSlot(i);
|
||||
|
||||
if (inv == null || inv.stackSize < (int) cfgIs.getStackSize()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide(ForgeDirection whichSide) {
|
||||
return IntStream.rangeClosed(0, 62).toArray();
|
||||
return ((this.isSlotsAccessible()) ? IntStream.rangeClosed(0, 62).toArray() : new int[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemStackIn, int side) {
|
||||
return this.isSlotsAccessible();
|
||||
}
|
||||
|
||||
public void notifyNeighbors() {
|
||||
if (this.getWorldObj() != null) {
|
||||
this.markDirty();
|
||||
this.getWorldObj().notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType());
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -210,12 +436,12 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
return invItems;
|
||||
}
|
||||
|
||||
public AppEngInternalAEInventory getConfigFluid() {
|
||||
return configFluids;
|
||||
public IAEStackInventory getConfigFluids() {
|
||||
return this.configFluids;
|
||||
}
|
||||
|
||||
public AppEngInternalAEInventory getConfigItems() {
|
||||
return configItems;
|
||||
public IAEStackInventory getConfigItems() {
|
||||
return this.configItems;
|
||||
}
|
||||
|
||||
public AppEngInternalInventory getCell() {
|
||||
@@ -223,6 +449,9 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
}
|
||||
|
||||
public long getFreeBytes() {
|
||||
this.countFluids();
|
||||
this.countItems();
|
||||
|
||||
return totalBytes - (((storedItemCount + getUnusedItemCount()) / 8)
|
||||
+ ((storedFluidCount + getUnusedFluidCount()) / 2048));
|
||||
}
|
||||
@@ -263,24 +492,12 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
case setInventorySlotContents -> {
|
||||
if (inv == cell) {
|
||||
if (added != null) {
|
||||
if (added.getItem() instanceof ItemBasicStorageCell ibsc) {
|
||||
totalBytes = ibsc.getBytesLong(added);
|
||||
} else if (added.getItem() instanceof FCBaseItemCell fcbic) {
|
||||
totalBytes = fcbic.getBytes(added);
|
||||
}
|
||||
if (added.getItem() instanceof IStorageCell isc) totalBytes = isc.getBytesLong(added);
|
||||
getProxy().setIdlePowerUsage(Math.sqrt(Math.pow(totalBytes, 0.576D)));
|
||||
} else if (removed != null) {
|
||||
totalBytes = 0;
|
||||
getProxy().setIdlePowerUsage(4d);
|
||||
}
|
||||
} else if (inv == invItems) {
|
||||
if (added != null) {
|
||||
storedItemCount += added.stackSize;
|
||||
}
|
||||
|
||||
if (removed != null) {
|
||||
storedItemCount -= removed.stackSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
case decreaseStackSize -> {
|
||||
@@ -288,10 +505,6 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
totalBytes = 0;
|
||||
getProxy().setIdlePowerUsage(4d);
|
||||
}
|
||||
|
||||
if (inv == invItems) {
|
||||
storedItemCount -= removed.stackSize;
|
||||
}
|
||||
}
|
||||
case markDirty -> markDirty();
|
||||
}
|
||||
@@ -301,6 +514,8 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
} catch (GridAccessException e) {
|
||||
AELog.error(e, "Couldn't wake up level emitter for delayed updates");
|
||||
}
|
||||
|
||||
checkSlotsAccessible();
|
||||
}
|
||||
|
||||
public void fullRefund() {
|
||||
@@ -319,12 +534,26 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
|
||||
@Override
|
||||
public void getDrops(World w, int x, int y, int z, List<ItemStack> drops) {
|
||||
this.fullRefund();
|
||||
|
||||
if (cell.getStackInSlot(0) != null) drops.add(cell.getStackInSlot(0));
|
||||
final ItemStack container = AEApi.instance().definitions().items().itemMEStackPacket().maybeStack(1).get();
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
ItemStack ifp = ItemFluidPacket.newStack(invFluids.getFluidStackInSlot(i));
|
||||
if (ifp != null) drops.add(ifp);
|
||||
final FluidStack fs = this.invFluids.getFluidStackInSlot(i);
|
||||
if (fs == null) continue;
|
||||
final ItemStack temp = container.copy();
|
||||
Platform.writeStackNBT(AEFluidStack.create(fs), ItemStackNBT.get(temp));
|
||||
drops.add(temp);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 63; i++) {
|
||||
final ItemStack is = this.invItems.getStackInSlot(i);
|
||||
if (is == null) continue;
|
||||
final ItemStack temp = container.copy();
|
||||
Platform.writeStackNBT(AEItemStack.create(is), ItemStackNBT.get(temp));
|
||||
drops.add(temp);
|
||||
}
|
||||
super.getDrops(w, x, y, z, drops);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -339,16 +568,12 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
FluidStack fs = invFluids.drain(from, resource, doDrain);
|
||||
if (doDrain && fs != null) storedFluidCount -= fs.amount;
|
||||
return fs;
|
||||
return (this.isFullStockMode() && !this.isSlotsAccessible()) ? null : invFluids.drain(from, resource, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
FluidStack fs = invFluids.drain(from, maxDrain, doDrain);
|
||||
if (doDrain && fs != null) storedFluidCount -= fs.amount;
|
||||
return fs;
|
||||
return (this.isFullStockMode() && !this.isSlotsAccessible()) ? null : invFluids.drain(from, maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -358,17 +583,19 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
return invFluids.canDrain(from, fluid);
|
||||
return (this.isFullStockMode() && !this.isSlotsAccessible()) ? false : invFluids.canDrain(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
return invFluids.getTankInfo(from);
|
||||
return (this.isFullStockMode() && !this.isSlotsAccessible()) ? new FluidTankInfo[0]
|
||||
: invFluids.getTankInfo(from);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFluidInventoryChanged(IAEFluidTank inv, int slot) {
|
||||
saveChanges();
|
||||
this.markDirty();
|
||||
checkSlotsAccessible();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -379,42 +606,74 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
@TileEvent(TileEventType.NETWORK_READ)
|
||||
public boolean readFromStream_TileSuperStockReplenisher(final ByteBuf data) {
|
||||
final boolean oldPower = isPowered;
|
||||
final AEColor oldPaintedColor = this.paintedColor;
|
||||
isPowered = data.readBoolean();
|
||||
return isPowered != oldPower;
|
||||
this.paintedColor = AEColor.fromOrdinal(data.readByte());
|
||||
this.getProxy().setColor(this.paintedColor);
|
||||
return isPowered != oldPower || this.paintedColor != oldPaintedColor;
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_WRITE)
|
||||
public void writeToStream_TileSuperStockReplenisher(final ByteBuf data) {
|
||||
data.writeBoolean(isActive());
|
||||
data.writeByte(this.paintedColor.ordinal());
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBTEvent(NBTTagCompound data) {
|
||||
final int color = data.hasKey("paintedColor", Constants.NBT.TAG_BYTE) ? data.getByte("paintedColor")
|
||||
: AEColor.Transparent.ordinal();
|
||||
this.paintedColor = color >= 0 && color < AEColor.VALUES.length ? AEColor.fromOrdinal(color)
|
||||
: AEColor.Transparent;
|
||||
this.getProxy().setColor(this.paintedColor);
|
||||
invItems.readFromNBT(data, "ItemInv");
|
||||
invFluids.readFromNBT(data, "FluidInv");
|
||||
configItems.readFromNBT(data, "configItems");
|
||||
configFluids.readFromNBT(data, "configFluids");
|
||||
cell.readFromNBT(data, "cellHolder");
|
||||
isFullStockMode = data.getBoolean("isFullStockMode");
|
||||
checkSlotsAccessible();
|
||||
isSlotsAccessible = data.getBoolean("isSlotsAccessible");
|
||||
totalBytes = data.getLong("totalBytes");
|
||||
storedFluidCount = data.getLong("storedFluidCount");
|
||||
storedItemCount = data.getLong("storedItemCount");
|
||||
getProxy().setIdlePowerUsage(data.getDouble("powerDraw"));
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public NBTTagCompound writeToNBTEvent(NBTTagCompound data) {
|
||||
data.setByte("paintedColor", (byte) this.paintedColor.ordinal());
|
||||
invItems.writeToNBT(data, "ItemInv");
|
||||
invFluids.writeToNBT(data, "FluidInv");
|
||||
configItems.writeToNBT(data, "configItems");
|
||||
configFluids.writeToNBT(data, "configFluids");
|
||||
cell.writeToNBT(data, "cellHolder");
|
||||
data.setBoolean("isFullStockMode", isFullStockMode);
|
||||
data.setBoolean("isSlotsAccessible", isSlotsAccessible);
|
||||
data.setLong("totalBytes", totalBytes);
|
||||
data.setLong("storedFluidCount", storedFluidCount);
|
||||
data.setLong("storedItemCount", storedItemCount);
|
||||
data.setDouble("powerDraw", getProxy().getIdlePowerUsage());
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColor getColor() {
|
||||
return this.paintedColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recolourBlock(final ForgeDirection side, final AEColor newPaintedColor, final EntityPlayer who) {
|
||||
if (this.paintedColor == newPaintedColor) {
|
||||
return false;
|
||||
}
|
||||
this.paintedColor = newPaintedColor;
|
||||
this.getProxy().setColor(this.paintedColor);
|
||||
final IGridNode node = this.getGridNode(side);
|
||||
if (node != null) {
|
||||
node.updateState();
|
||||
}
|
||||
this.markDirty();
|
||||
this.markForUpdate();
|
||||
return true;
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void stateChange(final MENetworkPowerStatusChange p) {
|
||||
this.updatePowerState();
|
||||
@@ -460,7 +719,7 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(IGridNode node) {
|
||||
return new TickingRequest(120, 120, false, false);
|
||||
return new TickingRequest(10, 120, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -482,4 +741,18 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
public IConfigManager getConfigManager() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveAEStackInv() {
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEStackInventory getAEInventoryByName(StorageName name) {
|
||||
return switch (name) {
|
||||
case NONE -> this.configFluids;
|
||||
case CONFIG -> this.configItems;
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
}
|
||||
+7
-8
@@ -13,7 +13,7 @@ import com.glodblock.github.util.DualityFluidInterface;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.util.Platform;
|
||||
import li.cil.oc.api.driver.EnvironmentProvider;
|
||||
import li.cil.oc.api.driver.NamedBlock;
|
||||
import li.cil.oc.api.driver.SidedBlock;
|
||||
@@ -104,20 +104,19 @@ public class DriverDualFluidInterface implements SidedBlock {
|
||||
if (te instanceof TileFluidInterface) {
|
||||
return true;
|
||||
}
|
||||
if (te instanceof IPartHost) {
|
||||
return ((IPartHost) te).getPart(face) instanceof PartFluidInterface;
|
||||
}
|
||||
|
||||
return Platform.getPartFromTE(te, face) instanceof PartFluidInterface;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static DualityFluidInterface getInterface(TileEntity te, ForgeDirection face) {
|
||||
if (te != null) {
|
||||
if (te instanceof TileFluidInterface) {
|
||||
return ((TileFluidInterface) te).getDualityFluid();
|
||||
if (te instanceof TileFluidInterface tile) {
|
||||
return tile.getDualityFluid();
|
||||
}
|
||||
if (te instanceof IPartHost && ((IPartHost) te).getPart(face) instanceof PartFluidInterface) {
|
||||
return ((PartFluidInterface) ((IPartHost) te).getPart(face)).getDualityFluid();
|
||||
if (Platform.getPartFromTE(te, face) instanceof PartFluidInterface part) {
|
||||
return part.getDualityFluid();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
+17
-14
@@ -1,7 +1,5 @@
|
||||
package com.glodblock.github.crossmod.thaumcraft;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -9,13 +7,10 @@ import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
import appeng.api.storage.data.AEStackTypeRegistry;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumicenergistics.common.items.ItemCraftingAspect;
|
||||
import thaumicenergistics.common.storage.AEEssentiaStack;
|
||||
|
||||
public class ThaumicEnergisticsCrafting {
|
||||
|
||||
@@ -37,18 +32,23 @@ public class ThaumicEnergisticsCrafting {
|
||||
}
|
||||
|
||||
public static IAEStack<?> convertItemAspectStack(IAEStack<?> stack) {
|
||||
if (stack instanceof IAEItemStack ais && isAspectStack(ais.getItemStack())) {
|
||||
Aspect aspect = getAspect(ais.getItemStack());
|
||||
if (aspect == null) return stack;
|
||||
if (AEStackTypeRegistry.getType("essentia") == null) return stack;
|
||||
|
||||
return new AEEssentiaStack(aspect, stack.getStackSize());
|
||||
if (stack instanceof IAEItemStack ais && isAspectStack(ais.getItemStack())) {
|
||||
String aspectTag = getAspectTag(ais.getItemStack());
|
||||
if (aspectTag == null || aspectTag.isEmpty()) return stack;
|
||||
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setString("StackType", "essentia");
|
||||
tag.setString("AspectTag", aspectTag);
|
||||
tag.setLong("Cnt", stack.getStackSize());
|
||||
return IAEStack.fromNBTGeneric(tag);
|
||||
} else {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
@Method(modid = "thaumicenergistics")
|
||||
private static @Nullable Aspect getAspect(ItemStack stack) {
|
||||
private static String getAspectTag(ItemStack stack) {
|
||||
if (stack == null) return null;
|
||||
|
||||
if (stack.getItem() == neiAddonAspect) {
|
||||
@@ -58,11 +58,14 @@ public class ThaumicEnergisticsCrafting {
|
||||
String aspect = aspects.getCompoundTagAt(0).getString("key");
|
||||
if (aspect.isEmpty()) return null;
|
||||
|
||||
return Aspect.getAspect(aspect);
|
||||
return aspect;
|
||||
}
|
||||
|
||||
if (stack.getItem() == thaumicEnergisticsAspect) {
|
||||
return Aspect.getAspect(ItemCraftingAspect.getAspect(stack).getTag());
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if (tag != null && tag.hasKey("Aspect")) {
|
||||
return tag.getString("Aspect");
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.glodblock.github.common.tile.TileCertusQuartzTank;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
@@ -19,8 +21,12 @@ public class WailaInit {
|
||||
|
||||
public static void register(final IWailaRegistrar registrar) {
|
||||
final IWailaDataProvider part = new PartWailaDataProvider();
|
||||
registrar.registerBodyProvider(part, IPartHost.class);
|
||||
registrar.registerNBTProvider(part, IPartHost.class);
|
||||
registerPartProvider(registrar, part, IPartHost.class);
|
||||
if (IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.FMP)) {
|
||||
try {
|
||||
registerPartProvider(registrar, part, Class.forName("codechicken.multipart.TileMultipart"));
|
||||
} catch (final ClassNotFoundException ignored) {}
|
||||
}
|
||||
if (Platform.isClient()) GuiContainerManager.addTooltipHandler(new FCTooltipHandlerWaila());
|
||||
|
||||
final IWailaDataProvider tile = new TileWailaDataProvider();
|
||||
@@ -32,4 +38,10 @@ public class WailaInit {
|
||||
registrar.registerBodyProvider(certusQuartzTank, TileCertusQuartzTank.class);
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerPartProvider(final IWailaRegistrar registrar, final IWailaDataProvider provider,
|
||||
final Class<?> tileClass) {
|
||||
registrar.registerBodyProvider(provider, tileClass);
|
||||
registrar.registerNBTProvider(provider, tileClass);
|
||||
}
|
||||
}
|
||||
@@ -432,7 +432,10 @@ public class AEFluidInventory implements IAEFluidTank {
|
||||
if (doFill) {
|
||||
if (getFluid() == null) AEFluidInventory.this
|
||||
.setFluidInSlot(this.slot, AEFluidStack.create(new FluidStack(resource.getFluid(), acc)));
|
||||
else getFluid().amount += acc;
|
||||
else {
|
||||
getFluid().amount += acc;
|
||||
AEFluidInventory.this.onContentChanged(this.slot);
|
||||
}
|
||||
}
|
||||
return acc;
|
||||
}
|
||||
@@ -446,7 +449,10 @@ public class AEFluidInventory implements IAEFluidTank {
|
||||
if (doDrain) {
|
||||
if (amt == getFluid().amount) {
|
||||
AEFluidInventory.this.setFluidInSlot(this.slot, null);
|
||||
} else getFluid().amount -= amt;
|
||||
} else {
|
||||
getFluid().amount -= amt;
|
||||
AEFluidInventory.this.onContentChanged(this.slot);
|
||||
}
|
||||
}
|
||||
return remove;
|
||||
}
|
||||
|
||||
+4
-5
@@ -3,13 +3,12 @@ package com.glodblock.github.inventory.external;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.implementations.tiles.ITileStorageMonitorable;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class AEFluidInterfaceHandler implements IExternalStorageHandler {
|
||||
|
||||
@@ -18,7 +17,7 @@ public class AEFluidInterfaceHandler implements IExternalStorageHandler {
|
||||
if (channel == StorageChannel.FLUIDS) {
|
||||
if (te instanceof ITileStorageMonitorable) {
|
||||
return true;
|
||||
} else return Util.getPart(te, d.getOpposite()) instanceof ITileStorageMonitorable;
|
||||
} else return Platform.getPartFromTE(te, d.getOpposite()) instanceof ITileStorageMonitorable;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -30,8 +29,8 @@ public class AEFluidInterfaceHandler implements IExternalStorageHandler {
|
||||
if (te instanceof ITileStorageMonitorable
|
||||
&& ((ITileStorageMonitorable) te).getMonitorable(d, src) != null) {
|
||||
return ((ITileStorageMonitorable) te).getMonitorable(d, src).getFluidInventory();
|
||||
} else if (Util.getPart(te, d.getOpposite()) instanceof ITileStorageMonitorable part
|
||||
&& ((ITileStorageMonitorable) Util.getPart(te, d.getOpposite())).getMonitorable(d, src) != null) {
|
||||
} else if (Platform.getPartFromTE(te, d.getOpposite()) instanceof ITileStorageMonitorable part
|
||||
&& part.getMonitorable(d, src) != null) {
|
||||
return part.getMonitorable(d, src).getFluidInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public abstract class PartGuiFactory<T> extends TileGuiFactory<T> {
|
||||
|
||||
@@ -17,12 +17,11 @@ public abstract class PartGuiFactory<T> extends TileGuiFactory<T> {
|
||||
@Nullable
|
||||
@Override
|
||||
protected T getInventory(TileEntity tile, ForgeDirection face) {
|
||||
if (tile instanceof IPartHost) {
|
||||
IPart part = ((IPartHost) tile).getPart(face);
|
||||
if (invClass.isInstance(part)) {
|
||||
return invClass.cast(part);
|
||||
}
|
||||
IPart part = Platform.getPartFromTE(tile, face);
|
||||
if (invClass.isInstance(part)) {
|
||||
return invClass.cast(part);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public abstract class TileOrPartGuiFactory<T> extends TileGuiFactory<T> {
|
||||
|
||||
@@ -17,12 +17,11 @@ public abstract class TileOrPartGuiFactory<T> extends TileGuiFactory<T> {
|
||||
@Nullable
|
||||
@Override
|
||||
protected T getInventory(TileEntity tile, ForgeDirection face) {
|
||||
if (tile instanceof IPartHost) {
|
||||
IPart part = ((IPartHost) tile).getPart(face);
|
||||
if (invClass.isInstance(part)) {
|
||||
return invClass.cast(part);
|
||||
}
|
||||
IPart part = Platform.getPartFromTE(tile, face);
|
||||
if (invClass.isInstance(part)) {
|
||||
return invClass.cast(part);
|
||||
}
|
||||
|
||||
return super.getInventory(tile, face);
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,9 @@ public class WirelessMagnet {
|
||||
|
||||
Off,
|
||||
Inv,
|
||||
ME
|
||||
ME;
|
||||
|
||||
public static final Mode[] VALUES = values();
|
||||
}
|
||||
|
||||
public enum ListMode {
|
||||
@@ -138,7 +140,7 @@ public class WirelessMagnet {
|
||||
if (is != null && is.getItem() instanceof ItemWirelessUltraTerminal) {
|
||||
NBTTagCompound data = Platform.openNbtData(is);
|
||||
if (data.hasKey(modeKey)) {
|
||||
return Mode.values()[data.getInteger(modeKey)];
|
||||
return Mode.VALUES[data.getInteger(modeKey)];
|
||||
}
|
||||
setMode(is, Mode.Off);
|
||||
}
|
||||
|
||||
+6
-8
@@ -231,21 +231,19 @@ public class WirelessMagnetCardFilterInventory extends BaseWirelessInventory imp
|
||||
.sameOre(OreHelper.INSTANCE.isOre(is), OreHelper.INSTANCE.isOre(inputItemStack)))
|
||||
return true;
|
||||
}
|
||||
boolean match;
|
||||
if (ignoreMeta && ignoreNbt) {
|
||||
// ignore meta & nbt
|
||||
return is.getItem().equals(inputItemStack.getItem());
|
||||
match = is.getItem().equals(inputItemStack.getItem());
|
||||
} else if (ignoreMeta) {
|
||||
// ignore meta only
|
||||
return ItemStack.areItemStackTagsEqual(is, inputItemStack)
|
||||
match = ItemStack.areItemStackTagsEqual(is, inputItemStack)
|
||||
&& is.getItem() == inputItemStack.getItem();
|
||||
} else if (ignoreNbt) {
|
||||
// ignore nbt only
|
||||
return is.getItem() == inputItemStack.getItem()
|
||||
match = is.getItem() == inputItemStack.getItem()
|
||||
&& is.getItemDamage() == inputItemStack.getItemDamage();
|
||||
} else {
|
||||
// ignore nothing/don't use oredict--must be exact match
|
||||
return is.isItemEqual(inputItemStack) && ItemStack.areItemStackTagsEqual(is, inputItemStack);
|
||||
match = is.isItemEqual(inputItemStack) && ItemStack.areItemStackTagsEqual(is, inputItemStack);
|
||||
}
|
||||
if (match) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.glodblock.github.inventory.slot;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -17,10 +20,22 @@ public class FCSlotRestrictedInput extends SlotRestrictedInput {
|
||||
MutablePair<Boolean, ItemStack> isItemValid(final ItemStack inputItem);
|
||||
}
|
||||
|
||||
private final Filter filter;
|
||||
private final List<Filter> filter = new ArrayList<>();
|
||||
private final InventoryPlayer p;
|
||||
private ItemStack validItem = null;
|
||||
|
||||
public FCSlotRestrictedInput(List<ItemStack> validList, IInventory i, int slotIndex, int x, int y,
|
||||
InventoryPlayer p) {
|
||||
super(PlacableItemType.INSCRIBER_PLATE, i, slotIndex, x, y, p);
|
||||
validList.forEach(
|
||||
valid -> filter.add(
|
||||
(inputItem) -> new MutablePair<>(
|
||||
valid.getItem().getClass().isAssignableFrom(inputItem.getItem().getClass()),
|
||||
valid)));
|
||||
this.p = p;
|
||||
this.validItem = validList.get(0);
|
||||
}
|
||||
|
||||
public FCSlotRestrictedInput(ItemStack valid, IInventory i, int slotIndex, int x, int y, InventoryPlayer p) {
|
||||
this(
|
||||
(inputItem) -> new MutablePair<>(
|
||||
@@ -36,14 +51,15 @@ public class FCSlotRestrictedInput extends SlotRestrictedInput {
|
||||
|
||||
public FCSlotRestrictedInput(Filter filter, IInventory i, int slotIndex, int x, int y, InventoryPlayer p) {
|
||||
super(PlacableItemType.INSCRIBER_PLATE, i, slotIndex, x, y, p);
|
||||
this.filter = filter;
|
||||
this.filter.add(filter);
|
||||
this.p = p;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(final ItemStack inputItem) {
|
||||
MutablePair<Boolean, ItemStack> result = this.filter.isItemValid(inputItem);
|
||||
return result.left;
|
||||
for (Filter filter : this.filter) if (filter.isItemValid(inputItem).left) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean getAllowEdit() {
|
||||
|
||||
@@ -17,29 +17,24 @@ import com.glodblock.github.common.item.ItemBasicFluidStorageCell;
|
||||
import com.glodblock.github.common.item.ItemBasicFluidStoragePart;
|
||||
import com.glodblock.github.common.item.ItemCreativeFluidStorageCell;
|
||||
import com.glodblock.github.common.item.ItemEnergyCard;
|
||||
import com.glodblock.github.common.item.ItemFluidConversionMonitor;
|
||||
import com.glodblock.github.common.item.ItemFluidAnnihilationPlane;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.item.ItemFluidEncodedPattern;
|
||||
import com.glodblock.github.common.item.ItemFluidExportBus;
|
||||
import com.glodblock.github.common.item.ItemFluidExtremeStorageCell;
|
||||
import com.glodblock.github.common.item.ItemFluidFormationPlane;
|
||||
import com.glodblock.github.common.item.ItemFluidImportBus;
|
||||
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.ItemFluidVoidStorageCell;
|
||||
import com.glodblock.github.common.item.ItemInfinityWaterStorageCell;
|
||||
import com.glodblock.github.common.item.ItemMultiFluidStorageCell;
|
||||
import com.glodblock.github.common.item.ItemPartFluidInterface;
|
||||
import com.glodblock.github.common.item.ItemPartFluidP2PInterface;
|
||||
import com.glodblock.github.common.item.ItemPartFluidPatternTerminal;
|
||||
import com.glodblock.github.common.item.ItemPartFluidPatternTerminalEx;
|
||||
import com.glodblock.github.common.item.ItemPartFluidStorageBus;
|
||||
import com.glodblock.github.common.item.ItemPartFluidTerminal;
|
||||
import com.glodblock.github.common.item.ItemPartLevelTerminal;
|
||||
import com.glodblock.github.common.item.ItemPortableFluidCell;
|
||||
import com.glodblock.github.common.item.ItemQuantumBridgeCard;
|
||||
import com.glodblock.github.common.item.ItemWirelessFluidTerminal;
|
||||
import com.glodblock.github.common.item.ItemWirelessInterfaceTerminal;
|
||||
import com.glodblock.github.common.item.ItemWirelessLevelTerminal;
|
||||
import com.glodblock.github.common.item.ItemWirelessPatternTerminal;
|
||||
@@ -65,25 +60,21 @@ public class ItemAndBlockHolder {
|
||||
public static BlockSuperStockReplenisher SUPER_STOCK_RERPLENISHER = new BlockSuperStockReplenisher().register();
|
||||
public static ItemFluidDrop DROP = new ItemFluidDrop().register();
|
||||
public static ItemFluidEncodedPattern PATTERN = new ItemFluidEncodedPattern().register();
|
||||
public static ItemPartFluidTerminal FLUID_TERM = new ItemPartFluidTerminal().register();
|
||||
public static ItemPartFluidPatternTerminal FLUID_TERMINAL = new ItemPartFluidPatternTerminal().register();
|
||||
public static ItemPartFluidPatternTerminalEx FLUID_TERMINAL_EX = new ItemPartFluidPatternTerminalEx().register();
|
||||
public static ItemPartFluidInterface FLUID_INTERFACE = new ItemPartFluidInterface().register();
|
||||
public static ItemPartFluidP2PInterface FLUID_INTERFACE_P2P = new ItemPartFluidP2PInterface().register();
|
||||
public static ItemPartLevelTerminal LEVEL_TERMINAL = new ItemPartLevelTerminal().register();
|
||||
public static ItemFluidImportBus FLUID_IMPORT_BUS = new ItemFluidImportBus().register();
|
||||
public static ItemFluidExportBus FLUID_EXPORT_BUS = new ItemFluidExportBus().register();
|
||||
public static ItemPartFluidStorageBus FLUID_STORAGE_BUS = new ItemPartFluidStorageBus().register();
|
||||
public static ItemFluidLevelEmitter FLUID_LEVEL_EMITTER = new ItemFluidLevelEmitter().register();
|
||||
public static ItemFluidStorageMonitor FLUID_STORAGE_MONITOR = new ItemFluidStorageMonitor().register();
|
||||
public static ItemFluidConversionMonitor FLUID_CONVERSION_MONITOR = new ItemFluidConversionMonitor().register();
|
||||
public static ItemPortableFluidCell PORTABLE_FLUID_CELL = new ItemPortableFluidCell().register();
|
||||
public static ItemWirelessFluidTerminal WIRELESS_FLUID_TERM = new ItemWirelessFluidTerminal().register();
|
||||
public static ItemWirelessLevelTerminal WIRELESS_LEVEL_TERM = new ItemWirelessLevelTerminal().register();
|
||||
public static ItemWirelessPatternTerminal WIRELESS_PATTERN_TERM = new ItemWirelessPatternTerminal().register();
|
||||
public static ItemWirelessUltraTerminal WIRELESS_ULTRA_TERM = new ItemWirelessUltraTerminal().register();
|
||||
public static ItemWirelessInterfaceTerminal WIRELESS_INTERFACE_TERM = new ItemWirelessInterfaceTerminal()
|
||||
.register();
|
||||
public static ItemFluidFormationPlane FLUID_FORMATION_PLANE = new ItemFluidFormationPlane().register();
|
||||
public static ItemFluidAnnihilationPlane FLUID_ANNIHILATION_PLANE = new ItemFluidAnnihilationPlane().register();
|
||||
|
||||
public static ItemFluidPacket PACKET = new ItemFluidPacket().register();
|
||||
public static ItemBasicFluidStorageCell CELL1K = new ItemBasicFluidStorageCell(CellType.Cell1kPart, 0, 1)
|
||||
.register();
|
||||
|
||||
@@ -26,17 +26,11 @@ import static com.glodblock.github.loader.ItemAndBlockHolder.ENCODER;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.ENERGY_CARD;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_AUTO_FILLER;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_BUFFER;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_CONVERSION_MONITOR;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_EXPORT_BUS;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_IMPORT_BUS;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_INTERFACE;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_INTERFACE_P2P;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_LEVEL_EMITTER;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_STORAGE_BUS;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_STORAGE_MONITOR;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_TERM;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_TERMINAL;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_TERMINAL_EX;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_VOID_CELL;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.INFINITY_WATER_CELL;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.INTERFACE;
|
||||
@@ -50,7 +44,6 @@ import static com.glodblock.github.loader.ItemAndBlockHolder.QUANTUM_BRIDGE_CARD
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.QUANTUM_CELL;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.SINGULARITY_CELL;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.WALRUS;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.WIRELESS_FLUID_TERM;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.WIRELESS_INTERFACE_TERM;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.WIRELESS_LEVEL_TERM;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.WIRELESS_PATTERN_TERM;
|
||||
@@ -182,8 +175,6 @@ public class RecipeLoader implements Runnable {
|
||||
GameRegistry.findItem("appliedenergistics2", "item.ItemMultiMaterial"),
|
||||
1,
|
||||
43);
|
||||
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_ADVANCED_CARD = new ItemStack(
|
||||
@@ -278,28 +269,8 @@ public class RecipeLoader implements Runnable {
|
||||
'W',
|
||||
AE2_WORK_BENCH));
|
||||
GameRegistry.addShapelessRecipe(FLUID_STORAGE_BUS.stack(), FLUID_INTERFACE, STICKY_PISTON, PISTON);
|
||||
GameRegistry.addShapelessRecipe(FLUID_STORAGE_BUS.stack(), FLUID_STORAGE_BUS);
|
||||
GameRegistry.addShapelessRecipe(FLUID_STORAGE_BUS.stack(), INTERFACE, STICKY_PISTON, PISTON);
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
FLUID_STORAGE_MONITOR.stack(),
|
||||
"EIP",
|
||||
"P ",
|
||||
'I',
|
||||
"itemIlluminatedPanel",
|
||||
'E',
|
||||
AE2_LEVEL_EMITTER,
|
||||
'P',
|
||||
"dyeBlue"));
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
FLUID_CONVERSION_MONITOR.stack(),
|
||||
"ASF",
|
||||
'A',
|
||||
AE2_CORE_ANN,
|
||||
'S',
|
||||
FLUID_STORAGE_MONITOR,
|
||||
'F',
|
||||
AE2_CORE_FOM));
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
BUFFER.stack(),
|
||||
@@ -341,13 +312,6 @@ public class RecipeLoader implements Runnable {
|
||||
GameRegistry
|
||||
.addShapelessRecipe(LEVEL_MAINTAINER.stack(), AE2_CRAFTING_CP_UNIT, ENCODER, AE2_PATTERN_CAPACITY_CARD);
|
||||
|
||||
// Deprecated
|
||||
GameRegistry.addShapelessRecipe(AE2_TERMINAL, FLUID_TERM.stack());
|
||||
GameRegistry.addShapelessRecipe(AE2_WIRELESS_TERMINAL, WIRELESS_FLUID_TERM.stack());
|
||||
GameRegistry.addShapelessRecipe(AE2_LEVEL_EMITTER, FLUID_LEVEL_EMITTER.stack());
|
||||
GameRegistry.addShapelessRecipe(AE2_PATTERN_TERM, FLUID_TERMINAL.stack());
|
||||
GameRegistry.addShapelessRecipe(AE2_PATTERN_TERM_EX, FLUID_TERMINAL_EX.stack());
|
||||
|
||||
if (Config.fluidCells) {
|
||||
OreDictionary.registerOre("anyCertusCrystal", AE2_PURE_CERTUS);
|
||||
for (ItemStack it : OreDictionary.getOres("crystalCertusQuartz"))
|
||||
@@ -746,7 +710,8 @@ public class RecipeLoader implements Runnable {
|
||||
}
|
||||
|
||||
ItemStack[] term = { AE2_WIRELESS_TERMINAL, WIRELESS_PATTERN_TERM.stack(), WIRELESS_INTERFACE_TERM.stack(),
|
||||
WIRELESS_LEVEL_TERM.stack(), WCT_WIRELESS_TERM };
|
||||
WIRELESS_LEVEL_TERM.stack(),
|
||||
ModAndClassUtil.WCT ? GameRegistry.findItemStack("ae2wct", "wirelessCraftingTerminal", 1) : null };
|
||||
GameRegistry.addShapelessRecipe(
|
||||
WIRELESS_ULTRA_TERM.stack(),
|
||||
Arrays.stream(term).filter(Objects::nonNull).toArray());
|
||||
|
||||
@@ -4,11 +4,13 @@ import com.glodblock.github.client.render.ItemCertusQuartzTankRender;
|
||||
import com.glodblock.github.client.render.ItemDropRender;
|
||||
import com.glodblock.github.client.render.ItemPacketRender;
|
||||
import com.glodblock.github.client.render.ItemWalrusRender;
|
||||
import com.glodblock.github.client.render.WalrusRenderer;
|
||||
|
||||
public class RenderLoader implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
WalrusRenderer.load();
|
||||
new ItemDropRender();
|
||||
new ItemPacketRender();
|
||||
new ItemWalrusRender();
|
||||
|
||||
@@ -9,35 +9,41 @@ 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 net.p455w0rd.wirelesscraftingterminal.items.ItemInfinityBooster;
|
||||
|
||||
import com.glodblock.github.common.item.ItemBaseWirelessTerminal;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class WirelessTerminalRecipe extends ShapelessRecipes {
|
||||
|
||||
private static final ItemStack infinityBoosterCard = ItemEnum.BOOSTER_CARD.getStack();
|
||||
private static ItemStack infinityBoosterCard;
|
||||
private final ItemStack installedTerm;
|
||||
|
||||
public WirelessTerminalRecipe(ItemStack term) {
|
||||
super(term, Arrays.asList(term, infinityBoosterCard));
|
||||
super(term, Arrays.asList(term, getInfinityBoosterCard()));
|
||||
this.installedTerm = installInfinityBoosterCard(term);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inv, World w) {
|
||||
ItemStack term = inv.getStackInSlot(0);
|
||||
ItemStack infinityBoosterCard = inv.getStackInSlot(1);
|
||||
ItemStack card = inv.getStackInSlot(1);
|
||||
ItemStack recipeCard = getInfinityBoosterCard();
|
||||
return term != null && term.getItem() instanceof ItemBaseWirelessTerminal
|
||||
&& !hasInfinityBoosterCard(term)
|
||||
&& infinityBoosterCard != null
|
||||
&& infinityBoosterCard.getItem() instanceof ItemInfinityBooster;
|
||||
&& card != null
|
||||
&& recipeCard != null
|
||||
&& card.getItem() == recipeCard.getItem();
|
||||
}
|
||||
|
||||
public static ItemStack getInfinityBoosterCard() {
|
||||
return infinityBoosterCard.copy();
|
||||
if (!ModAndClassUtil.WCT) return null;
|
||||
if (infinityBoosterCard == null) {
|
||||
infinityBoosterCard = GameRegistry.findItemStack("ae2wct", "infinityBoosterCard", 1);
|
||||
}
|
||||
return infinityBoosterCard == null ? null : infinityBoosterCard.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -119,7 +119,12 @@ public class NEICellViewHandler implements IUsageHandler {
|
||||
final String usedBytes = Platform.formatByteDouble(cellHandler.getUsedBytes());
|
||||
final String totalBytes = Platform.formatByteDouble(cellHandler.getTotalBytes());
|
||||
fontRenderer.drawString(
|
||||
usedBytes + " " + GuiText.Of.getLocal() + ' ' + totalBytes + ' ' + GuiText.BytesUsed.getLocal(),
|
||||
usedBytes + " "
|
||||
+ GuiText.Of.getLocal()
|
||||
+ ' '
|
||||
+ totalBytes
|
||||
+ ' '
|
||||
+ GuiText.FromStoragePercent.getLocal(),
|
||||
OFFSET_X,
|
||||
INFO_OFFSET_Y,
|
||||
0);
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
package com.glodblock.github.nei;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
|
||||
public class NEIUtils {
|
||||
|
||||
public static List<OrderStack<?>> compress(List<OrderStack<?>> list) {
|
||||
List<OrderStack<?>> comp = new LinkedList<>();
|
||||
for (OrderStack<?> orderStack : list) {
|
||||
if (orderStack == null) continue;
|
||||
if (orderStack.getStack() instanceof FluidStack) {
|
||||
comp.add(orderStack);
|
||||
continue;
|
||||
}
|
||||
ItemStack currentStack = (ItemStack) orderStack.getStack();
|
||||
if (currentStack.stackSize == 0) continue;
|
||||
boolean find = false;
|
||||
for (OrderStack<?> storedStack : comp) {
|
||||
if (storedStack == null || !(storedStack.getStack() instanceof ItemStack firstStack)) continue;
|
||||
boolean areItemStackEqual = firstStack.isItemEqual(currentStack)
|
||||
&& ItemStack.areItemStackTagsEqual(firstStack, currentStack);
|
||||
if (areItemStackEqual
|
||||
&& (firstStack.stackSize + currentStack.stackSize) <= firstStack.getMaxStackSize()) {
|
||||
find = true;
|
||||
((ItemStack) storedStack.getStack()).stackSize = firstStack.stackSize + currentStack.stackSize;
|
||||
}
|
||||
}
|
||||
if (!find) {
|
||||
comp.add(orderStack);
|
||||
}
|
||||
}
|
||||
return comp.stream().filter(Objects::nonNull).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static List<OrderStack<?>> clearNull(List<OrderStack<?>> list) {
|
||||
AtomicInteger i = new AtomicInteger(0);
|
||||
return list.stream().filter(Objects::nonNull)
|
||||
.filter(
|
||||
orderStack -> !(orderStack.getStack() != null && orderStack.getStack() instanceof ItemStack
|
||||
&& ((ItemStack) orderStack.getStack()).stackSize == 0))
|
||||
.peek(orderStack -> orderStack.setIndex(i.getAndIncrement())).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.glodblock.github.nei.object;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
public interface IRecipeExtractor {
|
||||
|
||||
List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs);
|
||||
|
||||
List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs);
|
||||
|
||||
default List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs, IRecipeHandler recipe, int index) {
|
||||
return getInputIngredients(rawInputs);
|
||||
}
|
||||
|
||||
default List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs, IRecipeHandler recipe,
|
||||
int index) {
|
||||
return getOutputIngredients(rawOutputs);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.glodblock.github.nei.object;
|
||||
|
||||
public interface IRecipeExtractorLegacy extends IRecipeExtractor {
|
||||
|
||||
String getClassName();
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.glodblock.github.nei.object;
|
||||
|
||||
public class IllegalOrderStackID extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = -3782749325355674453L;
|
||||
|
||||
public IllegalOrderStackID(int id) {
|
||||
super("Illegal type id: " + id);
|
||||
}
|
||||
}
|
||||
@@ -1,146 +0,0 @@
|
||||
package com.glodblock.github.nei.object;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
|
||||
public class OrderStack<T> {
|
||||
|
||||
private T RealStack;
|
||||
private int index;
|
||||
private ItemStack[] items;
|
||||
|
||||
public static final int ITEM = 1;
|
||||
public static final int FLUID = 2;
|
||||
public static final int CUSTOM = 3;
|
||||
|
||||
public OrderStack(T stack, int order) {
|
||||
if (stack == null || order < 0)
|
||||
throw new IllegalArgumentException("Trying to create a null or negative order stack!");
|
||||
this.RealStack = stack;
|
||||
this.index = order;
|
||||
}
|
||||
|
||||
public OrderStack(T stack, int order, ItemStack[] items) {
|
||||
this(stack, order);
|
||||
if (items.length > 1) {
|
||||
this.items = items;
|
||||
}
|
||||
}
|
||||
|
||||
public void putStack(T stack) {
|
||||
this.RealStack = stack;
|
||||
}
|
||||
|
||||
public void putItems(ItemStack[] items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
public ItemStack[] getItems() {
|
||||
return this.items;
|
||||
}
|
||||
|
||||
public final void setIndex(int i) {
|
||||
this.index = i;
|
||||
}
|
||||
|
||||
public T getStack() {
|
||||
return RealStack;
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public static OrderStack<ItemStack> pack(PositionedStack stack, int index) {
|
||||
if (stack != null && stack.items != null && stack.items.length > 0) {
|
||||
if (Items.feather.getDamage(stack.items[0]) == OreDictionary.WILDCARD_VALUE) {
|
||||
ItemStack tmp = stack.items[0].copy();
|
||||
tmp.setItemDamage(0);
|
||||
return new OrderStack<>(tmp, index);
|
||||
} else return new OrderStack<>(stack.items[0].copy(), index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static OrderStack<?> packFluid(PositionedStack stack, int index) {
|
||||
if (stack != null && stack.items != null && stack.items.length > 0) {
|
||||
FluidStack fluid = Util.getFluidFromItem(stack.items[0]);
|
||||
if (fluid != null) return new OrderStack<>(fluid.copy(), index);
|
||||
else return pack(stack, index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void customNBTWriter(NBTTagCompound buf) {}
|
||||
|
||||
protected T customNBTReader(NBTTagCompound buf) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final void writeToNBT(NBTTagCompound buf) {
|
||||
if (RealStack instanceof ItemStack) {
|
||||
NBTTagCompound tmp = new NBTTagCompound();
|
||||
tmp.setByte("t", (byte) ITEM);
|
||||
Util.writeItemStackToNBT(((ItemStack) RealStack), tmp);
|
||||
// replacement items
|
||||
if (items != null) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
for (ItemStack is : this.items) {
|
||||
Util.writeItemStackToNBT(is, new NBTTagCompound());
|
||||
}
|
||||
tmp.setTag(index + ":", list);
|
||||
}
|
||||
buf.setTag(index + ":", tmp);
|
||||
} else if (RealStack instanceof FluidStack) {
|
||||
NBTTagCompound tmp = new NBTTagCompound();
|
||||
tmp.setByte("t", (byte) FLUID);
|
||||
((FluidStack) RealStack).writeToNBT(tmp);
|
||||
buf.setTag(index + ":", tmp);
|
||||
} else {
|
||||
NBTTagCompound tmp = new NBTTagCompound();
|
||||
tmp.setByte("t", (byte) CUSTOM);
|
||||
customNBTWriter(tmp);
|
||||
buf.setTag(index + ":", tmp);
|
||||
}
|
||||
}
|
||||
|
||||
public static OrderStack<?> readFromNBT(NBTTagCompound buf, @Nullable OrderStack<?> dummy, int index) {
|
||||
if (!buf.hasKey(index + ":")) return null;
|
||||
NBTTagCompound info = buf.getCompoundTag(index + ":");
|
||||
byte id = info.getByte("t");
|
||||
switch (id) {
|
||||
case ITEM -> {
|
||||
List<ItemStack> list = new ArrayList<>();
|
||||
if (info.hasKey(index + ":")) {
|
||||
NBTTagList items = info.getTagList(index + ":", 10);
|
||||
for (int x = 0; x < items.tagCount(); x++) {
|
||||
final NBTTagCompound item = items.getCompoundTagAt(x);
|
||||
list.add(Util.loadItemStackFromNBT(item));
|
||||
}
|
||||
}
|
||||
return new OrderStack<>(Util.loadItemStackFromNBT(info), index, list.toArray(new ItemStack[0]));
|
||||
}
|
||||
case FLUID -> {
|
||||
return new OrderStack<>(FluidStack.loadFluidStackFromNBT(info), index);
|
||||
}
|
||||
case CUSTOM -> {
|
||||
if (dummy == null) throw new IllegalOrderStackID(id);
|
||||
return new OrderStack<>(dummy.customNBTReader(buf), index);
|
||||
}
|
||||
default -> throw new IllegalOrderStackID(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
package com.glodblock.github.nei.recipes;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import com.glodblock.github.nei.recipes.extractor.AvaritiaRecipeExtractor;
|
||||
import com.glodblock.github.nei.recipes.extractor.EnderIORecipeExtractor;
|
||||
import com.glodblock.github.nei.recipes.extractor.ForestryRecipeExtractor;
|
||||
import com.glodblock.github.nei.recipes.extractor.GTPPRecipeExtractor;
|
||||
import com.glodblock.github.nei.recipes.extractor.GregTech5RecipeExtractor;
|
||||
import com.glodblock.github.nei.recipes.extractor.GregTech6RecipeExtractor;
|
||||
import com.glodblock.github.nei.recipes.extractor.IndustrialCraftRecipeExtractor;
|
||||
import com.glodblock.github.nei.recipes.extractor.VanillaRecipeExtractor;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
import forestry.factory.recipes.nei.NEIHandlerBottler;
|
||||
import forestry.factory.recipes.nei.NEIHandlerCarpenter;
|
||||
import forestry.factory.recipes.nei.NEIHandlerCentrifuge;
|
||||
import forestry.factory.recipes.nei.NEIHandlerFabricator;
|
||||
import forestry.factory.recipes.nei.NEIHandlerFermenter;
|
||||
import forestry.factory.recipes.nei.NEIHandlerMoistener;
|
||||
import forestry.factory.recipes.nei.NEIHandlerSqueezer;
|
||||
import forestry.factory.recipes.nei.NEIHandlerStill;
|
||||
import gregapi.recipes.Recipe;
|
||||
|
||||
public class DefaultExtractorLoader implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
FluidRecipe.addRecipeMap("smelting", new VanillaRecipeExtractor(false));
|
||||
FluidRecipe.addRecipeMap("brewing", new VanillaRecipeExtractor(false));
|
||||
FluidRecipe.addRecipeMap("crafting", new VanillaRecipeExtractor(true));
|
||||
FluidRecipe.addRecipeMap("crafting2x2", new VanillaRecipeExtractor(true));
|
||||
|
||||
if (ModAndClassUtil.GT5) {
|
||||
try {
|
||||
Class<?> recipeMapClazz = Class.forName("gregtech.api.util.GTRecipe$GT_Recipe_Map");
|
||||
Collection<?> sMappings = (Collection<?>) recipeMapClazz.getDeclaredField("sMappings").get(null);
|
||||
for (Object tMap : sMappings) {
|
||||
String mNEIName = (String) recipeMapClazz.getDeclaredField("mNEIName").get(tMap);
|
||||
FluidRecipe.addRecipeMap(
|
||||
mNEIName,
|
||||
new GregTech5RecipeExtractor(
|
||||
mNEIName.equals("gt.recipe.scanner")
|
||||
|| mNEIName.equals("gt.recipe.fakeAssemblylineProcess")));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (ModAndClassUtil.GT6) {
|
||||
for (Recipe.RecipeMap tMap : Recipe.RecipeMap.RECIPE_MAPS.values()) {
|
||||
FluidRecipe.addRecipeMap(tMap.mNameNEI, new GregTech6RecipeExtractor(tMap));
|
||||
}
|
||||
}
|
||||
|
||||
if (ModAndClassUtil.GTPP && !ModAndClassUtil.GT5NH) {
|
||||
try {
|
||||
Class<?> gtRecipeMapClazz = Class.forName("gregtech.api.util.GT_Recipe$GT_Recipe_Map");
|
||||
Class<?> gtppRecipeMapClazz = Class.forName("gregtech.api.util.GTPP_Recipe$GTPP_Recipe_Map_Internal");
|
||||
Collection<?> sMappingsEx = (Collection<?>) gtppRecipeMapClazz.getDeclaredField("sMappingsEx")
|
||||
.get(null);
|
||||
for (Object gtppMap : sMappingsEx) {
|
||||
boolean mNEIAllowed = gtRecipeMapClazz.getDeclaredField("mNEIAllowed").getBoolean(gtppMap);
|
||||
if (mNEIAllowed) {
|
||||
String mNEIName = (String) gtRecipeMapClazz.getDeclaredField("mNEIName").get(gtppMap);
|
||||
FluidRecipe.addRecipeMap(mNEIName, new GTPPRecipeExtractor());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (ModAndClassUtil.EIO) {
|
||||
FluidRecipe.addRecipeMap("EIOEnchanter", new EnderIORecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("EnderIOAlloySmelter", new EnderIORecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("EnderIOSagMill", new EnderIORecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("EnderIOSliceAndSplice", new EnderIORecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("EnderIOSoulBinder", new EnderIORecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("EnderIOVat", new EnderIORecipeExtractor());
|
||||
}
|
||||
|
||||
if (ModAndClassUtil.AVARITIA) {
|
||||
FluidRecipe.addRecipeMap("extreme", new AvaritiaRecipeExtractor());
|
||||
}
|
||||
|
||||
if (ModAndClassUtil.FTR) {
|
||||
// GTNH
|
||||
FluidRecipe.addRecipeMap("forestry.bottler", new ForestryRecipeExtractor(new NEIHandlerBottler()));
|
||||
FluidRecipe.addRecipeMap("forestry.carpenter", new ForestryRecipeExtractor(new NEIHandlerCarpenter()));
|
||||
FluidRecipe.addRecipeMap("forestry.centrifuge", new ForestryRecipeExtractor(new NEIHandlerCentrifuge()));
|
||||
FluidRecipe.addRecipeMap("forestry.fabricator", new ForestryRecipeExtractor(new NEIHandlerFabricator()));
|
||||
FluidRecipe.addRecipeMap("forestry.fermenter", new ForestryRecipeExtractor(new NEIHandlerFermenter()));
|
||||
FluidRecipe.addRecipeMap("forestry.moistener", new ForestryRecipeExtractor(new NEIHandlerMoistener()));
|
||||
FluidRecipe.addRecipeMap("forestry.squeezer", new ForestryRecipeExtractor(new NEIHandlerSqueezer()));
|
||||
FluidRecipe.addRecipeMap("forestry.still", new ForestryRecipeExtractor(new NEIHandlerStill()));
|
||||
|
||||
// LEGACY
|
||||
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerBottler()));
|
||||
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerCarpenter()));
|
||||
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerCentrifuge()));
|
||||
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerFabricator()));
|
||||
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerFermenter()));
|
||||
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerMoistener()));
|
||||
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerSqueezer()));
|
||||
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerStill()));
|
||||
}
|
||||
|
||||
if (ModAndClassUtil.IC2) {
|
||||
FluidRecipe.addRecipeMap("blastfurnace", new IndustrialCraftRecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("BlockCutter", new IndustrialCraftRecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("centrifuge", new IndustrialCraftRecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("compressor", new IndustrialCraftRecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("extractor", new IndustrialCraftRecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("fluidcanner", new IndustrialCraftRecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("macerator", new IndustrialCraftRecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("metalformer", new IndustrialCraftRecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("oreWashing", new IndustrialCraftRecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("solidcanner", new IndustrialCraftRecipeExtractor());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
package com.glodblock.github.nei.recipes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.glodblock.github.nei.object.IRecipeExtractor;
|
||||
import com.glodblock.github.nei.object.IRecipeExtractorLegacy;
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
public final class FluidRecipe {
|
||||
|
||||
private static final HashMap<String, IRecipeExtractor> IdentifierMap = new HashMap<>();
|
||||
private static final HashMap<String, IRecipeExtractor> IdentifierMapLegacy = new HashMap<>();
|
||||
|
||||
public static void addRecipeMap(String recipeIdentifier, IRecipeExtractor extractor) {
|
||||
IdentifierMap.put(recipeIdentifier, extractor);
|
||||
if (recipeIdentifier == null && extractor instanceof IRecipeExtractorLegacy) {
|
||||
IdentifierMapLegacy.put(((IRecipeExtractorLegacy) extractor).getClassName(), extractor);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<OrderStack<?>> getPackageInputs(IRecipeHandler recipe, int index, boolean priority) {
|
||||
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
|
||||
if (tRecipe == null) return new ArrayList<>();
|
||||
if (!IdentifierMap.containsKey(tRecipe.getOverlayIdentifier())) return getDefaultPackageInputs(tRecipe, index);
|
||||
if (tRecipe.getOverlayIdentifier() == null) return getPackageInputsLegacy(recipe, index);
|
||||
IRecipeExtractor extractor = IdentifierMap.get(tRecipe.getOverlayIdentifier());
|
||||
if (extractor == null) return new ArrayList<>();
|
||||
List<PositionedStack> tmp = new ArrayList<>(tRecipe.getIngredientStacks(index));
|
||||
List<OrderStack<?>> out = extractor.getInputIngredients(tmp, recipe, index);
|
||||
if (priority) {
|
||||
List<OrderStack<?>> reordered = new ArrayList<>();
|
||||
byte numFluids = 0;
|
||||
for (OrderStack<?> orderStack : out) {
|
||||
if (orderStack != null && orderStack.getStack() instanceof FluidStack) {
|
||||
reordered.add(new OrderStack<>(orderStack.getStack(), numFluids++));
|
||||
}
|
||||
}
|
||||
for (OrderStack<?> orderStack : out) {
|
||||
if (orderStack != null && orderStack.getStack() instanceof ItemStack) {
|
||||
reordered.add(new OrderStack<>(orderStack.getStack(), numFluids++));
|
||||
}
|
||||
}
|
||||
return reordered;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public static List<OrderStack<?>> getPackageOutputs(IRecipeHandler recipe, int index, boolean useOther) {
|
||||
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
|
||||
if (tRecipe == null) return new ArrayList<>();
|
||||
if (!IdentifierMap.containsKey(tRecipe.getOverlayIdentifier())) return getDefaultPackageOutputs(tRecipe, index);
|
||||
if (tRecipe.getOverlayIdentifier() == null) return getPackageOutputsLegacy(recipe, index, useOther);
|
||||
IRecipeExtractor extractor = IdentifierMap.get(tRecipe.getOverlayIdentifier());
|
||||
if (extractor == null) return new ArrayList<>();
|
||||
List<PositionedStack> tmp = new ArrayList<>(Collections.singleton(tRecipe.getResultStack(index)));
|
||||
if (useOther) tmp.addAll(tRecipe.getOtherStacks(index));
|
||||
return extractor.getOutputIngredients(tmp, recipe, index);
|
||||
}
|
||||
|
||||
public static List<String> getSupportRecipes() {
|
||||
return new ArrayList<>(IdentifierMap.keySet());
|
||||
}
|
||||
|
||||
public static List<OrderStack<?>> getPackageInputsLegacy(IRecipeHandler recipe, int index) {
|
||||
if (recipe == null || !IdentifierMapLegacy.containsKey(recipe.getClass().getName())) return new ArrayList<>();
|
||||
IRecipeExtractor extractor = IdentifierMapLegacy.get(recipe.getClass().getName());
|
||||
if (extractor == null) return new ArrayList<>();
|
||||
List<PositionedStack> tmp = new ArrayList<>(recipe.getIngredientStacks(index));
|
||||
return extractor.getInputIngredients(tmp, recipe, index);
|
||||
}
|
||||
|
||||
public static List<OrderStack<?>> getPackageOutputsLegacy(IRecipeHandler recipe, int index, boolean useOther) {
|
||||
if (recipe == null || !IdentifierMapLegacy.containsKey(recipe.getClass().getName())) return new ArrayList<>();
|
||||
IRecipeExtractor extractor = IdentifierMapLegacy.get(recipe.getClass().getName());
|
||||
if (extractor == null) return new ArrayList<>();
|
||||
List<PositionedStack> tmp = new ArrayList<>(Collections.singleton(recipe.getResultStack(index)));
|
||||
if (useOther) tmp.addAll(recipe.getOtherStacks(index));
|
||||
return extractor.getOutputIngredients(tmp, recipe, index);
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.glodblock.github.nei.recipes.extractor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.glodblock.github.nei.NEIUtils;
|
||||
import com.glodblock.github.nei.object.IRecipeExtractor;
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
public class AvaritiaRecipeExtractor implements IRecipeExtractor {
|
||||
|
||||
public AvaritiaRecipeExtractor() {}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs, IRecipeHandler recipe, int index) {
|
||||
return getInputIngredients(rawInputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs, IRecipeHandler recipe,
|
||||
int index) {
|
||||
return getOutputIngredients(rawOutputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
||||
return NEIUtils.compress(ExtractorUtil.packItemStack(rawInputs));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
||||
return ExtractorUtil.packItemStack(rawOutputs);
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
package com.glodblock.github.nei.recipes.extractor;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.glodblock.github.nei.object.IRecipeExtractor;
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
import com.glodblock.github.util.Ae2Reflect;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import crazypants.enderio.machine.crusher.CrusherRecipeManager;
|
||||
import crazypants.enderio.nei.VatRecipeHandler;
|
||||
|
||||
public class EnderIORecipeExtractor implements IRecipeExtractor {
|
||||
|
||||
public EnderIORecipeExtractor() {}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
||||
return ExtractorUtil.packItemStack(rawInputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
||||
return ExtractorUtil.packItemStack(rawOutputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs, IRecipeHandler recipe, int index) {
|
||||
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
|
||||
List<OrderStack<?>> tmp;
|
||||
if (tRecipe.arecipes.get(index) instanceof VatRecipeHandler.InnerVatRecipe vatRecipe) {
|
||||
ArrayList<PositionedStack> inputs = ReflectEIO.getInputs(vatRecipe);
|
||||
tmp = ExtractorUtil.packItemStack(inputs);
|
||||
FluidStack in = ReflectEIO.getInputFluid(vatRecipe);
|
||||
if (in != null) {
|
||||
tmp.add(new OrderStack<>(in, inputs.size()));
|
||||
}
|
||||
return tmp;
|
||||
} else if (tRecipe.getOverlayIdentifier().equals("EnderIOSagMill")) {
|
||||
for (int i = rawInputs.size() - 1; i >= 0; i--) {
|
||||
PositionedStack stack = rawInputs.get(i);
|
||||
if (stack != null && CrusherRecipeManager.getInstance().isValidSagBall(stack.items[0])) {
|
||||
rawInputs.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return getInputIngredients(rawInputs);
|
||||
} else {
|
||||
return getInputIngredients(rawInputs);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs, IRecipeHandler recipe,
|
||||
int index) {
|
||||
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
|
||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||
if (tRecipe.arecipes.get(index) instanceof VatRecipeHandler.InnerVatRecipe vatRecipe) {
|
||||
FluidStack result = ReflectEIO.getResult(vatRecipe);
|
||||
if (result != null) {
|
||||
tmp.add(new OrderStack<>(result, 0));
|
||||
}
|
||||
return tmp;
|
||||
} else {
|
||||
return getOutputIngredients(rawOutputs);
|
||||
}
|
||||
}
|
||||
|
||||
private static class ReflectEIO {
|
||||
|
||||
private static final Field inputsF;
|
||||
private static final Field resultF;
|
||||
private static final Field inFluidF;
|
||||
|
||||
static {
|
||||
try {
|
||||
inputsF = Ae2Reflect.reflectField(VatRecipeHandler.InnerVatRecipe.class, "inputs");
|
||||
resultF = Ae2Reflect.reflectField(VatRecipeHandler.InnerVatRecipe.class, "result");
|
||||
inFluidF = Ae2Reflect.reflectField(VatRecipeHandler.InnerVatRecipe.class, "inFluid");
|
||||
} catch (NoSuchFieldException e) {
|
||||
throw new IllegalStateException("Failed to initialize EIO reflection hacks!", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static ArrayList<PositionedStack> getInputs(VatRecipeHandler.InnerVatRecipe vat) {
|
||||
return Ae2Reflect.readField(vat, inputsF);
|
||||
}
|
||||
|
||||
private static FluidStack getResult(VatRecipeHandler.InnerVatRecipe vat) {
|
||||
return Ae2Reflect.readField(vat, resultF);
|
||||
}
|
||||
|
||||
private static FluidStack getInputFluid(VatRecipeHandler.InnerVatRecipe vat) {
|
||||
return Ae2Reflect.readField(vat, inFluidF);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.glodblock.github.nei.recipes.extractor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
|
||||
public final class ExtractorUtil {
|
||||
|
||||
public static List<OrderStack<?>> packItemStack(List<PositionedStack> items) {
|
||||
AtomicInteger index = new AtomicInteger(-1);
|
||||
return items.stream().map(item -> {
|
||||
index.getAndIncrement();
|
||||
return OrderStack.pack(item, index.get());
|
||||
}).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static List<OrderStack<?>> packItemStack(List<PositionedStack> items,
|
||||
Function<PositionedStack, Object> transformer) {
|
||||
AtomicInteger index = new AtomicInteger(-1);
|
||||
return items.stream().map(item -> {
|
||||
index.getAndIncrement();
|
||||
Object o = transformer.apply(item);
|
||||
return o != null ? new OrderStack<>(o, index.get(), item.items) : null;
|
||||
}).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package com.glodblock.github.nei.recipes.extractor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.glodblock.github.nei.object.IRecipeExtractorLegacy;
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import forestry.core.recipes.nei.PositionedFluidTank;
|
||||
import forestry.core.recipes.nei.RecipeHandlerBase;
|
||||
import forestry.factory.recipes.nei.NEIHandlerFabricator;
|
||||
import forestry.factory.recipes.nei.NEIHandlerSqueezer;
|
||||
|
||||
public class ForestryRecipeExtractor implements IRecipeExtractorLegacy {
|
||||
|
||||
private final IRecipeHandler handler;
|
||||
|
||||
public ForestryRecipeExtractor(IRecipeHandler recipes) {
|
||||
handler = recipes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getClassName() {
|
||||
return handler.getClass().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
||||
return ExtractorUtil.packItemStack(rawInputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
||||
return ExtractorUtil.packItemStack(rawOutputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs, IRecipeHandler recipe, int index) {
|
||||
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
|
||||
List<OrderStack<?>> tmp = new ArrayList<>();
|
||||
if (tRecipe.arecipes.get(index) instanceof RecipeHandlerBase.CachedBaseRecipe) {
|
||||
tmp = getInputIngredients(rawInputs);
|
||||
List<PositionedFluidTank> tanks = ((RecipeHandlerBase.CachedBaseRecipe) tRecipe.arecipes.get(index))
|
||||
.getFluidTanks();
|
||||
if (tanks.size() > 0 && !(handler instanceof NEIHandlerSqueezer)) {
|
||||
FluidStack fluid = tanks.get(0).tank.getFluid();
|
||||
if (fluid != null) {
|
||||
tmp.add(new OrderStack<>(fluid, rawInputs.size()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs, IRecipeHandler recipe,
|
||||
int index) {
|
||||
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
|
||||
removeGlass(rawOutputs);
|
||||
List<OrderStack<?>> tmp = new ArrayList<>();
|
||||
if (tRecipe.arecipes.get(index) instanceof RecipeHandlerBase.CachedBaseRecipe) {
|
||||
tmp = getOutputIngredients(rawOutputs);
|
||||
List<PositionedFluidTank> tanks = ((RecipeHandlerBase.CachedBaseRecipe) tRecipe.arecipes.get(index))
|
||||
.getFluidTanks();
|
||||
if (tanks.size() > 0 && handler instanceof NEIHandlerSqueezer) {
|
||||
FluidStack fluid = tanks.get(0).tank.getFluid();
|
||||
if (fluid != null) {
|
||||
tmp.add(new OrderStack<>(fluid, rawOutputs.size()));
|
||||
}
|
||||
} else if (tanks.size() > 1) {
|
||||
FluidStack fluid = tanks.get(1).tank.getFluid();
|
||||
if (fluid != null) {
|
||||
tmp.add(new OrderStack<>(fluid, rawOutputs.size()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
private void removeGlass(List<PositionedStack> list) {
|
||||
if (handler instanceof NEIHandlerFabricator) {
|
||||
list.remove(list.size() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.glodblock.github.nei.recipes.extractor;
|
||||
|
||||
public class GTPPRecipeExtractor extends GregTech5RecipeExtractor {
|
||||
|
||||
public GTPPRecipeExtractor() {
|
||||
super(false);
|
||||
}
|
||||
}
|
||||
-62
@@ -1,62 +0,0 @@
|
||||
package com.glodblock.github.nei.recipes.extractor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.glodblock.github.nei.object.IRecipeExtractor;
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import gregtech.api.enums.ItemList;
|
||||
import gregtech.common.items.ItemFluidDisplay;
|
||||
|
||||
public class GregTech5RecipeExtractor implements IRecipeExtractor {
|
||||
|
||||
boolean removeSpecial;
|
||||
|
||||
public GregTech5RecipeExtractor(boolean removeSpecial) {
|
||||
this.removeSpecial = removeSpecial;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
||||
if (removeSpecial) removeSpecial(rawInputs);
|
||||
return ExtractorUtil.packItemStack(rawInputs, GregTech5RecipeExtractor::getFluidFromDisplay);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
||||
return ExtractorUtil.packItemStack(rawOutputs, GregTech5RecipeExtractor::getFluidFromDisplay);
|
||||
}
|
||||
|
||||
private void removeSpecial(List<PositionedStack> list) {
|
||||
for (int i = list.size() - 1; i >= 0; i--) {
|
||||
PositionedStack positionedStack = list.get(i);
|
||||
if (positionedStack != null && (positionedStack.items[0].isItemEqual(ItemList.Tool_DataStick.get(1))
|
||||
|| positionedStack.items[0].isItemEqual(ItemList.Tool_DataOrb.get(1)))) {
|
||||
list.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Object getFluidFromDisplay(PositionedStack stack) {
|
||||
if (stack != null) {
|
||||
ItemStack item = stack.items[0].copy();
|
||||
if (item.getItem() instanceof ItemFluidDisplay) {
|
||||
if (item.getTagCompound() != null) {
|
||||
Fluid fluid = FluidRegistry.getFluid(item.getItemDamage());
|
||||
int amt = (int) item.getTagCompound().getLong("mFluidDisplayAmount");
|
||||
return amt > 0 && fluid != null ? new FluidStack(fluid, amt) : null;
|
||||
}
|
||||
} else {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Loaded 100 of 305 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user