mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-23 05:19:49 +00:00
Compare commits
67
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c1de99049c | ||
|
|
31533e96df | ||
|
|
7124e812d1 | ||
|
|
edac0cdec6 | ||
|
|
3b67b77572 | ||
|
|
208e4d66d9 | ||
|
|
1aba13e96f | ||
|
|
dd05ae29c1 | ||
|
|
44dfa4d551 | ||
|
|
0a84d208f3 | ||
|
|
4a030a52b6 | ||
|
|
ead0aff1ae | ||
|
|
04d80384b2 | ||
|
|
1b5680d2fd | ||
|
|
0bccb9bc5c | ||
|
|
caf1b282a7 | ||
|
|
1f2613b331 | ||
|
|
a7bf25fcf0 | ||
|
|
07ce2fd1ea | ||
|
|
387c740dcb | ||
|
|
31a9034b8e | ||
|
|
a108986cbb | ||
|
|
abecbe8506 | ||
|
|
36671559a8 | ||
|
|
9c50bb0d70 | ||
|
|
d89a67d3db | ||
|
|
a684a07d7c | ||
|
|
ac0e0de363 | ||
|
|
f98e44d106 | ||
|
|
e66050c78d | ||
|
|
4313dbb4e0 | ||
|
|
fda338525e | ||
|
|
d69e7559cf | ||
|
|
fc2507477a | ||
|
|
e372300ced | ||
|
|
18f337c193 | ||
|
|
1e98b07ed5 | ||
|
|
184c4be4f2 | ||
|
|
a5f030223e | ||
|
|
1bca87de0c | ||
|
|
ed8a9f8372 | ||
|
|
e338176386 | ||
|
|
d97285ba52 | ||
|
|
a7fdb3ce7e | ||
|
|
62117facd5 | ||
|
|
59e596b0ba | ||
|
|
dfabc1c62b | ||
|
|
f02e72e96a | ||
|
|
c13cd0492a | ||
|
|
6160248ab3 | ||
|
|
16d18145b5 | ||
|
|
a93ddd5191 | ||
|
|
f3c3a81681 | ||
|
|
1ea9b2e410 | ||
|
|
cf189f00a3 | ||
|
|
a121342a4b | ||
|
|
e62215f02b | ||
|
|
f4c6d8a3f0 | ||
|
|
72a068b6d6 | ||
|
|
58cdd446a7 | ||
|
|
af032179f6 | ||
|
|
9732625ced | ||
|
|
f23d792b91 | ||
|
|
f6c3227cd9 | ||
|
|
20f03a8e9f | ||
|
|
341f1d9236 | ||
|
|
0f68feb0be |
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
|
||||
+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.43-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-762-GTNH:dev')
|
||||
api('curse.maven:cofh-core-69162:2388751')
|
||||
api('com.github.GTNewHorizons:waila:1.9.15:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.8.34:dev")
|
||||
api('com.github.GTNewHorizons:NotEnoughItems:2.8.102-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-983-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:waila:1.19.30:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.11.15:dev")
|
||||
|
||||
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.12.11:dev") {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
|
||||
}
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.4-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.21-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.60:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.35:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.2:dev')
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.10:dev')
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.52.152:dev') {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework'
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.26:dev')
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.31:dev')
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.45-GTNH:dev') { transitive = false }
|
||||
|
||||
compileOnly("org.jetbrains:annotations:26.1.0")
|
||||
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.4.2: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.8-GTNH:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.7.16-GTNH:dev') { transitive = false }
|
||||
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.4.0:dev")
|
||||
}
|
||||
+31
-4
@@ -39,9 +39,33 @@ remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/co
|
||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||
developmentEnvironmentUserName = Developer
|
||||
|
||||
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
||||
# See https://github.com/bsideup/jabel for details on how this works.
|
||||
enableModernJavaSyntax = true
|
||||
# Enables modern Java syntax support. Valid values:
|
||||
# - false: No modern syntax, Java 8 only
|
||||
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
|
||||
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
|
||||
# - modern: Native modern Java bytecode, no downgrading
|
||||
enableModernJavaSyntax = jabel
|
||||
|
||||
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
|
||||
# and should *not* be used in most situations. -1 disables this.
|
||||
# forceToolchainVersion = -1
|
||||
|
||||
# Target JVM version for JVM Downgrader bytecode downgrading.
|
||||
# Only used when enableModernJavaSyntax = jvmDowngrader
|
||||
# downgradeTargetVersion = 8
|
||||
|
||||
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
|
||||
# Classes will be available in META-INF/versions/N/ for each version N in this list.
|
||||
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
|
||||
# jvmDowngraderMultiReleaseVersions = 21,25
|
||||
|
||||
# Specifies how JVM Downgrader API stubs are provided. Options:
|
||||
# - shade: Shade minimized stubs into the jar
|
||||
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
|
||||
# - external: Another dependency provides stubs (no constraint, no warning)
|
||||
# - (empty): Warning reminding you to configure stubs
|
||||
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
|
||||
# jvmDowngraderStubsProvider =
|
||||
|
||||
# Enables injecting missing generics into the decompiled source code for a better coding experience.
|
||||
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
|
||||
@@ -104,7 +128,7 @@ mixinsPackage =
|
||||
# Specify the core mod entry class if you use a core mod. This class must implement IFMLLoadingPlugin!
|
||||
# This parameter is for legacy compatibility only
|
||||
# Example value: (coreModClass = asm.FMLPlugin) + (modGroup = com.myname.mymodid) -> com.myname.mymodid.asm.FMLPlugin
|
||||
coreModClass = coremod.FluidCraftCore
|
||||
coreModClass =
|
||||
|
||||
# If your project is only a consolidation of mixins or a core mod and does NOT contain a 'normal' mod ( = some class
|
||||
# that is annotated with @Mod) you want this to be true. When in doubt: leave it on false!
|
||||
@@ -209,3 +233,6 @@ curseForgeRelations =
|
||||
# This is meant to be set in $HOME/.gradle/gradle.properties.
|
||||
# ideaCheckSpotlessOnBuild = true
|
||||
|
||||
# Non-GTNH properties
|
||||
org.gradle.configuration-cache = true
|
||||
org.gradle.parallel = true
|
||||
@@ -0,0 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/c2dd35c9d0aaf0ba6ad0791320f99dfc/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/e5810bd7fd1f8a586644409d395a7e55/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/cf726b4a1c84b50457225f9bba6d7650/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/fa1e318c287360478e3c83a9a3ef1007/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/7b3c4877c0749019e6805bb61e421497/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/d76df094a9cbbabd3b08251f9e61444a/redirect
|
||||
toolchainVersion=25
|
||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.0-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@@ -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/b631911858264c0b6e4d6603d677ff5218766cee/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/.
|
||||
@@ -114,7 +114,6 @@ case "$( uname )" in #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH="\\\"\\\""
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@@ -172,7 +171,6 @@ fi
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
@@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
|
||||
Vendored
+1
-2
@@ -70,11 +70,10 @@ goto fail
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.48'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.26'
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.glodblock.github.common.Config;
|
||||
import com.glodblock.github.crossmod.opencomputers.OCDriverInit;
|
||||
import com.glodblock.github.crossmod.waila.WailaInit;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.glodblock.github.loader.CalculatorV2PluginLoader;
|
||||
import com.glodblock.github.loader.ChannelLoader;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.loader.RecipeLoader;
|
||||
@@ -25,7 +24,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";
|
||||
@@ -74,10 +73,6 @@ public class FluidCraft {
|
||||
RecipeLoader.runTerminalRecipe();
|
||||
RecipeLoader.addDisassembleRecipe();
|
||||
|
||||
if (ModAndClassUtil.isV2) {
|
||||
CalculatorV2PluginLoader.installCalculatorV2Plugins();
|
||||
}
|
||||
|
||||
proxy.postInit(event);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.Set;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
import com.glodblock.github.api.registries.ILevelTerminalRegistry;
|
||||
import com.glodblock.github.coremod.registries.LevelTerminalRegistry;
|
||||
import com.glodblock.github.util.LevelTerminalRegistry;
|
||||
|
||||
public final class FluidCraftAPI implements IFluidCraftAPI {
|
||||
|
||||
|
||||
@@ -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,7 +65,7 @@ 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(30, "MAGNET_CARD", "INV", "magnet_card.inv");
|
||||
this.registerApp(30, "MAGNET_CARD", "ME", "magnet_card.me");
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@@ -51,13 +49,6 @@ public class GuiFluidInterface extends GuiSub {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_146977_a(final Slot s) {
|
||||
try {
|
||||
GuiContainer.class.getDeclaredMethod("func_146977_a_original", Slot.class).invoke(this, s);
|
||||
} catch (final Exception ignore) {}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
|
||||
fontRendererObj.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_FLUID_INTERFACE)), 8, 6, 0x404040);
|
||||
|
||||
@@ -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;
|
||||
@@ -24,12 +25,12 @@ import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.features.LevelState;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.client.gui.GuiSub;
|
||||
import appeng.client.gui.slots.VirtualMEPhantomSlot;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.util.calculators.ArithHelper;
|
||||
import appeng.util.calculators.Calculator;
|
||||
import cofh.core.render.CoFHFontRenderer;
|
||||
|
||||
public class GuiLevelMaintainer extends GuiSub {
|
||||
|
||||
@@ -38,14 +39,14 @@ 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;
|
||||
|
||||
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(),
|
||||
@@ -61,7 +62,8 @@ public class GuiLevelMaintainer extends GuiSub {
|
||||
27,
|
||||
20 + i * 19,
|
||||
this.cont.getTile().getAEStackInventory(),
|
||||
i);
|
||||
i,
|
||||
GuiLevelMaintainer::acceptType);
|
||||
slot.setShowAmount(true);
|
||||
slot.setShowAmountAlways(true);
|
||||
this.registerVirtualSlots(slot);
|
||||
@@ -82,7 +84,7 @@ public class GuiLevelMaintainer extends GuiSub {
|
||||
new GuiFCImgButton(guiLeft + 105 + 47, guiTop + 17 + 19 * i, "SUBMIT", "SUBMIT", false),
|
||||
new GuiFCImgButton(guiLeft + 9, guiTop + 20 + 19 * i, "ENABLE", "ENABLE", false),
|
||||
new GuiFCImgButton(guiLeft + 9, guiTop + 20 + 19 * i, "DISABLE", "DISABLE", false),
|
||||
new FCGuiLineField(fontRendererObj, guiLeft + 47, guiTop + 33 + 19 * i, 125),
|
||||
new FCGuiLineField(fontRendererObj, guiLeft + 47, guiTop + 33 + 19 * i, 120),
|
||||
this.buttonList,
|
||||
this.cont);
|
||||
}
|
||||
@@ -129,19 +131,15 @@ public class GuiLevelMaintainer extends GuiSub {
|
||||
@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);
|
||||
}
|
||||
@@ -162,12 +160,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) {
|
||||
@@ -193,6 +227,10 @@ public class GuiLevelMaintainer extends GuiSub {
|
||||
component[index].setState(state);
|
||||
}
|
||||
|
||||
private static boolean acceptType(VirtualMEPhantomSlot slot, IAEStackType<?> type, int mouseButton) {
|
||||
return true;
|
||||
}
|
||||
|
||||
private class Component {
|
||||
|
||||
public boolean isEnable = false;
|
||||
@@ -301,43 +339,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));
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -94,7 +92,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
|
||||
private ItemStack tooltipStack;
|
||||
private boolean online;
|
||||
private final boolean neiPresent;
|
||||
private int viewHeight;
|
||||
|
||||
protected GuiTabButton craftingStatusBtn;
|
||||
@@ -115,9 +112,8 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
public GuiLevelTerminal(InventoryPlayer inventoryPlayer, Container container) {
|
||||
super(inventoryPlayer, container);
|
||||
setScrollBar(new GuiScrollbar());
|
||||
xSize = 208;
|
||||
xSize = 209;
|
||||
ySize = 255;
|
||||
neiPresent = Loader.isModLoaded("NotEnoughItems");
|
||||
|
||||
searchFieldOutputs = new MEGuiTextField(86, 12, ButtonToolTips.SearchFieldOutputs.getLocal()) {
|
||||
|
||||
@@ -183,14 +179,14 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
terminalStyleBox.xPosition = guiLeft - 18;
|
||||
terminalStyleBox.yPosition = guiTop + 8;
|
||||
craftingStatusBtn = new GuiTabButton(
|
||||
guiLeft + xSize - 24,
|
||||
guiLeft + xSize - 25,
|
||||
guiTop - 4,
|
||||
2 + 11 * 16,
|
||||
GuiText.CraftingStatus.getLocal(),
|
||||
itemRender);
|
||||
craftingStatusBtn.setHideEdge(13);
|
||||
|
||||
if (ModAndClassUtil.isSearchBar && (AEConfig.instance.preserveSearchBar || isSubGui())) {
|
||||
if (AEConfig.instance.preserveSearchBar || isSubGui()) {
|
||||
setSearchString();
|
||||
}
|
||||
buttonList.add(terminalStyleBox);
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -290,7 +286,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;
|
||||
@@ -398,7 +394,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,10 +498,10 @@ 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;
|
||||
}
|
||||
@@ -515,7 +511,16 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
// draw a tooltip
|
||||
GL11.glTranslatef(0f, 0f, TOOLTIP_Z);
|
||||
GL11.glDisable(GL11.GL_SCISSOR_TEST);
|
||||
drawHoveringText(Arrays.asList(toRender.getMessage()), relMouseX, relMouseY);
|
||||
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"));
|
||||
}
|
||||
drawHoveringText(tooltip, relMouseX, relMouseY);
|
||||
GL11.glTranslatef(0f, 0f, -TOOLTIP_Z);
|
||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
}
|
||||
@@ -557,11 +562,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,7 +584,7 @@ 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();
|
||||
@@ -588,7 +593,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
} 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) {
|
||||
@@ -1188,8 +1193,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 +1214,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 +1233,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 +1242,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,
|
||||
|
||||
@@ -1,101 +1,105 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
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 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 VirtualMEPhantomSlotPrecise[] configFluidsSlots = new VirtualMEPhantomSlotPrecise[9];
|
||||
private final VirtualMEPhantomSlotPrecise[] configItemsSlots = new VirtualMEPhantomSlotPrecise[63];
|
||||
|
||||
public GuiSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockReplenisher tile) {
|
||||
super(new ContainerSuperStockReplenisher(ipl, tile));
|
||||
|
||||
this.containerSuperStockReplenisher = (ContainerSuperStockReplenisher) inventorySlots;
|
||||
|
||||
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.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 +108,15 @@ 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);
|
||||
this.drawVirtualSlots();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -118,4 +128,9 @@ public class GuiSuperStockReplenisher extends AEBaseGui {
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -16,12 +16,12 @@ import org.jetbrains.annotations.Nullable;
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.base.FCBaseContainer;
|
||||
import com.glodblock.github.common.parts.PartLevelTerminal;
|
||||
import com.glodblock.github.coremod.registries.LevelTerminalRegistry;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.item.IWirelessTerminal;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.network.SPacketLevelTerminalUpdate;
|
||||
import com.glodblock.github.util.FluidPrimaryGui;
|
||||
import com.glodblock.github.util.LevelTerminalRegistry;
|
||||
|
||||
import appeng.api.features.ILevelViewable;
|
||||
import appeng.api.features.LevelItemInfo;
|
||||
@@ -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]);
|
||||
|
||||
+42
-101
@@ -3,63 +3,57 @@ 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.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.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.container.sync.SyncManager;
|
||||
import appeng.container.sync.handlers.AEStackInventorySyncHandler;
|
||||
import appeng.items.storage.ItemBasicStorageCell;
|
||||
import appeng.tile.inventory.IAEStackInventory;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
|
||||
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 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.addSlotToContainer(
|
||||
new SlotRestrictedInput(
|
||||
@@ -67,56 +61,33 @@ 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);
|
||||
}
|
||||
|
||||
@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) {
|
||||
@@ -125,20 +96,16 @@ public class ContainerSuperStockReplenisher extends AEBaseContainer
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -167,10 +134,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 +144,18 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import com.glodblock.github.util.Util;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public abstract class FCBaseContainer extends AEBaseContainer {
|
||||
|
||||
@@ -37,7 +38,7 @@ public abstract class FCBaseContainer extends AEBaseContainer {
|
||||
if (isWirelessTerminal()) {
|
||||
if (this.host instanceof IFluidPortableCell) {
|
||||
final int slotIndex = ((IFluidPortableCell) this.host).getInventorySlot();
|
||||
if (Util.GuiHelper.decodeInvType(slotIndex).getLeft() == Util.GuiHelper.InvType.PLAYER_INV) {
|
||||
if (slotIndex <= Platform.baublesSlotsOffset) {
|
||||
this.lockPlayerInventorySlot(slotIndex);
|
||||
}
|
||||
return slotIndex;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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,12 @@ 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");
|
||||
|
||||
private final String name;
|
||||
public net.minecraft.util.IIcon IIcon;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.glodblock.github.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
@@ -47,15 +46,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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,17 @@
|
||||
package com.glodblock.github.common.item;
|
||||
|
||||
import static appeng.util.item.AEFluidStackType.FLUID_STACK_TYPE;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.glodblock.github.common.storage.CellType;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.items.AEBaseCell;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public abstract class FCBaseItemCell extends AEBaseCell {
|
||||
|
||||
@@ -24,8 +27,8 @@ public abstract class FCBaseItemCell extends AEBaseCell {
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getStorageChannel() {
|
||||
return StorageChannel.FLUIDS;
|
||||
public @NotNull IAEStackType<?> getStackType() {
|
||||
return FLUID_STACK_TYPE;
|
||||
}
|
||||
|
||||
public FCBaseItemCell(Optional subName) {
|
||||
@@ -49,18 +52,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());
|
||||
|
||||
@@ -1,17 +1,24 @@
|
||||
package com.glodblock.github.common.item;
|
||||
|
||||
import static appeng.util.item.AEFluidStackType.FLUID_STACK_TYPE;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
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.storage.StorageChannel;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.items.AEBaseInfiniteCell;
|
||||
import appeng.me.storage.CreativeCellInventory;
|
||||
import appeng.me.storage.FluidCellInventoryHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class ItemCreativeFluidStorageCell extends AEBaseInfiniteCell
|
||||
@@ -42,7 +49,12 @@ public class ItemCreativeFluidStorageCell extends AEBaseInfiniteCell
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getStorageChannel() {
|
||||
return StorageChannel.FLUIDS;
|
||||
public @NotNull IAEStackType<?> getStackType() {
|
||||
return FLUID_STACK_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventoryHandler getCellInventory(ItemStack stack) {
|
||||
return new FluidCellInventoryHandler(new CreativeCellInventory<>(stack));
|
||||
}
|
||||
}
|
||||
+16
-9
@@ -3,10 +3,12 @@ package com.glodblock.github.common.item;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.parts.PartFluidConversionMonitor;
|
||||
import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
import com.glodblock.github.common.parts.PartFluidAnnihilationPlane;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
@@ -16,27 +18,32 @@ 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.PartFluidAnnihilationPlane.getIcon();
|
||||
}
|
||||
|
||||
public void registerIcons(IIconRegister _iconRegister) {}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -45,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
|
||||
|
||||
+16
-9
@@ -3,10 +3,12 @@ package com.glodblock.github.common.item;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.parts.PartFluidStorageMonitor;
|
||||
import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
import com.glodblock.github.common.parts.PartFluidFormationPlane;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
@@ -16,27 +18,32 @@ 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.PartFluidFormationPlane.getIcon();
|
||||
}
|
||||
|
||||
public void registerIcons(IIconRegister _iconRegister) {}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -45,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) {
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.glodblock.github.common.item;
|
||||
|
||||
import static appeng.util.item.AEFluidStackType.FLUID_STACK_TYPE;
|
||||
|
||||
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.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.items.storage.ItemVoidStorageCell;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
@@ -25,7 +27,7 @@ public class ItemFluidVoidStorageCell extends ItemVoidStorageCell implements IRe
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getStorageChannel() {
|
||||
return StorageChannel.FLUIDS;
|
||||
public IAEStackType<?> getStackType() {
|
||||
return FLUID_STACK_TYPE;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,26 @@
|
||||
package com.glodblock.github.common.item;
|
||||
|
||||
import static appeng.util.item.AEFluidStackType.FLUID_STACK_TYPE;
|
||||
import static com.glodblock.github.util.Util.FluidUtil.water_bucket;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
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 com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.items.AEBaseInfiniteCell;
|
||||
import appeng.me.storage.CreativeCellInventory;
|
||||
import appeng.me.storage.FluidCellInventoryHandler;
|
||||
import appeng.tile.inventory.IAEStackInventory;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
@@ -62,7 +68,12 @@ public class ItemInfinityWaterStorageCell extends AEBaseInfiniteCell
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getStorageChannel() {
|
||||
return StorageChannel.FLUIDS;
|
||||
public @NotNull IAEStackType<?> getStackType() {
|
||||
return FLUID_STACK_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventoryHandler getCellInventory(ItemStack stack) {
|
||||
return new FluidCellInventoryHandler(new CreativeCellInventory<>(stack));
|
||||
}
|
||||
}
|
||||
@@ -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!");
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,13 @@
|
||||
package com.glodblock.github.common.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
@@ -34,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
|
||||
@@ -54,4 +58,15 @@ public class ItemPartFluidStorageBus extends FCBaseItem implements IPartItem {
|
||||
public int getSpriteNumber() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List<String> lines, boolean advanced) {
|
||||
super.addInformation(stack, player, lines, advanced);
|
||||
if (stack.hasTagCompound() && stack.getTagCompound().hasKey("priority")) {
|
||||
int priority = stack.getTagCompound().getInteger("priority");
|
||||
String priorityText = StatCollector
|
||||
.translateToLocalFormatted("gui.tooltips.appliedenergistics2.PreconfiguredPriority", priority);
|
||||
lines.add(EnumChatFormatting.GRAY + priorityText);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,5 +1,7 @@
|
||||
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;
|
||||
@@ -9,6 +11,8 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.api.FluidCraftAPI;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
@@ -17,9 +21,9 @@ import com.glodblock.github.util.NameConst;
|
||||
import com.glodblock.github.util.RenderUtil;
|
||||
|
||||
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.items.AEBasePortableCell;
|
||||
import appeng.items.contents.CellUpgrades;
|
||||
import appeng.items.contents.PortableCellViewer;
|
||||
@@ -79,12 +83,12 @@ public class ItemPortableFluidCell extends AEBasePortableCell implements IRegist
|
||||
@Override
|
||||
public IGuiItemObject getGuiObject(final ItemStack is, final World w, final EntityPlayer p, final int x,
|
||||
final int y, final int z) {
|
||||
return new PortableCellViewer<IAEFluidStack>(is, x, StorageChannel.FLUIDS);
|
||||
return new PortableCellViewer<IAEFluidStack>(is, x, FLUID_STACK_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getStorageChannel() {
|
||||
return StorageChannel.FLUIDS;
|
||||
public @NotNull IAEStackType<?> getStackType() {
|
||||
return FLUID_STACK_TYPE;
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package com.glodblock.github.common.item;
|
||||
|
||||
import static appeng.util.Platform.baublesSlotsOffset;
|
||||
import static appeng.util.Platform.nextEnum;
|
||||
import static com.glodblock.github.util.Util.GuiHelper.decodeInvType;
|
||||
import static net.minecraft.client.gui.GuiScreen.isShiftKeyDown;
|
||||
|
||||
import java.util.Arrays;
|
||||
@@ -138,8 +137,7 @@ public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
|
||||
private void openGui(final ItemStack is, final World w, final EntityPlayer player, final Object mode,
|
||||
final int slotIndex) {
|
||||
final GuiBridge aeGui;
|
||||
final int slot = slotIndex == Integer.MIN_VALUE ? player.inventory.currentItem : slotIndex;
|
||||
final ImmutablePair<Util.GuiHelper.InvType, Integer> invSlotPair = decodeInvType(slotIndex);
|
||||
final int slot = slotIndex == Integer.MIN_VALUE ? player.inventory.currentItem : slotIndex;;
|
||||
|
||||
switch (mode instanceof UltraTerminalModes utm ? utm : getMode(is)) {
|
||||
case CRAFTING -> aeGui = GuiBridge.GUI_CRAFTING_TERMINAL;
|
||||
@@ -161,13 +159,7 @@ public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
|
||||
default -> aeGui = GuiBridge.GUI_ME;
|
||||
}
|
||||
|
||||
Platform.openGUI(
|
||||
player,
|
||||
null,
|
||||
null,
|
||||
aeGui,
|
||||
invSlotPair.getLeft() == Util.GuiHelper.InvType.PLAYER_INV ? slotIndex
|
||||
: invSlotPair.getRight() + baublesSlotsOffset);
|
||||
Platform.openGUI(player, null, null, aeGui, slotIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -175,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) {
|
||||
@@ -191,12 +174,7 @@ public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
|
||||
if (handler != null) {
|
||||
for (int i = 0; i < handler.getSizeInventory(); ++i) {
|
||||
if (handler.getStackInSlot(i) == itemStack) {
|
||||
onUpdate(
|
||||
itemStack,
|
||||
null,
|
||||
player,
|
||||
Util.GuiHelper.encodeType(i, Util.GuiHelper.InvType.PLAYER_BAUBLES),
|
||||
false);
|
||||
onUpdate(itemStack, null, player, i + baublesSlotsOffset, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
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) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -1,157 +1,28 @@
|
||||
package com.glodblock.github.common.parts;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import static appeng.util.item.AEFluidStackType.FLUID_STACK_TYPE;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidContainerItem;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import org.apache.commons.lang3.tuple.MutablePair;
|
||||
import appeng.parts.reporting.PartConversionMonitor;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.security.PlayerSource;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class PartFluidConversionMonitor extends PartFluidStorageMonitor {
|
||||
public class PartFluidConversionMonitor extends PartConversionMonitor {
|
||||
|
||||
public PartFluidConversionMonitor(ItemStack is) {
|
||||
super(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPartShiftActivate(final EntityPlayer player, final Vec3 pos) {
|
||||
if (Platform.isClient()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!this.getProxy().isActive()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Platform.hasPermissions(this.getLocation(), player)) {
|
||||
return false;
|
||||
}
|
||||
FluidStack fluidStack;
|
||||
ItemStack item = player.getCurrentEquippedItem();
|
||||
if (item != null && item.getItem() instanceof ItemFluidPacket) {
|
||||
fluidStack = ItemFluidPacket.getFluidStack(item);
|
||||
} else {
|
||||
fluidStack = Util.FluidUtil.getFluidFromContainer(item);
|
||||
}
|
||||
if (this.getDisplayed() == null || fluidStack == null
|
||||
|| fluidStack.getFluid() != ((IAEFluidStack) this.getDisplayed()).getFluid()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try {
|
||||
if (!this.getProxy().isActive()) {
|
||||
return false;
|
||||
public void readFromNBT(NBTTagCompound data) {
|
||||
// Migrate old tag
|
||||
if (data.hasKey("configuredItem")) {
|
||||
final NBTTagCompound myItem = data.getCompoundTag("configuredItem");
|
||||
if (!myItem.hasNoTags() && !myItem.hasKey("StackType")) {
|
||||
myItem.setString("StackType", FLUID_STACK_TYPE.getId());
|
||||
}
|
||||
final IEnergySource energy = this.getProxy().getEnergy();
|
||||
final IMEMonitor<IAEFluidStack> cell = this.getProxy().getStorage().getFluidInventory();
|
||||
final IAEFluidStack input = (IAEFluidStack) this.getDisplayed().copy().setStackSize(fluidStack.amount);
|
||||
final IAEFluidStack failedToInsert = Platform
|
||||
.poweredInsert(energy, cell, input, new PlayerSource(player, this));
|
||||
if (failedToInsert != null && failedToInsert.getStackSize() == input.getStackSize()) {
|
||||
return false;
|
||||
} else if (failedToInsert == null || failedToInsert.getStackSize() != input.getStackSize()) {
|
||||
if (item.getItem() instanceof ItemFluidPacket) {
|
||||
if (failedToInsert != null) {
|
||||
player.getCurrentEquippedItem()
|
||||
.setTagCompound(ItemFluidPacket.newStack(failedToInsert).getTagCompound());
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
ItemStack tmp = item.copy();
|
||||
tmp.stackSize = 1;
|
||||
ItemStack tank = null;
|
||||
if (failedToInsert == null) {
|
||||
tank = Util.FluidUtil.clearFluid(tmp);
|
||||
} else {
|
||||
if (tmp.getItem() instanceof IFluidContainerItem) {
|
||||
tank = Util.FluidUtil.setFluidContainerAmount(tmp, (int) failedToInsert.getStackSize());
|
||||
} else if (FluidContainerRegistry.isContainer(tmp)) {
|
||||
IAEFluidStack insertedFluid = input.copy();
|
||||
insertedFluid.decStackSize(failedToInsert.getStackSize());
|
||||
this.getProxy().getStorage().getFluidInventory()
|
||||
.extractItems(insertedFluid, Actionable.MODULATE, new PlayerSource(player, this));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (tank != null && !player.inventory.addItemStackToInventory(tank)) {
|
||||
player.entityDropItem(tank, 0);
|
||||
}
|
||||
}
|
||||
item.stackSize--;
|
||||
if (item.stackSize <= 0) {
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (final GridAccessException ignored) {}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void extractItem(final EntityPlayer player) {
|
||||
final IAEFluidStack input = (IAEFluidStack) this.getDisplayed();
|
||||
ItemStack eq = player.getCurrentEquippedItem();
|
||||
if (input != null && Util.FluidUtil.isFluidContainer(eq) && Util.FluidUtil.isEmpty(eq)) {
|
||||
try {
|
||||
if (!this.getProxy().isActive()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final IEnergySource energy = this.getProxy().getEnergy();
|
||||
final IMEMonitor<IAEFluidStack> cell = this.getProxy().getStorage().getFluidInventory();
|
||||
ItemStack tank = eq.copy();
|
||||
tank.stackSize = 1;
|
||||
MutablePair<Integer, ItemStack> fillStack = Util.FluidUtil.fillStack(tank, input.getFluidStack());
|
||||
input.setStackSize(fillStack.left);
|
||||
|
||||
final IAEFluidStack retrieved = Platform
|
||||
.poweredExtraction(energy, cell, input, new PlayerSource(player, this));
|
||||
if (retrieved != null) {
|
||||
if (!player.inventory.addItemStackToInventory(fillStack.right)) {
|
||||
player.entityDropItem(fillStack.right.copy(), 0);
|
||||
}
|
||||
eq.stackSize--;
|
||||
if (eq.stackSize <= 0) {
|
||||
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
|
||||
}
|
||||
final InventoryAdaptor adaptor = InventoryAdaptor.getAdaptor(player, ForgeDirection.UNKNOWN);
|
||||
ItemStack newItems = adaptor.addItems(
|
||||
Util.FluidUtil.setFluidContainerAmount(fillStack.right, (int) retrieved.getStackSize()));
|
||||
if (newItems != null) {
|
||||
final TileEntity te = this.getTile();
|
||||
final List<ItemStack> list = Collections.singletonList(newItems);
|
||||
Platform.spawnDrops(
|
||||
player.worldObj,
|
||||
te.xCoord + this.getSide().offsetX,
|
||||
te.yCoord + this.getSide().offsetY,
|
||||
te.zCoord + this.getSide().offsetZ,
|
||||
list);
|
||||
}
|
||||
|
||||
if (player.openContainer != null) {
|
||||
player.openContainer.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
}
|
||||
|
||||
super.readFromNBT(data);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
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 net.minecraft.util.IIcon;
|
||||
@@ -15,6 +17,7 @@ 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.me.GridAccessException;
|
||||
import appeng.parts.automation.PartBaseExportBus;
|
||||
import appeng.tile.inventory.IAEStackInventory;
|
||||
@@ -33,7 +36,7 @@ public class PartFluidExportBus extends PartBaseExportBus<IAEFluidStack> {
|
||||
|
||||
@Override
|
||||
protected int getAdaptorFlags() {
|
||||
return InventoryAdaptor.DEFAULT & ~InventoryAdaptor.ALLOW_ITEMS;
|
||||
return InventoryAdaptor.ALLOW_FLUIDS | InventoryAdaptor.FOR_INSERTS;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,18 +75,18 @@ public class PartFluidExportBus extends PartBaseExportBus<IAEFluidStack> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doFuzzy(IAEFluidStack aes, FuzzyMode fzMode, InventoryAdaptor destination, IEnergyGrid energy,
|
||||
protected void doFuzzy(IAEFluidStack aes, FuzzyMode fzMode, IEnergyGrid energy,
|
||||
IMEMonitor<IAEFluidStack> gridInv) {}
|
||||
|
||||
@Override
|
||||
protected void doOreDict(InventoryAdaptor destination, IEnergyGrid energy, IMEMonitor<IAEFluidStack> gridInv) {}
|
||||
protected void doOreDict(IEnergyGrid energy, IMEMonitor<IAEFluidStack> gridInv) {}
|
||||
|
||||
// legacy
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound extra) {
|
||||
super.readFromNBT(extra);
|
||||
|
||||
final IAEStackInventory config = this.getAEInventoryByName(StorageName.NONE);
|
||||
final IAEStackInventory config = this.getAEInventoryByName(StorageName.CONFIG);
|
||||
for (int i = 0; i < config.getSizeInventory(); i++) {
|
||||
final IAEStack<?> stack = config.getAEStackInSlot(i);
|
||||
if (stack instanceof IAEItemStack ais) {
|
||||
@@ -91,4 +94,9 @@ public class PartFluidExportBus extends PartBaseExportBus<IAEFluidStack> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEStackType<IAEFluidStack> getStackType() {
|
||||
return FLUID_STACK_TYPE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
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() {
|
||||
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,16 +1,16 @@
|
||||
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 net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
@@ -23,9 +23,11 @@ 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.me.GridAccessException;
|
||||
import appeng.parts.automation.PartBaseImportBus;
|
||||
import appeng.tile.inventory.IAEStackInventory;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
|
||||
public class PartFluidImportBus extends PartBaseImportBus<IAEFluidStack> {
|
||||
@@ -41,18 +43,14 @@ public class PartFluidImportBus extends PartBaseImportBus<IAEFluidStack> {
|
||||
|
||||
@Override
|
||||
protected Object getTarget() {
|
||||
TileEntity self = this.getHost().getTile();
|
||||
return this.getTileEntity(self, (new BlockPos(self)).getOffSet(this.getSide()));
|
||||
}
|
||||
final TileEntity self = this.getHost().getTile();
|
||||
final TileEntity target = this.getTileEntity(
|
||||
self,
|
||||
self.xCoord + this.getSide().offsetX,
|
||||
self.yCoord + this.getSide().offsetY,
|
||||
self.zCoord + this.getSide().offsetZ);
|
||||
|
||||
private TileEntity getTileEntity(final TileEntity self, final BlockPos pos) {
|
||||
final World w = self.getWorldObj();
|
||||
|
||||
if (w.getChunkProvider().chunkExists(pos.getX() >> 4, pos.getZ() >> 4)) {
|
||||
return w.getTileEntity(pos.getX(), pos.getY(), pos.getZ());
|
||||
}
|
||||
|
||||
return null;
|
||||
return target instanceof IFluidHandler handler ? handler : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -90,6 +88,11 @@ public class PartFluidImportBus extends PartBaseImportBus<IAEFluidStack> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getAdaptorFlags() {
|
||||
return InventoryAdaptor.ALLOW_FLUIDS | InventoryAdaptor.FOR_EXTRACTS;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean importStuff(final Object myTarget, final IAEFluidStack whatToImport,
|
||||
final IMEMonitor<IAEFluidStack> inv, final IEnergySource energy, final FuzzyMode fzMode) {
|
||||
@@ -97,13 +100,12 @@ public class PartFluidImportBus extends PartBaseImportBus<IAEFluidStack> {
|
||||
FluidTankInfo[] tanksInfo = fh.getTankInfo(this.getSide().getOpposite());
|
||||
if (tanksInfo == null) return true;
|
||||
|
||||
int maxDrain = this.calculateAmountToSend();
|
||||
boolean doBreak = true;
|
||||
|
||||
for (FluidTankInfo tankInfo : tanksInfo) {
|
||||
if (tankInfo.fluid == null) continue;
|
||||
|
||||
FluidStack fluidStack = new FluidStack(tankInfo.fluid, Math.min(tankInfo.fluid.amount, maxDrain));
|
||||
FluidStack fluidStack = new FluidStack(
|
||||
tankInfo.fluid,
|
||||
Math.min(tankInfo.fluid.amount, this.itemToSend));
|
||||
fluidStack = fh.drain(this.getSide().getOpposite(), fluidStack, false);
|
||||
if (this.filterEnabled() && !this.isInFilter(fluidStack)) continue;
|
||||
|
||||
@@ -112,18 +114,16 @@ public class PartFluidImportBus extends PartBaseImportBus<IAEFluidStack> {
|
||||
final IAEFluidStack notInserted = inv.injectItems(aeFluidStack, Actionable.MODULATE, this.mySrc);
|
||||
|
||||
if (notInserted != null && notInserted.getStackSize() > 0) {
|
||||
if (notInserted.getFluidStack().amount == aeFluidStack.getFluidStack().amount) continue;
|
||||
aeFluidStack.decStackSize(notInserted.getStackSize());
|
||||
}
|
||||
|
||||
fh.drain(this.getSide().getOpposite(), aeFluidStack.getFluidStack(), true);
|
||||
maxDrain -= aeFluidStack.getFluidStack().amount;
|
||||
doBreak = false;
|
||||
this.itemToSend -= aeFluidStack.getFluidStack().amount;
|
||||
this.worked = true;
|
||||
}
|
||||
}
|
||||
|
||||
return doBreak;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ public class PartFluidImportBus extends PartBaseImportBus<IAEFluidStack> {
|
||||
}
|
||||
|
||||
private boolean isInFilter(FluidStack fluid) {
|
||||
final IAEStackInventory inv = this.getAEInventoryByName(StorageName.NONE);
|
||||
final IAEStackInventory inv = this.getAEInventoryByName(StorageName.CONFIG);
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
final IAEFluidStack stack = (IAEFluidStack) inv.getAEStackInSlot(i);
|
||||
if (stack != null && stack.getFluidStack().equals(fluid)) {
|
||||
@@ -150,7 +150,7 @@ public class PartFluidImportBus extends PartBaseImportBus<IAEFluidStack> {
|
||||
}
|
||||
|
||||
private boolean filterEnabled() {
|
||||
final IAEStackInventory inv = this.getAEInventoryByName(StorageName.NONE);
|
||||
final IAEStackInventory inv = this.getAEInventoryByName(StorageName.CONFIG);
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
final IAEFluidStack stack = (IAEFluidStack) inv.getAEStackInSlot(i);
|
||||
if (stack != null) {
|
||||
@@ -165,7 +165,7 @@ public class PartFluidImportBus extends PartBaseImportBus<IAEFluidStack> {
|
||||
public void readFromNBT(NBTTagCompound extra) {
|
||||
super.readFromNBT(extra);
|
||||
|
||||
final IAEStackInventory config = this.getAEInventoryByName(StorageName.NONE);
|
||||
final IAEStackInventory config = this.getAEInventoryByName(StorageName.CONFIG);
|
||||
for (int i = 0; i < config.getSizeInventory(); i++) {
|
||||
final IAEStack<?> stack = config.getAEStackInSlot(i);
|
||||
if (stack instanceof IAEItemStack ais) {
|
||||
@@ -173,4 +173,9 @@ public class PartFluidImportBus extends PartBaseImportBus<IAEFluidStack> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEStackType<IAEFluidStack> getStackType() {
|
||||
return FLUID_STACK_TYPE;
|
||||
}
|
||||
}
|
||||
@@ -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,12 +16,15 @@ 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;
|
||||
|
||||
@@ -27,11 +35,14 @@ 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.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 +61,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 +95,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());
|
||||
@@ -124,6 +158,20 @@ public class PartFluidInterface extends PartInterface implements IDualHost, ICus
|
||||
getInternalFluid().writeToNBT(data, "FluidInv");
|
||||
}
|
||||
|
||||
@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 int getInstalledUpgrades(final Upgrades u) {
|
||||
return getInterfaceDuality().getInstalledUpgrades(u);
|
||||
|
||||
@@ -1,29 +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.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(null).getAEStackInSlot(0);
|
||||
if (aes instanceof IAEItemStack ais && ais.getItem() instanceof ItemFluidPacket) {
|
||||
this.getAEInventoryByName(null).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,12 +17,15 @@ 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;
|
||||
|
||||
@@ -25,7 +33,9 @@ import appeng.api.implementations.items.IMemoryCard;
|
||||
import appeng.api.networking.IGridNode;
|
||||
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.IConfigManager;
|
||||
import appeng.helpers.DualityInterface;
|
||||
import appeng.helpers.ICustomButtonDataObject;
|
||||
@@ -34,6 +44,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 +61,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 +87,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 +100,24 @@ 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 TickingRequest getTickingRequest(IGridNode node) {
|
||||
TickingRequest item = duality.getTickingRequest(node);
|
||||
@@ -147,6 +187,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());
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
package com.glodblock.github.common.parts;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import static appeng.util.item.AEFluidStackType.FLUID_STACK_TYPE;
|
||||
|
||||
import appeng.api.storage.StorageChannel;
|
||||
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;
|
||||
|
||||
public class PartFluidStorageBus extends PartStorageBus {
|
||||
@@ -12,7 +21,23 @@ public class PartFluidStorageBus extends PartStorageBus {
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getStorageChannel() {
|
||||
return StorageChannel.FLUIDS;
|
||||
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,36 +1,28 @@
|
||||
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.common.parts.base.FCPartMonitor;
|
||||
import appeng.parts.reporting.PartStorageMonitor;
|
||||
|
||||
import appeng.client.texture.CableBusTextures;
|
||||
import appeng.helpers.Reflected;
|
||||
public class PartFluidStorageMonitor extends PartStorageMonitor {
|
||||
|
||||
public class PartFluidStorageMonitor extends FCPartMonitor {
|
||||
|
||||
private static final CableBusTextures FRONT_BRIGHT_ICON = CableBusTextures.PartStorageMonitor_Bright;
|
||||
private static final CableBusTextures FRONT_DARK_ICON = CableBusTextures.PartStorageMonitor_Dark;
|
||||
private static final CableBusTextures FRONT_COLORED_ICON = CableBusTextures.PartStorageMonitor_Colored;
|
||||
private static final CableBusTextures FRONT_COLORED_ICON_LOCKED = CableBusTextures.PartStorageMonitor_Colored_Locked;
|
||||
|
||||
@Reflected
|
||||
public PartFluidStorageMonitor(final ItemStack is) {
|
||||
public PartFluidStorageMonitor(ItemStack is) {
|
||||
super(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CableBusTextures getFrontBright() {
|
||||
return FRONT_BRIGHT_ICON;
|
||||
}
|
||||
public void readFromNBT(NBTTagCompound data) {
|
||||
// Migrate old tag
|
||||
if (data.hasKey("configuredItem")) {
|
||||
final NBTTagCompound myItem = data.getCompoundTag("configuredItem");
|
||||
if (!myItem.hasNoTags() && !myItem.hasKey("StackType")) {
|
||||
myItem.setString("StackType", FLUID_STACK_TYPE.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CableBusTextures getFrontColored() {
|
||||
return this.isLocked() ? FRONT_COLORED_ICON_LOCKED : FRONT_COLORED_ICON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CableBusTextures getFrontDark() {
|
||||
return FRONT_DARK_ICON;
|
||||
super.readFromNBT(data);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -24,7 +24,6 @@ import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SortDir;
|
||||
import appeng.api.config.SortOrder;
|
||||
import appeng.api.config.TypeFilter;
|
||||
import appeng.api.config.ViewItems;
|
||||
import appeng.api.implementations.IPowerChannelState;
|
||||
import appeng.api.implementations.tiles.IViewCellStorage;
|
||||
@@ -84,7 +83,6 @@ public abstract class FCPart extends AEBasePart
|
||||
this.cm.registerSetting(Settings.SORT_BY, SortOrder.NAME);
|
||||
this.cm.registerSetting(Settings.VIEW_MODE, ViewItems.ALL);
|
||||
this.cm.registerSetting(Settings.SORT_DIRECTION, SortDir.ASCENDING);
|
||||
this.cm.registerSetting(Settings.TYPE_FILTER, TypeFilter.ALL);
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
|
||||
@@ -70,20 +70,25 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
return mainTank.drain(fluid, amount, doDrain, false);
|
||||
}
|
||||
|
||||
Fluid currentFluid = this.getFluid();
|
||||
if (currentFluid == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
FluidStack drainedFluid = this.tank.drain(amount, doDrain);
|
||||
int drained = drainedFluid != null ? drainedFluid.amount : 0;
|
||||
|
||||
if (drained > 0) {
|
||||
if (doDrain && drained > 0) {
|
||||
update();
|
||||
}
|
||||
|
||||
if (drained < amount) {
|
||||
TileCertusQuartzTank tankBelow = this.getTankBelow();
|
||||
if (tankBelow != null) {
|
||||
FluidStack externallyDrained = tankBelow.drain(fluid, amount - drained, doDrain, false);
|
||||
FluidStack externallyDrained = tankBelow.drain(currentFluid, amount - drained, doDrain, false);
|
||||
|
||||
if (externallyDrained != null) {
|
||||
return new FluidStack(fluid, drained + externallyDrained.amount);
|
||||
return new FluidStack(currentFluid, drained + externallyDrained.amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -100,7 +105,7 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
return drain(null, maxDrain, true, true);
|
||||
return drain(null, maxDrain, doDrain, true);
|
||||
}
|
||||
|
||||
public int fill(FluidStack fluid, boolean doFill, boolean findMainTank) {
|
||||
@@ -131,7 +136,7 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
|
||||
int filled = this.tank.fill(fluid, doFill);
|
||||
|
||||
if (filled > 0) {
|
||||
if (doFill && filled > 0) {
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
@@ -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,12 +17,15 @@ 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;
|
||||
|
||||
@@ -32,7 +38,9 @@ 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.IAEStackType;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.helpers.ICustomButtonDataObject;
|
||||
import appeng.helpers.ICustomButtonProvider;
|
||||
@@ -40,6 +48,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 +107,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);
|
||||
@@ -163,6 +189,20 @@ public class TileFluidInterface extends TileInterface implements IDualHost, ICus
|
||||
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) {
|
||||
|
||||
@@ -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) };
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,6 @@ import org.jetbrains.annotations.Nullable;
|
||||
import com.glodblock.github.common.Config;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.crossmod.thaumcraft.ThaumicEnergisticsCrafting;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -45,11 +44,10 @@ 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.StorageName;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.core.AELog;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.tile.TileEvent;
|
||||
@@ -99,30 +97,35 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectCraftedItems(ICraftingLink link, IAEItemStack items, Actionable mode) {
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public IAEStack<?> injectCraftedItems(ICraftingLink link, IAEStack<?> stack, Actionable mode) {
|
||||
int idx = this.getRequestIndexByLink(link);
|
||||
|
||||
try {
|
||||
if (getProxy().isActive()) {
|
||||
final IEnergyGrid energy = getProxy().getEnergy();
|
||||
final double power = Math
|
||||
.ceil(ItemFluidDrop.isFluidStack(items) ? items.getStackSize() / 1000D : items.getStackSize());
|
||||
if (energy.extractAEPower(power, mode, PowerMultiplier.CONFIG) > power - 0.01) {
|
||||
if (ItemFluidDrop.isFluidStack(items)) {
|
||||
IAEFluidStack notInjectedItems = getProxy().getStorage().getFluidInventory()
|
||||
.injectItems(ItemFluidDrop.getAeFluidStack(items), mode, source);
|
||||
if (notInjectedItems != null) {
|
||||
items.setStackSize(notInjectedItems.getStackSize());
|
||||
if (idx != -1) {
|
||||
this.updateState(idx, LevelState.Export);
|
||||
}
|
||||
final double power = Math.ceil((double) stack.getStackSize() / stack.getAmountPerUnit());
|
||||
|
||||
return items;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
if (energy.extractAEPower(power, mode, PowerMultiplier.CONFIG) > power - 0.01) {
|
||||
IMEMonitor monitor = getProxy().getStorage().getMEMonitor(stack.getStackType());
|
||||
if (monitor == null) return stack;
|
||||
|
||||
IAEStack<?> notInjected;
|
||||
if (stack instanceof IAEItemStack ais && ItemFluidDrop.isFluidStack(ais)) {
|
||||
notInjected = getProxy().getStorage().getFluidInventory()
|
||||
.injectItems(ItemFluidDrop.getAeFluidStack(ais), mode, source);
|
||||
} else {
|
||||
return getProxy().getStorage().getItemInventory().injectItems(items, mode, source);
|
||||
notInjected = monitor.injectItems(stack, mode, source);
|
||||
}
|
||||
|
||||
if (notInjected != null) {
|
||||
if (idx != -1) {
|
||||
this.updateState(idx, LevelState.Export);
|
||||
}
|
||||
|
||||
return notInjected;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,7 +133,7 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
AELog.debug(e);
|
||||
}
|
||||
|
||||
return items;
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -162,8 +165,6 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
try {
|
||||
final ICraftingGrid craftingGrid = getProxy().getCrafting();
|
||||
final IGrid grid = getProxy().getGrid();
|
||||
final IItemList<IAEItemStack> invItems = getProxy().getStorage().getItemInventory().getStorageList();
|
||||
final IItemList<IAEFluidStack> invFluid = getProxy().getStorage().getFluidInventory().getStorageList();
|
||||
|
||||
// Check there are available crafting CPUs before doing any work.
|
||||
// This hopefully stops level maintainers busy-looping calculating
|
||||
@@ -196,32 +197,17 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
continue;
|
||||
}
|
||||
|
||||
IAEStack<?> aeItem = null;
|
||||
|
||||
IAEStack<?> craftItem = requests[i].stack.copy();
|
||||
craftItem.setStackSize(batchSize);
|
||||
IMEMonitor monitor = getProxy().getStorage().getMEMonitor(craftItem.getStackType());
|
||||
if (monitor == null) continue;
|
||||
|
||||
if (craftItem instanceof IAEItemStack ais) {
|
||||
if (ModAndClassUtil.ThE && ThaumicEnergisticsCrafting.isAspectStack(ais.getItemStack())) {
|
||||
aeItem = ThaumicEnergisticsCrafting.convertAspectStack(ais);
|
||||
} else {
|
||||
aeItem = invItems.findPrecise(ais);
|
||||
}
|
||||
} else if (craftItem instanceof IAEFluidStack afs) {
|
||||
aeItem = invFluid.findPrecise(afs);
|
||||
}
|
||||
IAEStack<?> stackInStorage = monitor.getStorageList().findPrecise(craftItem);
|
||||
|
||||
long stackSize = aeItem == null ? 0 : aeItem.getStackSize();
|
||||
|
||||
if (ModAndClassUtil.ThE) {
|
||||
if (aeItem instanceof IAEItemStack ais
|
||||
&& ThaumicEnergisticsCrafting.isAspectStack(ais.getItemStack())) {
|
||||
stackSize = ThaumicEnergisticsCrafting.getEssentiaAmount(ais, grid);
|
||||
}
|
||||
}
|
||||
long stackSize = stackInStorage == null ? 0 : stackInStorage.getStackSize();
|
||||
|
||||
boolean isDone = this.isDone(i);
|
||||
boolean isCraftable = aeItem != null && aeItem.isCraftable();
|
||||
boolean isCraftable = stackInStorage != null && stackInStorage.isCraftable();
|
||||
boolean shouldCraft = isCraftable && stackSize < quantity;
|
||||
|
||||
if (isDone) {
|
||||
@@ -240,11 +226,11 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
continue;
|
||||
}
|
||||
|
||||
if (craftingGrid.canEmitFor(aeItem)) {
|
||||
if (craftingGrid.canEmitFor(stackInStorage)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (craftingGrid.isRequesting(aeItem)) {
|
||||
if (craftingGrid.isRequesting(stackInStorage)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -289,7 +275,7 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
// No jobs to submit, start calculating some item.
|
||||
|
||||
requests[itemToBeginIdx].job = craftingGrid
|
||||
.beginCraftingJob(getWorldObj(), grid, source, itemToBegin, null);
|
||||
.beginCraftingJob(this.worldObj, grid, source, itemToBegin, null);
|
||||
this.updateState(itemToBeginIdx, LevelState.Craft);
|
||||
|
||||
// Try the next item next time.
|
||||
@@ -644,6 +630,10 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
if (stack == null) {
|
||||
throw new IllegalArgumentException("ItemStack cannot be null!");
|
||||
}
|
||||
|
||||
// Migrate old aspect stack
|
||||
stack = ThaumicEnergisticsCrafting.convertItemAspectStack(stack);
|
||||
|
||||
quantity = tag.getLong(NBT_QUANTITY);
|
||||
batchSize = tag.getLong(NBT_BATCH);
|
||||
enable = tag.getBoolean(NBT_ENABLE);
|
||||
@@ -660,6 +650,10 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
|
||||
public void loadFromNBT(NBTTagCompound tag) {
|
||||
stack = Platform.readStackNBT(tag.getCompoundTag(NBT_STACK), true);
|
||||
|
||||
// Migrate old aspect stack
|
||||
stack = ThaumicEnergisticsCrafting.convertItemAspectStack(stack);
|
||||
|
||||
quantity = tag.getLong(NBT_QUANTITY);
|
||||
batchSize = tag.getLong(NBT_BATCH);
|
||||
enable = tag.getBoolean(NBT_ENABLE);
|
||||
|
||||
@@ -15,12 +15,16 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.glodblock.github.common.item.FCBaseItemCell;
|
||||
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;
|
||||
@@ -36,8 +40,10 @@ 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.DimensionalCoord;
|
||||
import appeng.api.util.IConfigManager;
|
||||
@@ -47,28 +53,50 @@ 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 {
|
||||
|
||||
private final AppEngInternalInventory cell = new AppEngInternalInventory(this, 1);
|
||||
private final AppEngInternalInventory invItems = new AppEngInternalInventory(this, 63);
|
||||
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 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 IAEStackInventory configItems = new IAEStackInventory(this, 63, StorageName.CONFIG);
|
||||
private final BaseActionSource source;
|
||||
private boolean isPowered;
|
||||
private long totalBytes;
|
||||
private long storedFluidCount;
|
||||
private long storedItemCount;
|
||||
|
||||
private boolean needReCountStoredFluids = true;
|
||||
private boolean needReCountStoredItems = true;
|
||||
|
||||
public TileSuperStockReplenisher() {
|
||||
super(false);
|
||||
getProxy().setIdlePowerUsage(4D);
|
||||
getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
|
||||
this.source = new MachineSource(this);
|
||||
@@ -76,18 +104,28 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
}
|
||||
|
||||
private TickRateModulation doWork() {
|
||||
this.fletchFluids();
|
||||
this.fletchItems();
|
||||
|
||||
this.needReCountStoredFluids = true;
|
||||
this.needReCountStoredItems = true;
|
||||
|
||||
return TickRateModulation.SAME;
|
||||
}
|
||||
|
||||
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();
|
||||
long confSize = ifs.getStackSize();
|
||||
if (invSize < confSize / 2f) {
|
||||
fs.setStackSize(confSize - invSize);
|
||||
requestFluid(fs, i);
|
||||
ifs.setStackSize(confSize - invSize);
|
||||
requestFluid(ifs, i);
|
||||
} else if (invSize > confSize) {
|
||||
returnFluid(i, invSize - confSize);
|
||||
}
|
||||
@@ -98,13 +136,14 @@ 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 confSize = (int) is.getStackSize();
|
||||
@@ -121,8 +160,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) {
|
||||
@@ -159,19 +218,23 @@ 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) {
|
||||
tempStack.stackSize = tempStack.stackSize + (int) notInserted.getStackSize();
|
||||
storedItemCount += notInserted.getStackSize();
|
||||
|
||||
saveChanges();
|
||||
} else invItems.setInventorySlotContents(index, notInserted.getItemStack());
|
||||
|
||||
this.storedItemCount += notInserted.getStackSize();
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
}
|
||||
@@ -187,8 +250,11 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
ItemStack tempStack = invItems.getStackInSlot(index);
|
||||
if (tempStack != null) {
|
||||
tempStack.stackSize = tempStack.stackSize + (int) extracted.getStackSize();
|
||||
storedItemCount += extracted.getStackSize();
|
||||
|
||||
saveChanges();
|
||||
} else invItems.setInventorySlotContents(index, extracted.getItemStack());
|
||||
|
||||
this.storedItemCount += extracted.getStackSize();
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
}
|
||||
@@ -204,12 +270,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() {
|
||||
@@ -217,6 +283,9 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
}
|
||||
|
||||
public long getFreeBytes() {
|
||||
this.countFluids();
|
||||
this.countItems();
|
||||
|
||||
return totalBytes - (((storedItemCount + getUnusedItemCount()) / 8)
|
||||
+ ((storedFluidCount + getUnusedFluidCount()) / 2048));
|
||||
}
|
||||
@@ -267,14 +336,6 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
totalBytes = 0;
|
||||
getProxy().setIdlePowerUsage(4d);
|
||||
}
|
||||
} else if (inv == invItems) {
|
||||
if (added != null) {
|
||||
storedItemCount += added.stackSize;
|
||||
}
|
||||
|
||||
if (removed != null) {
|
||||
storedItemCount -= removed.stackSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
case decreaseStackSize -> {
|
||||
@@ -282,10 +343,6 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
totalBytes = 0;
|
||||
getProxy().setIdlePowerUsage(4d);
|
||||
}
|
||||
|
||||
if (inv == invItems) {
|
||||
storedItemCount -= removed.stackSize;
|
||||
}
|
||||
}
|
||||
case markDirty -> markDirty();
|
||||
}
|
||||
@@ -295,8 +352,6 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
} catch (GridAccessException e) {
|
||||
AELog.error(e, "Couldn't wake up level emitter for delayed updates");
|
||||
}
|
||||
|
||||
markForUpdate();
|
||||
}
|
||||
|
||||
public void fullRefund() {
|
||||
@@ -315,12 +370,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
|
||||
@@ -335,16 +404,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 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 invFluids.drain(from, maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -364,8 +429,7 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
|
||||
@Override
|
||||
public void onFluidInventoryChanged(IAEFluidTank inv, int slot) {
|
||||
saveChanges();
|
||||
markForUpdate();
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -393,8 +457,6 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
configFluids.readFromNBT(data, "configFluids");
|
||||
cell.readFromNBT(data, "cellHolder");
|
||||
totalBytes = data.getLong("totalBytes");
|
||||
storedFluidCount = data.getLong("storedFluidCount");
|
||||
storedItemCount = data.getLong("storedItemCount");
|
||||
getProxy().setIdlePowerUsage(data.getDouble("powerDraw"));
|
||||
}
|
||||
|
||||
@@ -406,8 +468,6 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
configFluids.writeToNBT(data, "configFluids");
|
||||
cell.writeToNBT(data, "cellHolder");
|
||||
data.setLong("totalBytes", totalBytes);
|
||||
data.setLong("storedFluidCount", storedFluidCount);
|
||||
data.setLong("storedItemCount", storedItemCount);
|
||||
data.setDouble("powerDraw", getProxy().getIdlePowerUsage());
|
||||
return data;
|
||||
}
|
||||
@@ -479,4 +539,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;
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.glodblock.github.coremod;
|
||||
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
|
||||
import com.glodblock.github.coremod.transform.ExternalStorageRegistryTransformer;
|
||||
import com.glodblock.github.coremod.transform.GuiCraftingTransformer;
|
||||
import com.glodblock.github.coremod.transform.NEITransformer;
|
||||
import com.gtnewhorizon.gtnhlib.asm.ASMUtil;
|
||||
|
||||
public class FCClassTransformer implements IClassTransformer {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger("ASM AE2FC");
|
||||
|
||||
@Override
|
||||
public byte[] transform(String name, String transformedName, byte[] basicClass) {
|
||||
ClassMapper tform;
|
||||
switch (transformedName) {
|
||||
case "appeng.client.gui.implementations.GuiCraftingCPU", "appeng.client.gui.implementations.GuiCraftConfirm", "net.p455w0rd.wirelesscraftingterminal.client.gui.GuiCraftConfirm", "appeng.client.gui.widgets.GuiCraftingTree" -> tform = GuiCraftingTransformer.INSTANCE;
|
||||
case "appeng.integration.modules.NEI" -> tform = NEITransformer.INSTANCE;
|
||||
case "appeng.core.features.registries.ExternalStorageRegistry" -> tform = ExternalStorageRegistryTransformer.INSTANCE;
|
||||
default -> {
|
||||
return basicClass;
|
||||
}
|
||||
}
|
||||
logger.debug("Transforming class: " + transformedName);
|
||||
final byte[] bytes = tform.transformClass(basicClass);
|
||||
if (FluidCraftCore.DUMP_CLASSES()) {
|
||||
ASMUtil.saveAsRawClassFile(basicClass, transformedName + "_PRE", this);
|
||||
ASMUtil.saveAsRawClassFile(bytes, transformedName + "_POST", this);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public abstract static class ClassMapper {
|
||||
|
||||
public final byte[] transformClass(byte[] code) {
|
||||
ClassReader reader = new ClassReader(code);
|
||||
ClassWriter writer = new ClassWriter(reader, getWriteFlags());
|
||||
reader.accept(getClassMapper(writer), ClassReader.EXPAND_FRAMES);
|
||||
return writer.toByteArray();
|
||||
}
|
||||
|
||||
protected int getWriteFlags() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected abstract ClassVisitor getClassMapper(ClassVisitor downstream);
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.glodblock.github.coremod;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import cpw.mods.fml.relauncher.IFMLLoadingPlugin;
|
||||
|
||||
@IFMLLoadingPlugin.Name("FluidCraftCore")
|
||||
@IFMLLoadingPlugin.MCVersion("1.7.10")
|
||||
@IFMLLoadingPlugin.TransformerExclusions("com.glodblock.github.coremod")
|
||||
public class FluidCraftCore implements IFMLLoadingPlugin {
|
||||
|
||||
private static final boolean DUMP_CLASSES = Boolean.parseBoolean(System.getProperty("ae2fc.dumpClass", "false"));
|
||||
private static boolean OBF_ENV;
|
||||
|
||||
@Override
|
||||
public String[] getASMTransformerClass() {
|
||||
return new String[] { FCClassTransformer.class.getName() };
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getModContainerClass() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getSetupClass() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void injectData(Map<String, Object> data) {
|
||||
OBF_ENV = (boolean) data.get("runtimeDeobfuscationEnabled");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getAccessTransformerClass() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean DUMP_CLASSES() {
|
||||
return DUMP_CLASSES || !OBF_ENV;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.glodblock.github.coremod.hooker;
|
||||
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.gui.IGuiTooltipHandler;
|
||||
|
||||
public class CoreModHooks {
|
||||
|
||||
public static ItemStack displayFluid(IAEItemStack aeStack) {
|
||||
if (aeStack.getItemStack() != null && aeStack.getItemStack().getItem() instanceof ItemFluidDrop) {
|
||||
FluidStack fluid = ItemFluidDrop.getFluidStack(aeStack.getItemStack());
|
||||
return ItemFluidPacket.newDisplayStack(fluid);
|
||||
} else return aeStack.getItemStack();
|
||||
}
|
||||
|
||||
public static ItemStack getStackUnderMouse(GuiContainer gui, int mousex, int mousey) {
|
||||
if (gui instanceof IGuiTooltipHandler guiTooltipHandler) {
|
||||
return guiTooltipHandler.getHoveredStack();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.glodblock.github.coremod.hooker;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class CoreModHooksClient {
|
||||
|
||||
}
|
||||
-104
@@ -1,104 +0,0 @@
|
||||
package com.glodblock.github.coremod.transform;
|
||||
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Label;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
||||
import com.glodblock.github.coremod.FCClassTransformer;
|
||||
|
||||
public class ExternalStorageRegistryTransformer extends FCClassTransformer.ClassMapper {
|
||||
|
||||
public static final ExternalStorageRegistryTransformer INSTANCE = new ExternalStorageRegistryTransformer();
|
||||
|
||||
private ExternalStorageRegistryTransformer() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClassVisitor getClassMapper(ClassVisitor downstream) {
|
||||
return new TransformExternalStorageRegistry(Opcodes.ASM5, downstream);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getWriteFlags() {
|
||||
return ClassWriter.COMPUTE_FRAMES;
|
||||
}
|
||||
|
||||
private static class TransformExternalStorageRegistry extends ClassVisitor {
|
||||
|
||||
public TransformExternalStorageRegistry(int api, ClassVisitor cv) {
|
||||
super(api, cv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
|
||||
if ("getHandler".equals(name)) {
|
||||
return new TransformGetHandler(api, super.visitMethod(access, name, desc, signature, exceptions));
|
||||
} else {
|
||||
return super.visitMethod(access, name, desc, signature, exceptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class TransformGetHandler extends MethodVisitor {
|
||||
|
||||
private int cnt_return = 0;
|
||||
private int cnt_if = 0;
|
||||
private Label L6 = null;
|
||||
private final Label L9 = new Label();
|
||||
|
||||
TransformGetHandler(int api, MethodVisitor mv) {
|
||||
super(api, mv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitJumpInsn(int opcode, Label label) {
|
||||
if (opcode == Opcodes.IFEQ) {
|
||||
cnt_if++;
|
||||
}
|
||||
if (cnt_if == 3) {
|
||||
L6 = label;
|
||||
cnt_if++;
|
||||
super.visitJumpInsn(opcode, L9);
|
||||
return;
|
||||
}
|
||||
super.visitJumpInsn(opcode, label);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitInsn(int opcode) {
|
||||
if (opcode == Opcodes.ARETURN) {
|
||||
cnt_return++;
|
||||
}
|
||||
super.visitInsn(opcode);
|
||||
if (cnt_return == 2) {
|
||||
super.visitLabel(L9);
|
||||
super.visitFieldInsn(
|
||||
Opcodes.GETSTATIC,
|
||||
"com/glodblock/github/inventory/external/AEFluidTankHandler",
|
||||
"INSTANCE",
|
||||
"Lcom/glodblock/github/inventory/external/AEFluidTankHandler;");
|
||||
super.visitVarInsn(Opcodes.ALOAD, 1);
|
||||
super.visitVarInsn(Opcodes.ALOAD, 2);
|
||||
super.visitVarInsn(Opcodes.ALOAD, 3);
|
||||
super.visitVarInsn(Opcodes.ALOAD, 4);
|
||||
super.visitMethodInsn(
|
||||
Opcodes.INVOKEVIRTUAL,
|
||||
"com/glodblock/github/inventory/external/AEFluidTankHandler",
|
||||
"canHandle",
|
||||
"(Lnet/minecraft/tileentity/TileEntity;Lnet/minecraftforge/common/util/ForgeDirection;Lappeng/api/storage/StorageChannel;Lappeng/api/networking/security/BaseActionSource;)Z",
|
||||
false);
|
||||
super.visitJumpInsn(Opcodes.IFEQ, L6);
|
||||
super.visitFieldInsn(
|
||||
Opcodes.GETSTATIC,
|
||||
"com/glodblock/github/inventory/external/AEFluidTankHandler",
|
||||
"INSTANCE",
|
||||
"Lcom/glodblock/github/inventory/external/AEFluidTankHandler;");
|
||||
super.visitInsn(Opcodes.ARETURN);
|
||||
cnt_return++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package com.glodblock.github.coremod.transform;
|
||||
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
||||
import com.glodblock.github.coremod.FCClassTransformer;
|
||||
|
||||
public class GuiCraftingTransformer extends FCClassTransformer.ClassMapper {
|
||||
|
||||
public static final GuiCraftingTransformer INSTANCE = new GuiCraftingTransformer();
|
||||
|
||||
private GuiCraftingTransformer() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClassVisitor getClassMapper(ClassVisitor downstream) {
|
||||
return new TransformGuiCrafting(Opcodes.ASM5, downstream);
|
||||
}
|
||||
|
||||
private static class TransformGuiCrafting extends ClassVisitor {
|
||||
|
||||
TransformGuiCrafting(int api, ClassVisitor cv) {
|
||||
super(api, cv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
|
||||
if ("drawFG".equals(name) || "drawListFG".equals(name) || "drawStack".equals(name)) {
|
||||
return new TransformFluidIcon(api, super.visitMethod(access, name, desc, signature, exceptions));
|
||||
}
|
||||
return super.visitMethod(access, name, desc, signature, exceptions);
|
||||
}
|
||||
}
|
||||
|
||||
private static class TransformFluidIcon extends MethodVisitor {
|
||||
|
||||
TransformFluidIcon(int api, MethodVisitor mv) {
|
||||
super(api, mv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) {
|
||||
if (opcode == Opcodes.INVOKEINTERFACE && owner.equals("appeng/api/storage/data/IAEItemStack")
|
||||
&& name.equals("getItemStack")) {
|
||||
super.visitMethodInsn(
|
||||
Opcodes.INVOKESTATIC,
|
||||
"com/glodblock/github/coremod/hooker/CoreModHooks",
|
||||
"displayFluid",
|
||||
"(Lappeng/api/storage/data/IAEItemStack;)Lnet/minecraft/item/ItemStack;",
|
||||
false);
|
||||
} else {
|
||||
super.visitMethodInsn(opcode, owner, name, desc, itf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
package com.glodblock.github.coremod.transform;
|
||||
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
||||
import com.glodblock.github.coremod.FCClassTransformer;
|
||||
|
||||
public class NEITransformer extends FCClassTransformer.ClassMapper {
|
||||
|
||||
public static final NEITransformer INSTANCE = new NEITransformer();
|
||||
|
||||
private NEITransformer() {
|
||||
// NO-OP
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ClassVisitor getClassMapper(ClassVisitor downstream) {
|
||||
return new TransformNEI(Opcodes.ASM5, downstream);
|
||||
}
|
||||
|
||||
private static class TransformNEI extends ClassVisitor {
|
||||
|
||||
TransformNEI(int api, ClassVisitor cv) {
|
||||
super(api, cv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
|
||||
return switch (name) {
|
||||
case "getStackUnderMouse" -> new TransformStackUnderMouse(
|
||||
api,
|
||||
super.visitMethod(access, name, desc, signature, exceptions));
|
||||
case "shouldShowTooltip" -> new TransformShowTooltip(
|
||||
api,
|
||||
super.visitMethod(access, name, desc, signature, exceptions));
|
||||
default -> super.visitMethod(access, name, desc, signature, exceptions);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static class TransformStackUnderMouse extends MethodVisitor {
|
||||
|
||||
TransformStackUnderMouse(int api, MethodVisitor mv) {
|
||||
super(api, mv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitInsn(int opcode) {
|
||||
if (opcode == Opcodes.ACONST_NULL) {
|
||||
super.visitVarInsn(Opcodes.ALOAD, 1);
|
||||
super.visitVarInsn(Opcodes.ILOAD, 2);
|
||||
super.visitVarInsn(Opcodes.ILOAD, 3);
|
||||
super.visitMethodInsn(
|
||||
Opcodes.INVOKESTATIC,
|
||||
"com/glodblock/github/coremod/hooker/CoreModHooks",
|
||||
"getStackUnderMouse",
|
||||
"(Lnet/minecraft/client/gui/inventory/GuiContainer;II)Lnet/minecraft/item/ItemStack;",
|
||||
false);
|
||||
return;
|
||||
}
|
||||
super.visitInsn(opcode);
|
||||
}
|
||||
}
|
||||
|
||||
private static class TransformShowTooltip extends MethodVisitor {
|
||||
|
||||
int const_1 = 0;
|
||||
|
||||
TransformShowTooltip(int api, MethodVisitor mv) {
|
||||
super(api, mv);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitInsn(int opcode) {
|
||||
if (opcode == Opcodes.ICONST_1 && const_1 == 2) {
|
||||
super.visitVarInsn(Opcodes.ALOAD, 1);
|
||||
super.visitMethodInsn(
|
||||
Opcodes.INVOKESTATIC,
|
||||
"com/glodblock/github/coremod/hooker/CoreModHooks",
|
||||
"shouldShowTooltip",
|
||||
"(Lnet/minecraft/client/gui/inventory/GuiContainer;)Z",
|
||||
false);
|
||||
const_1++;
|
||||
return;
|
||||
}
|
||||
if (opcode == Opcodes.ICONST_1) {
|
||||
const_1++;
|
||||
}
|
||||
super.visitInsn(opcode);
|
||||
}
|
||||
}
|
||||
}
|
||||
+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;
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
package com.glodblock.github.crossmod.thaumcraft;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.util.RenderUtil;
|
||||
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.client.lib.UtilsFX;
|
||||
|
||||
public class AspectRender {
|
||||
|
||||
public static final ResourceLocation UNKNOWN_TEXTURE = new ResourceLocation(
|
||||
"thaumcraft",
|
||||
"textures/aspects/_unknown.png");
|
||||
|
||||
public static void drawAspect(EntityPlayer player, int posX, int posY, float zLevel, Aspect aspect, long amount) {
|
||||
if (aspect == null || amount <= 0) {
|
||||
return;
|
||||
}
|
||||
if (AspectUtil.isPlayerDiscoveredAspect(player, aspect)) {
|
||||
UtilsFX.drawTag(posX, posY, aspect, 0, 0, zLevel);
|
||||
} else {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(UNKNOWN_TEXTURE);
|
||||
RenderUtil.setGLColorFromInt(aspect.getColor());
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
UtilsFX.drawTexturedQuadFull(posX, posY, zLevel);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,154 +0,0 @@
|
||||
package com.glodblock.github.crossmod.thaumcraft;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import org.apache.commons.lang3.tuple.ImmutablePair;
|
||||
import org.apache.commons.lang3.tuple.MutablePair;
|
||||
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumcraft.api.aspects.IEssentiaContainerItem;
|
||||
import thaumcraft.common.Thaumcraft;
|
||||
import thaumicenergistics.api.ThEApi;
|
||||
import thaumicenergistics.api.storage.IAspectStack;
|
||||
import thaumicenergistics.common.fluids.GaseousEssentia;
|
||||
import thaumicenergistics.common.integration.tc.EssentiaItemContainerHelper;
|
||||
import thaumicenergistics.common.storage.AspectStack;
|
||||
|
||||
public class AspectUtil {
|
||||
|
||||
public static final EssentiaItemContainerHelper HELPER = EssentiaItemContainerHelper.INSTANCE;
|
||||
public static int R = 128;
|
||||
|
||||
@Optional.Method(modid = "thaumicenergistics")
|
||||
public static void init() {
|
||||
R = ThEApi.instance().config().conversionMultiplier();
|
||||
}
|
||||
|
||||
public static boolean isPlayerDiscoveredAspect(final EntityPlayer player, final Aspect aspect) {
|
||||
if (player != null && aspect != null) {
|
||||
return Thaumcraft.proxy.getPlayerKnowledge().hasDiscoveredAspect(player.getCommandSenderName(), aspect);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isEssentiaGas(Fluid fluid) {
|
||||
return fluid instanceof GaseousEssentia;
|
||||
}
|
||||
|
||||
public static boolean isEssentiaGas(FluidStack fluid) {
|
||||
return fluid != null && fluid.getFluid() instanceof GaseousEssentia;
|
||||
}
|
||||
|
||||
public static boolean isEssentiaGas(IAEFluidStack fluid) {
|
||||
return fluid != null && fluid.getFluid() instanceof GaseousEssentia;
|
||||
}
|
||||
|
||||
public static Aspect getAspectFromGas(FluidStack fluid) {
|
||||
if (!isEssentiaGas(fluid)) {
|
||||
return null;
|
||||
}
|
||||
GaseousEssentia gas = (GaseousEssentia) fluid.getFluid();
|
||||
return gas.getAspect();
|
||||
}
|
||||
|
||||
public static Aspect getAspectFromJar(ItemStack stack) {
|
||||
if (isEssentiaContainer(stack)) {
|
||||
return HELPER.getAspectInContainer(stack);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Aspect getAspectFromGas(IAEFluidStack fluid) {
|
||||
if (isEssentiaGas(fluid)) {
|
||||
return null;
|
||||
}
|
||||
GaseousEssentia gas = (GaseousEssentia) fluid.getFluid();
|
||||
return gas.getAspect();
|
||||
}
|
||||
|
||||
public static FluidStack getGasFromAspect(IAspectStack aspectStack) {
|
||||
if (aspectStack == null || aspectStack.isEmpty()) return null;
|
||||
return new FluidStack(
|
||||
GaseousEssentia.getGasFromAspect(aspectStack.getAspect()),
|
||||
(int) aspectStack.getStackSize() * R);
|
||||
}
|
||||
|
||||
public static boolean isEssentiaContainer(ItemStack stack) {
|
||||
return HELPER.getItemType(stack) != EssentiaItemContainerHelper.AspectItemType.Invalid
|
||||
&& HELPER.getItemType(stack) != EssentiaItemContainerHelper.AspectItemType.ItemAspect;
|
||||
}
|
||||
|
||||
public static AEFluidStack getAEGasFromContainer(ItemStack stack) {
|
||||
if (isEssentiaContainer(stack) && !isEmptyEssentiaContainer(stack)) {
|
||||
IAspectStack aspectStack = HELPER.getAspectStackFromContainer(stack);
|
||||
aspectStack.setStackSize(stack.stackSize * aspectStack.getStackSize());
|
||||
FluidStack gas = getGasFromAspect(aspectStack);
|
||||
return AEFluidStack.create(gas);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isEmptyEssentiaContainer(ItemStack stack) {
|
||||
return HELPER.isContainerEmpty(stack) && isEssentiaContainer(stack);
|
||||
}
|
||||
|
||||
public static ItemStack setAspectAmount(ItemStack itemStack, int amount, Aspect aspect) {
|
||||
if (isEssentiaContainer(itemStack)) {
|
||||
IEssentiaContainerItem container = (IEssentiaContainerItem) itemStack.getItem();
|
||||
assert container != null;
|
||||
container.getAspects(itemStack).aspects.put(aspect, amount);
|
||||
return itemStack;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static MutablePair<Integer, ItemStack> fillEssentiaFromGas(ItemStack itemStack, FluidStack fluid) {
|
||||
if (isEssentiaContainer(itemStack) && isEssentiaGas(fluid)) {
|
||||
if (itemStack.stackSize != 1) {
|
||||
return null;
|
||||
}
|
||||
Aspect aspect = getAspectFromGas(fluid);
|
||||
int amount = fluid.amount / R;
|
||||
EssentiaItemContainerHelper.AspectItemType iType = HELPER.getItemType(itemStack);
|
||||
if (iType == EssentiaItemContainerHelper.AspectItemType.JarLabel) {
|
||||
ItemStack label = itemStack.copy();
|
||||
HELPER.setLabelAspect(label, aspect);
|
||||
}
|
||||
int cap = HELPER.getContainerCapacity(itemStack);
|
||||
int tryFill = Math.min(cap, amount);
|
||||
ImmutablePair<Integer, ItemStack> result = HELPER
|
||||
.injectIntoContainer(itemStack, new AspectStack(aspect, tryFill));
|
||||
return result != null ? new MutablePair<>(result.left * R, result.right) : null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static MutablePair<Integer, ItemStack> drainEssentiaFromGas(ItemStack itemStack, FluidStack fluid) {
|
||||
if (isEssentiaContainer(itemStack) && isEssentiaGas(fluid)) {
|
||||
Aspect aspect = getAspectFromGas(fluid);
|
||||
int amount = fluid.amount / R;
|
||||
IAspectStack contents = HELPER.getAspectStackFromContainer(itemStack);
|
||||
int drained;
|
||||
ItemStack stack = null;
|
||||
if (contents == null || !Objects.equals(contents.getAspect(), aspect)) {
|
||||
drained = 0;
|
||||
} else {
|
||||
ImmutablePair<Integer, ItemStack> result = HELPER
|
||||
.extractFromContainer(itemStack, new AspectStack(aspect, amount));
|
||||
drained = result == null ? 0 : result.left;
|
||||
stack = result == null ? null : result.right;
|
||||
}
|
||||
return stack == null ? null : new MutablePair<>(drained * R, stack);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+25
-63
@@ -1,9 +1,5 @@
|
||||
package com.glodblock.github.crossmod.thaumcraft;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -11,14 +7,10 @@ import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.storage.data.AEStackTypeRegistry;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumicenergistics.api.grid.IEssentiaGrid;
|
||||
import thaumicenergistics.common.items.ItemCraftingAspect;
|
||||
|
||||
public class ThaumicEnergisticsCrafting {
|
||||
|
||||
@@ -39,8 +31,24 @@ public class ThaumicEnergisticsCrafting {
|
||||
return stack.getItem() == neiAddonAspect || stack.getItem() == thaumicEnergisticsAspect;
|
||||
}
|
||||
|
||||
@Method(modid = "thaumicenergistics")
|
||||
private static @Nullable Aspect getAspect(ItemStack stack) {
|
||||
public static IAEStack<?> convertItemAspectStack(IAEStack<?> stack) {
|
||||
if (AEStackTypeRegistry.getType("essentia") == null) return stack;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
private static String getAspectTag(ItemStack stack) {
|
||||
if (stack == null) return null;
|
||||
|
||||
if (stack.getItem() == neiAddonAspect) {
|
||||
@@ -50,62 +58,16 @@ 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;
|
||||
}
|
||||
|
||||
@Method(modid = "thaumicenergistics")
|
||||
private static ItemStack getAspectStack(Aspect aspect, int stackSize) {
|
||||
return ItemCraftingAspect.createStackForAspect(aspect, stackSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an aspect stack into a thaumic energistics stack.
|
||||
*/
|
||||
public static IAEItemStack convertAspectStack(IAEItemStack stack) {
|
||||
if (ModAndClassUtil.ThE) {
|
||||
return convertAspectStackImpl(stack);
|
||||
} else {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
@Method(modid = "thaumicenergistics")
|
||||
private static IAEItemStack convertAspectStackImpl(IAEItemStack stack) {
|
||||
if (stack == null) return null;
|
||||
|
||||
Aspect aspect = getAspect(stack.getItemStack());
|
||||
|
||||
if (aspect == null) return stack;
|
||||
|
||||
return Objects.requireNonNull(AEItemStack.create(getAspectStack(aspect, 1))).setStackSize(stack.getStackSize());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the amount of essentia stored in a grid for a given aspect preview.
|
||||
*/
|
||||
public static long getEssentiaAmount(IAEItemStack stack, IGrid grid) {
|
||||
if (ModAndClassUtil.ThE) {
|
||||
return getEssentiaAmountImpl(stack, grid);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Method(modid = "thaumicenergistics")
|
||||
private static long getEssentiaAmountImpl(IAEItemStack stack, IGrid grid) {
|
||||
Aspect aspect = getAspect(stack.getItemStack());
|
||||
|
||||
if (aspect == null) return 0;
|
||||
|
||||
IEssentiaGrid essentiaGrid = grid.getCache(IEssentiaGrid.class);
|
||||
|
||||
return essentiaGrid.getEssentiaAmount(aspect);
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,6 @@ import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.glodblock.github.crossmod.waila.part.FluidInvWailaDataProvider;
|
||||
import com.glodblock.github.crossmod.waila.part.FluidMonitorWailaDataProvider;
|
||||
import com.glodblock.github.crossmod.waila.part.SpeedWailaDataProvider;
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
@@ -30,10 +28,8 @@ public class PartWailaDataProvider implements IWailaDataProvider {
|
||||
private final Tracer tracer = new Tracer();
|
||||
|
||||
public PartWailaDataProvider() {
|
||||
final IPartWailaDataProvider speed = new SpeedWailaDataProvider();
|
||||
final IPartWailaDataProvider fluidInv = new FluidInvWailaDataProvider();
|
||||
final IPartWailaDataProvider fluidMonitor = new FluidMonitorWailaDataProvider();
|
||||
this.providers = Lists.newArrayList(speed, fluidInv, fluidMonitor);
|
||||
this.providers = Lists.newArrayList(fluidInv);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -27,11 +27,6 @@ public class Tooltip {
|
||||
return String.format("0 mB / %s mB", NumberFormat.getInstance().format(capacity));
|
||||
}
|
||||
|
||||
public static String partFluidBusFormat(int amount) {
|
||||
return String
|
||||
.format("%s: %s mB/t", I18n.format(NameConst.WAILA_SPEED), NumberFormat.getInstance().format(amount));
|
||||
}
|
||||
|
||||
public static String tileFluidInterfaceFormat(String name, int amount, int face) {
|
||||
return String.format(
|
||||
"%s %s: %s mB",
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
package com.glodblock.github.crossmod.waila.part;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.glodblock.github.common.parts.base.FCPartMonitor;
|
||||
import com.glodblock.github.crossmod.waila.Tooltip;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.integration.modules.waila.part.BasePartWailaDataProvider;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
|
||||
public class FluidMonitorWailaDataProvider extends BasePartWailaDataProvider {
|
||||
|
||||
private final String key = "fluidStore";
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(final IPart part, final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor, final IWailaConfigHandler config) {
|
||||
if (part instanceof FCPartMonitor && accessor.getNBTData().hasKey(key)) {
|
||||
IAEFluidStack iaeFluidStack = Util.loadFluidStackFromNBT(accessor.getNBTData().getCompoundTag(key));
|
||||
if (iaeFluidStack != null) currentToolTip.add(
|
||||
Tooltip.fluidFormat(
|
||||
iaeFluidStack.getFluidStack().getLocalizedName(),
|
||||
iaeFluidStack.getStackSize()));
|
||||
}
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(final EntityPlayerMP player, final IPart part, final TileEntity te,
|
||||
final NBTTagCompound tag, final World world, final int x, final int y, final int z) {
|
||||
if (part instanceof FCPartMonitor && ((FCPartMonitor) part).getAEStoreFluidStack() != null) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
((FCPartMonitor) part).getAEStoreFluidStack().writeToNBT(data);
|
||||
tag.setTag(key, data);
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.glodblock.github.crossmod.waila.part;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.glodblock.github.crossmod.waila.Tooltip;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.integration.modules.waila.part.BasePartWailaDataProvider;
|
||||
import appeng.parts.automation.PartSharedItemBus;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
|
||||
public class SpeedWailaDataProvider extends BasePartWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(final IPart part, final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor, final IWailaConfigHandler config) {
|
||||
if (accessor.getNBTData().hasKey("BusSpeed")) {
|
||||
currentToolTip.add(Tooltip.partFluidBusFormat(accessor.getNBTData().getInteger("BusSpeed")));
|
||||
}
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(final EntityPlayerMP player, final IPart part, final TileEntity te,
|
||||
final NBTTagCompound tag, final World world, final int x, final int y, final int z) {
|
||||
if (part instanceof PartSharedItemBus<?>bus) {
|
||||
tag.setInteger("BusSpeed", bus.calculateAmountToSend() / 5);
|
||||
}
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -1,262 +0,0 @@
|
||||
package com.glodblock.github.inventory;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.event.ClickEvent;
|
||||
import net.minecraft.event.HoverEvent;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.ChatStyle;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.AccessRestriction;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.StorageFilter;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.IMEMonitorHandlerReceiver;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.core.AELog;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
|
||||
public class MEMonitorIFluidHandler implements IMEMonitor<IAEFluidStack> {
|
||||
|
||||
private static boolean WrongFluidRemovedWarnIssued = false;
|
||||
|
||||
private final IFluidHandler handler;
|
||||
private final ForgeDirection side;
|
||||
private IItemList<IAEFluidStack> cache = AEApi.instance().storage().createFluidList();
|
||||
private final HashMap<IMEMonitorHandlerReceiver, Object> listeners = new HashMap<>();
|
||||
private BaseActionSource mySource;
|
||||
private StorageFilter mode;
|
||||
private boolean init = false;
|
||||
|
||||
public MEMonitorIFluidHandler(IFluidHandler handler, ForgeDirection side) {
|
||||
this.mode = StorageFilter.EXTRACTABLE_ONLY;
|
||||
this.handler = handler;
|
||||
this.side = side;
|
||||
}
|
||||
|
||||
public MEMonitorIFluidHandler(IFluidHandler handler) {
|
||||
this.mode = StorageFilter.EXTRACTABLE_ONLY;
|
||||
this.handler = handler;
|
||||
this.side = ForgeDirection.UNKNOWN;
|
||||
}
|
||||
|
||||
public void addListener(IMEMonitorHandlerReceiver l, Object verificationToken) {
|
||||
this.listeners.put(l, verificationToken);
|
||||
}
|
||||
|
||||
public void removeListener(IMEMonitorHandlerReceiver l) {
|
||||
this.listeners.remove(l);
|
||||
}
|
||||
|
||||
public IAEFluidStack injectItems(IAEFluidStack input, Actionable type, BaseActionSource src) {
|
||||
if (!this.handler.canFill(this.side, input.getFluid())) {
|
||||
return input;
|
||||
}
|
||||
|
||||
int filled = this.handler.fill(this.side, input.getFluidStack(), type == Actionable.MODULATE);
|
||||
|
||||
if (type == Actionable.MODULATE) {
|
||||
this.onTick();
|
||||
}
|
||||
|
||||
if ((long) filled == input.getStackSize()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
IAEFluidStack o = input.copy();
|
||||
o.setStackSize(input.getStackSize() - (long) filled);
|
||||
return o;
|
||||
}
|
||||
|
||||
public IAEFluidStack extractItems(IAEFluidStack request, Actionable type, BaseActionSource src) {
|
||||
if (!this.handler.canDrain(this.side, request.getFluid())) {
|
||||
return null;
|
||||
}
|
||||
FluidStack removed = this.handler.drain(this.side, request.getFluidStack(), type == Actionable.MODULATE);
|
||||
if (removed != null && removed.amount != 0) {
|
||||
// perform a one time log if the removed fluid isn't what's reported since this will create a dupe exploit
|
||||
if (!WrongFluidRemovedWarnIssued && !removed.isFluidEqual(request.getFluidStack())) {
|
||||
WrongFluidRemovedWarnIssued = true;
|
||||
String issuesUrl = "https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/new";
|
||||
String msg = String.format(
|
||||
"[AE2FC] MEMonitorIFluidHandler.extractItems got the wrong fluids while extracting from %s. expected %s got %s. Please report this message if seen: ",
|
||||
this.handler.getClass().getSimpleName(),
|
||||
request.getFluidStack().getUnlocalizedName(),
|
||||
removed.getUnlocalizedName());
|
||||
// elevate log to error if chat msg is removed to make it easier to find.
|
||||
AELog.warn(msg + issuesUrl);
|
||||
|
||||
ChatComponentText chatTxt = new ChatComponentText(msg);
|
||||
chatTxt.setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED).setBold(true));
|
||||
|
||||
ChatComponentText chatUrl = new ChatComponentText(issuesUrl);
|
||||
chatUrl.setChatStyle(
|
||||
new ChatStyle().setUnderlined(true)
|
||||
.setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, issuesUrl))
|
||||
.setChatHoverEvent(
|
||||
new HoverEvent(
|
||||
HoverEvent.Action.SHOW_TEXT,
|
||||
new ChatComponentText("Click to open link"))));
|
||||
|
||||
ChatComponentText chat = new ChatComponentText("");
|
||||
chat.appendSibling(chatTxt);
|
||||
chat.appendSibling(chatUrl);
|
||||
|
||||
MinecraftServer.getServer().getConfigurationManager().sendChatMsg(chat);
|
||||
}
|
||||
IAEFluidStack o = request.copy();
|
||||
o.setStackSize(removed.amount);
|
||||
if (type == Actionable.MODULATE) {
|
||||
IAEFluidStack cachedStack = this.cache.findPrecise(request);
|
||||
if (cachedStack != null) {
|
||||
cachedStack.decStackSize(o.getStackSize());
|
||||
this.postDifference(Collections.singletonList(o.copy().setStackSize(-o.getStackSize())));
|
||||
}
|
||||
}
|
||||
return o;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageChannel getChannel() {
|
||||
return StorageChannel.FLUIDS;
|
||||
}
|
||||
|
||||
// *Decompiled Stuff*//
|
||||
|
||||
public TickRateModulation onTick() {
|
||||
FluidTankInfo[] tankProperties = this.handler.getTankInfo(this.side);
|
||||
IItemList<IAEFluidStack> currentlyOnStorage = AEApi.instance().storage().createFluidList();
|
||||
|
||||
if (tankProperties != null) {
|
||||
for (FluidTankInfo tankProperty : tankProperties) {
|
||||
if (this.mode != StorageFilter.EXTRACTABLE_ONLY || this.handler.drain(this.side, 1, false) != null) {
|
||||
currentlyOnStorage.add(AEFluidStack.create(tankProperty.fluid));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// make diff between cache and new contents
|
||||
IItemList<IAEStack<?>> changes = AEApi.instance().storage().createAEStackList();
|
||||
// using non-enhanced for to prevent concurrency errors
|
||||
for (Iterator<IAEFluidStack> iter = this.cache.iterator(); iter.hasNext();) {
|
||||
IAEFluidStack copy = iter.next().copy();
|
||||
copy.setStackSize(-copy.getStackSize());
|
||||
changes.add(copy);
|
||||
}
|
||||
for (IAEFluidStack is : currentlyOnStorage) {
|
||||
changes.add(is);
|
||||
}
|
||||
// update cache as soon as possible
|
||||
this.cache = currentlyOnStorage;
|
||||
// remove unchanged values
|
||||
for (Iterator<IAEStack<?>> iter = changes.iterator(); iter.hasNext();) {
|
||||
if (iter.next().getStackSize() == 0L) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
|
||||
if (!changes.isEmpty()) {
|
||||
this.postDifference(changes);
|
||||
return TickRateModulation.URGENT;
|
||||
}
|
||||
|
||||
return TickRateModulation.SLOWER;
|
||||
}
|
||||
|
||||
private void postDifference(Iterable<IAEStack<?>> a) {
|
||||
if (a != null) {
|
||||
Iterator<Map.Entry<IMEMonitorHandlerReceiver, Object>> i = this.listeners.entrySet().iterator();
|
||||
|
||||
while (i.hasNext()) {
|
||||
Map.Entry<IMEMonitorHandlerReceiver, Object> l = i.next();
|
||||
IMEMonitorHandlerReceiver key = l.getKey();
|
||||
if (key.isValid(l.getValue())) {
|
||||
key.postChange(this, a, this.getActionSource());
|
||||
} else {
|
||||
i.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AccessRestriction getAccess() {
|
||||
return AccessRestriction.READ_WRITE;
|
||||
}
|
||||
|
||||
public boolean isPrioritized(IAEFluidStack input) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canAccept(IAEFluidStack input) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getPriority() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getSlot() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public boolean validForPass(int i) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public IItemList<IAEFluidStack> getAvailableItems(IItemList<IAEFluidStack> out, int iteration) {
|
||||
if (!init) {
|
||||
this.onTick();
|
||||
init = true;
|
||||
}
|
||||
for (IAEFluidStack fs : this.cache) {
|
||||
out.addStorage(fs);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEFluidStack getAvailableItem(@Nonnull IAEFluidStack request, int iteration) {
|
||||
if (!init) {
|
||||
this.onTick();
|
||||
init = true;
|
||||
}
|
||||
return this.cache.findPrecise(request);
|
||||
}
|
||||
|
||||
public IItemList<IAEFluidStack> getStorageList() {
|
||||
return this.cache;
|
||||
}
|
||||
|
||||
public void setMode(StorageFilter mode) {
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
private BaseActionSource getActionSource() {
|
||||
return this.mySource;
|
||||
}
|
||||
|
||||
public void setActionSource(BaseActionSource mySource) {
|
||||
this.mySource = mySource;
|
||||
}
|
||||
}
|
||||
+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();
|
||||
}
|
||||
}
|
||||
|
||||
-33
@@ -1,33 +0,0 @@
|
||||
package com.glodblock.github.inventory.external;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import com.glodblock.github.inventory.MEMonitorIFluidHandler;
|
||||
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
|
||||
// This handler is too generic, so it will overlap other mods' fluid handler.
|
||||
// It will be injected into external handler by ASM to make sure it is executed at last.
|
||||
public class AEFluidTankHandler implements IExternalStorageHandler {
|
||||
|
||||
public static final AEFluidTankHandler INSTANCE = new AEFluidTankHandler();
|
||||
|
||||
@Override
|
||||
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc) {
|
||||
return channel == StorageChannel.FLUIDS && te instanceof IFluidHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src) {
|
||||
if (channel == StorageChannel.FLUIDS) {
|
||||
return new MEMonitorIFluidHandler((IFluidHandler) te, d);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -9,10 +9,10 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.glodblock.github.inventory.item.IItemInventory;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerOpenContext;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public abstract class ItemGuiFactory<T> implements IGuiFactory {
|
||||
|
||||
@@ -30,7 +30,7 @@ public abstract class ItemGuiFactory<T> implements IGuiFactory {
|
||||
@Nullable
|
||||
@Override
|
||||
public Object createServerGui(EntityPlayer player, World world, int x, int y, int z, ForgeDirection face) {
|
||||
ItemStack item = Util.getWirelessTerminal(player, x);
|
||||
ItemStack item = Platform.getItemFromPlayerInventoryBySlotIndex(player, x);
|
||||
if (item == null || !(item.getItem() instanceof IItemInventory)) {
|
||||
return null;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ public abstract class ItemGuiFactory<T> implements IGuiFactory {
|
||||
@Nullable
|
||||
@Override
|
||||
public Object createClientGui(EntityPlayer player, World world, int x, int y, int z, ForgeDirection face) {
|
||||
ItemStack item = Util.getWirelessTerminal(player, x);
|
||||
ItemStack item = Platform.getItemFromPlayerInventoryBySlotIndex(player, x);
|
||||
if (item == null || !(item.getItem() instanceof IItemInventory)) {
|
||||
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 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;
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerOpenContext;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public abstract class PartOrItemGuiFactory<T> extends PartGuiFactory<T> {
|
||||
|
||||
@@ -31,7 +32,7 @@ public abstract class PartOrItemGuiFactory<T> extends PartGuiFactory<T> {
|
||||
public Object createServerGui(EntityPlayer player, World world, int x, int y, int z, ForgeDirection face) {
|
||||
ImmutablePair<Util.GuiHelper.GuiType, Integer> result = Util.GuiHelper.decodeType(y);
|
||||
if (result.getLeft() == Util.GuiHelper.GuiType.ITEM) {
|
||||
ItemStack item = Util.getWirelessTerminal(player, x);
|
||||
ItemStack item = Platform.getItemFromPlayerInventoryBySlotIndex(player, x);
|
||||
if (item == null || !(item.getItem() instanceof IItemInventory)) {
|
||||
return null;
|
||||
}
|
||||
@@ -62,7 +63,7 @@ public abstract class PartOrItemGuiFactory<T> extends PartGuiFactory<T> {
|
||||
public Object createClientGui(EntityPlayer player, World world, int x, int y, int z, ForgeDirection face) {
|
||||
ImmutablePair<Util.GuiHelper.GuiType, Integer> result = Util.GuiHelper.decodeType(y);
|
||||
if (result.left == Util.GuiHelper.GuiType.ITEM) {
|
||||
ItemStack item = Util.getWirelessTerminal(player, x);
|
||||
ItemStack item = Platform.getItemFromPlayerInventoryBySlotIndex(player, x);
|
||||
if (item == null || !(item.getItem() instanceof IItemInventory)) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
+7
-9
@@ -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;
|
||||
@@ -266,7 +264,7 @@ public class WirelessMagnetCardFilterInventory extends BaseWirelessInventory imp
|
||||
public static WirelessMagnetCardFilterInventory getFilter(ItemStack is, int slot, IGridNode gridNode,
|
||||
EntityPlayer player) {
|
||||
WirelessMagnetCardFilterInventory cachedInv = cache.get(player.getUniqueID());
|
||||
if (cachedInv != null && cachedInv.checkCache(is)) {
|
||||
if (cachedInv != null && cachedInv.checkCache(is) && gridNode == cachedInv.grid) {
|
||||
return cachedInv;
|
||||
} else {
|
||||
WirelessMagnetCardFilterInventory newInv = new WirelessMagnetCardFilterInventory(
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.glodblock.github.loader;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.crafting.v2.CraftingCalculations;
|
||||
import appeng.crafting.v2.CraftingRequest;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class CalculatorV2PluginLoader {
|
||||
|
||||
private static long adjustByteCost(CraftingRequest<IAEItemStack> request, Long originalAmount) {
|
||||
if (request.stack.getItem() instanceof ItemFluidDrop) {
|
||||
return Platform.ceilDiv(originalAmount, 1000L);
|
||||
} else {
|
||||
return originalAmount;
|
||||
}
|
||||
}
|
||||
|
||||
public static void installCalculatorV2Plugins() {
|
||||
CraftingCalculations.registerByteAmountAdjuster(CalculatorV2PluginLoader::adjustByteCost, IAEItemStack.class);
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
@@ -137,7 +128,7 @@ public class ItemAndBlockHolder {
|
||||
NameConst.ITEM_ARTIFICIAL_UNIVERSE_STORAGE,
|
||||
Long.MAX_VALUE / 2048,
|
||||
16384,
|
||||
5,
|
||||
63,
|
||||
600000D).register();
|
||||
public static ItemFluidVoidStorageCell FLUID_VOID_CELL = new ItemFluidVoidStorageCell().register();
|
||||
public static ItemCreativeFluidStorageCell CREATIVE_CELL = new ItemCreativeFluidStorageCell().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,10 +175,6 @@ public class RecipeLoader implements Runnable {
|
||||
GameRegistry.findItem("appliedenergistics2", "item.ItemMultiMaterial"),
|
||||
1,
|
||||
43);
|
||||
public static final ItemStack THE_WIRELESS_TERM = GameRegistry
|
||||
.findItemStack("thaumicenergistics", "wireless.essentia.terminal", 1);
|
||||
private static final ItemStack WCT_WIRELESS_TERM = GameRegistry
|
||||
.findItemStack("ae2wct", "wirelessCraftingTerminal", 1);
|
||||
public static final ItemStack BUCKET = new ItemStack(Items.bucket, 1);
|
||||
public static final ItemStack IRON_BAR = new ItemStack(Blocks.iron_bars, 1);
|
||||
public static final ItemStack AE2_ADVANCED_CARD = new ItemStack(
|
||||
@@ -281,27 +270,6 @@ public class RecipeLoader implements Runnable {
|
||||
AE2_WORK_BENCH));
|
||||
GameRegistry.addShapelessRecipe(FLUID_STORAGE_BUS.stack(), FLUID_INTERFACE, STICKY_PISTON, PISTON);
|
||||
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(),
|
||||
@@ -343,13 +311,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"))
|
||||
@@ -748,7 +709,8 @@ public class RecipeLoader implements Runnable {
|
||||
}
|
||||
|
||||
ItemStack[] term = { AE2_WIRELESS_TERMINAL, WIRELESS_PATTERN_TERM.stack(), WIRELESS_INTERFACE_TERM.stack(),
|
||||
WIRELESS_LEVEL_TERM.stack(), THE_WIRELESS_TERM, 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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
Loaded 100 of 244 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user