mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-23 05:19:49 +00:00
Compare commits
47
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1706b5a8da | ||
|
|
d89808dc0b | ||
|
|
e7effee580 | ||
|
|
869613ae31 | ||
|
|
6bec3e7e3a | ||
|
|
c251372e95 | ||
|
|
5315b79c70 | ||
|
|
23d2142084 | ||
|
|
049156e63e | ||
|
|
3d445d7988 | ||
|
|
79648a17b5 | ||
|
|
965d3d9db6 | ||
|
|
8d7bde168d | ||
|
|
2352510223 | ||
|
|
5f9c1b236e | ||
|
|
3f5903aad4 | ||
|
|
10cd1d50ab | ||
|
|
7014b7eaca | ||
|
|
e50d549085 | ||
|
|
f381726ef2 | ||
|
|
c1de99049c | ||
|
|
31533e96df | ||
|
|
7124e812d1 | ||
|
|
edac0cdec6 | ||
|
|
3b67b77572 | ||
|
|
208e4d66d9 | ||
|
|
1aba13e96f | ||
|
|
dd05ae29c1 | ||
|
|
44dfa4d551 | ||
|
|
0a84d208f3 | ||
|
|
4a030a52b6 | ||
|
|
ead0aff1ae | ||
|
|
04d80384b2 | ||
|
|
1b5680d2fd | ||
|
|
0bccb9bc5c | ||
|
|
caf1b282a7 | ||
|
|
1f2613b331 | ||
|
|
a7bf25fcf0 | ||
|
|
07ce2fd1ea | ||
|
|
387c740dcb | ||
|
|
31a9034b8e | ||
|
|
a108986cbb | ||
|
|
abecbe8506 | ||
|
|
36671559a8 | ||
|
|
9c50bb0d70 | ||
|
|
d89a67d3db | ||
|
|
a684a07d7c |
No files matched your search
+14
-20
@@ -34,28 +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.91-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-894-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:waila:1.19.22:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.9.50:dev")
|
||||
api('com.github.GTNewHorizons:NotEnoughItems:2.8.121-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-1040-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:waila:1.19.31:dev')
|
||||
api("com.github.GTNewHorizons:GTNHLib:0.11.37:dev")
|
||||
|
||||
implementation("com.github.GTNewHorizons:WirelessCraftingTerminal:1.12.13:dev") {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'Applied-Energistics-2-Unofficial'
|
||||
}
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.11-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:Baubles-Expanded:2.2.22-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.63:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.35:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.13:dev')
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.23:dev')
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.52.429:dev') {
|
||||
exclude group: 'com.github.GTNewHorizons', module: 'AE2FluidCraft-Rework'
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.34:dev')
|
||||
compileOnly('com.github.GTNewHorizons:EnderIO:2.10.37:dev')
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.55-GTNH:dev') { transitive = false }
|
||||
|
||||
compileOnly("org.jetbrains:annotations:26.1.0")
|
||||
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.4.4: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.34-GTNH:dev') { transitive = false }
|
||||
compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.7.41-GTNH:dev') { transitive = false }
|
||||
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:DuraDisplay:1.4.2:dev")
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
#This file is generated by updateDaemonJvm
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/d4fd992c9557644e637ebe98263e0ae7/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/faa12903720d410b387cc69ccafb1a74/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1630f7ebef05444cb27a2709ea0249b3/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/cd495626d2ee49a75447e3fdc6afb287/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/a4c09dd2e2d7079373d30e524bbc2829/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/8e1d9ee5d0f13e442218f6884a306da1/redirect
|
||||
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/97d46b5ff4df0bf61e95652a190a5567/redirect
|
||||
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/9ef54a08e06b0754cee9fc95ed3a3134/redirect
|
||||
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/97d46b5ff4df0bf61e95652a190a5567/redirect
|
||||
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/9ef54a08e06b0754cee9fc95ed3a3134/redirect
|
||||
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1df82b76031285ef2e6a4f59ffe9299d/redirect
|
||||
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/c7d5be6a02945ac2e045048ee54a7d32/redirect
|
||||
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/97d46b5ff4df0bf61e95652a190a5567/redirect
|
||||
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/9ef54a08e06b0754cee9fc95ed3a3134/redirect
|
||||
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/643f404f769811f5f265fd66f7af5d89/redirect
|
||||
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/38256085a73e137cb4937ea9c4807fec/redirect
|
||||
toolchainVersion=25
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.24'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.29'
|
||||
}
|
||||
|
||||
|
||||
@@ -10,8 +10,10 @@ import com.glodblock.github.loader.ChannelLoader;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.loader.RecipeLoader;
|
||||
import com.glodblock.github.proxy.CommonProxy;
|
||||
import com.glodblock.github.util.FluidCellHandler;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
@@ -60,7 +62,7 @@ public class FluidCraft {
|
||||
@Mod.EventHandler
|
||||
public static void postInit(FMLPostInitializationEvent event) {
|
||||
NetworkRegistry.INSTANCE.registerGuiHandler(FluidCraft.INSTANCE, new InventoryHandler());
|
||||
|
||||
AEApi.instance().registries().cell().addCellHandler(new FluidCellHandler());
|
||||
ItemAndBlockHolder.loadSetting();
|
||||
|
||||
if (!Config.removeRecipe) {
|
||||
|
||||
@@ -215,7 +215,7 @@ public class UltraTerminalButtons implements ICustomButtonDataObject {
|
||||
public void readData(NBTTagCompound tag) {
|
||||
this.reStock = tag.getBoolean(restockItems);
|
||||
this.magnetMode = WirelessMagnet.Mode.values()[tag.getInteger(modeKey)];
|
||||
this.terminalMode = UltraTerminalModes.values()[tag.getInteger(MODE)];
|
||||
this.terminalMode = UltraTerminalModes.VALUES[tag.getInteger(MODE)];
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -229,7 +229,8 @@ public class UltraTerminalButtons implements ICustomButtonDataObject {
|
||||
public void readByte(ByteBuf buf) {
|
||||
this.reStock = buf.readBoolean();
|
||||
this.magnetMode = WirelessMagnet.Mode.values()[buf.readInt()];
|
||||
this.terminalMode = UltraTerminalModes.values()[buf.readInt()];
|
||||
this.terminalMode = UltraTerminalModes.VALUES[buf.readInt()];
|
||||
ItemWirelessUltraTerminal.setMode(this.terminal, this.terminalMode);
|
||||
|
||||
toggleMagnetButtonsVisibility();
|
||||
toggleRestockVisibility();
|
||||
|
||||
@@ -67,6 +67,8 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
|
||||
this.registerApp(22, "SWITCH", "DISABLE", "disable");
|
||||
this.registerApp(23, "OPEN_GUI", "YES", "open_gui");
|
||||
this.registerApp(24, "HIGHLIGHT", "YES", "block_highlight");
|
||||
this.registerApp(26, "stock mode button", "normalMode", "Normal.mode");
|
||||
this.registerApp(27, "stock mode button", "fullstockMode", "Full-stock.mode");
|
||||
this.registerApp(30, "MAGNET_CARD", "INV", "magnet_card.inv");
|
||||
this.registerApp(30, "MAGNET_CARD", "ME", "magnet_card.me");
|
||||
this.registerApp(30, "MAGNET_CARD", "FILTER", "magnet_card.filter");
|
||||
|
||||
@@ -29,6 +29,8 @@ import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.client.gui.GuiSub;
|
||||
import appeng.client.gui.slots.VirtualMEPhantomSlot;
|
||||
import appeng.client.gui.widgets.GuiTabButton;
|
||||
import appeng.client.gui.widgets.GuiToggleButton;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.util.calculators.ArithHelper;
|
||||
import appeng.util.calculators.Calculator;
|
||||
|
||||
@@ -40,6 +42,7 @@ public class GuiLevelMaintainer extends GuiSub {
|
||||
private final MouseRegionManager mouseRegions = new MouseRegionManager(this);
|
||||
private Widget focusedWidget;
|
||||
private final FontRenderer render;
|
||||
private GuiToggleButton liteMode;
|
||||
|
||||
public GuiLevelMaintainer(InventoryPlayer ipl, TileLevelMaintainer tile) {
|
||||
super(new ContainerLevelMaintainer(ipl, tile));
|
||||
@@ -88,6 +91,15 @@ public class GuiLevelMaintainer extends GuiSub {
|
||||
this.buttonList,
|
||||
this.cont);
|
||||
}
|
||||
this.buttonList.add(
|
||||
this.liteMode = new GuiToggleButton(
|
||||
guiLeft - 18,
|
||||
guiTop + 2,
|
||||
178,
|
||||
194,
|
||||
GuiText.CraftingModeLite.getLocal(),
|
||||
NameConst.TT_LEVEL_MAINTAINER_LITE_CRAFT_DESC));
|
||||
this.liteMode.setState(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -131,19 +143,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);
|
||||
}
|
||||
@@ -164,12 +172,48 @@ public class GuiLevelMaintainer extends GuiSub {
|
||||
|
||||
if (key == Keyboard.KEY_RETURN || key == Keyboard.KEY_NUMPADENTER) {
|
||||
this.component[this.focusedWidget.componentIndex].submit();
|
||||
this.focusedWidget.textField.setFocused(false);
|
||||
this.focusedWidget = null;
|
||||
this.focusWidget(null);
|
||||
}
|
||||
|
||||
if (key == Keyboard.KEY_TAB) {
|
||||
this.focusAdjacentWidget(isShiftKeyDown());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void focusWidget(@Nullable Widget widget) {
|
||||
if (this.focusedWidget != null) {
|
||||
this.focusedWidget.textField.setFocused(false);
|
||||
}
|
||||
this.focusedWidget = widget;
|
||||
if (this.focusedWidget != null) {
|
||||
this.focusedWidget.textField.setFocused(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void focusAdjacentWidget(boolean backwards) {
|
||||
this.focusedWidget.validate();
|
||||
this.focusWidget(this.getAdjacentWidget(backwards));
|
||||
}
|
||||
|
||||
private Widget getAdjacentWidget(boolean backwards) {
|
||||
int index = this.focusedWidget.componentIndex;
|
||||
boolean isBatch = this.focusedWidget.action == Action.Batch;
|
||||
|
||||
if (backwards) {
|
||||
if (isBatch) {
|
||||
return this.component[index].getQty();
|
||||
}
|
||||
return this.component[(index + TileLevelMaintainer.REQ_COUNT - 1) % TileLevelMaintainer.REQ_COUNT]
|
||||
.getBatch();
|
||||
}
|
||||
|
||||
if (isBatch) {
|
||||
return this.component[(index + 1) % TileLevelMaintainer.REQ_COUNT].getQty();
|
||||
}
|
||||
return this.component[index].getBatch();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
for (Component com : this.component) {
|
||||
@@ -177,6 +221,14 @@ public class GuiLevelMaintainer extends GuiSub {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (btn == this.liteMode) {
|
||||
if (isShiftKeyDown()) {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.ClearLiteMode));
|
||||
} else {
|
||||
FluidCraft.proxy.netHandler.sendToServer(new CPacketLevelMaintainer(Action.ToggleLiteMode));
|
||||
}
|
||||
return;
|
||||
}
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
|
||||
@@ -195,6 +247,10 @@ public class GuiLevelMaintainer extends GuiSub {
|
||||
component[index].setState(state);
|
||||
}
|
||||
|
||||
public void updateComponent(boolean isLiteMode) {
|
||||
this.liteMode.setState(isLiteMode);
|
||||
}
|
||||
|
||||
private static boolean acceptType(VirtualMEPhantomSlot slot, IAEStackType<?> type, int mouseButton) {
|
||||
return true;
|
||||
}
|
||||
@@ -307,43 +363,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;
|
||||
@@ -131,7 +130,6 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
masterList.markDirty();
|
||||
}
|
||||
};
|
||||
searchFieldNames.setFocused(true);
|
||||
extraOptionsText.add(ButtonToolTips.HighlightInterface.getLocal());
|
||||
online = true;
|
||||
}
|
||||
@@ -176,6 +174,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
|
||||
searchFieldNames.x = guiLeft + Math.max(32, offsetX) + 99;
|
||||
searchFieldNames.y = guiTop + 38;
|
||||
searchFieldNames.setFocused(true);
|
||||
|
||||
terminalStyleBox.xPosition = guiLeft - 18;
|
||||
terminalStyleBox.yPosition = guiTop + 8;
|
||||
@@ -241,12 +240,12 @@ 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 (!ModAndClassUtil.NEI && tooltipStack != null) {
|
||||
renderToolTip(tooltipStack, mouseX, mouseY);
|
||||
@@ -395,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
|
||||
*/
|
||||
@@ -563,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;
|
||||
@@ -585,16 +584,16 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
if (!tooltip) {
|
||||
if (entry.filteredRecipes[slotIdx]) {
|
||||
GL11.glTranslatef(0.0f, 0.0f, ITEM_STACK_OVERLAY_Z);
|
||||
drawRect(0, 0, 16, 16, GuiColors.ItemSlotOverlayUnpowered.getColor());
|
||||
drawRect(0, 0, 16, 16, FCGuiColors.itemSlotOverlayUnpowered.getColor());
|
||||
}
|
||||
} else {
|
||||
tooltipStack = Platform.stackConvert(aes).getItemStack();
|
||||
tooltipStack = aes.getItemStackForNEI();
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
} else if (entry.filteredRecipes[slotIdx]) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef(colLeft, viewY + rowYTop + 1, ITEM_STACK_OVERLAY_Z);
|
||||
drawRect(0, 0, 16, 16, GuiColors.ItemSlotOverlayUnpowered.getColor());
|
||||
drawRect(0, 0, 16, 16, FCGuiColors.itemSlotOverlayUnpowered.getColor());
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
if (tooltip) {
|
||||
@@ -860,18 +859,13 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
}
|
||||
}
|
||||
|
||||
private boolean itemStackMatchesSearchTerm(final ItemStack itemStack, final String searchTerm) {
|
||||
if (itemStack == null) {
|
||||
private boolean stackMatchesSearchTerm(final IAEStack<?> stack, final String searchTerm) {
|
||||
if (stack == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final String displayName = Platform.getItemDisplayName(itemStack).toLowerCase();
|
||||
|
||||
if (displayName.contains(searchTerm)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
final String displayName = stack.getDisplayName();
|
||||
return displayName != null && displayName.toLowerCase().contains(searchTerm);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1109,9 +1103,7 @@ public class GuiLevelTerminal extends FCBaseMEGui implements IDropToFillTextFiel
|
||||
continue;
|
||||
}
|
||||
|
||||
if (itemStackMatchesSearchTerm(
|
||||
Platform.stackConvert(entry.infoList[i].stack).getItemStack(),
|
||||
output)) {
|
||||
if (stackMatchesSearchTerm(entry.infoList[i].stack, output)) {
|
||||
shouldAdd = true;
|
||||
entry.filteredRecipes[i] = false;
|
||||
} else {
|
||||
|
||||
@@ -1,101 +1,119 @@
|
||||
package com.glodblock.github.client.gui;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.gui.container.ContainerSuperStockReplenisher;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.common.tile.TileSuperStockReplenisher;
|
||||
|
||||
import appeng.api.storage.StorageName;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotFake;
|
||||
import appeng.client.gui.slots.VirtualMEPhantomSlot;
|
||||
import appeng.client.gui.slots.VirtualMEPhantomSlotPrecise;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||
import appeng.core.sync.packets.PacketVirtualSlot;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import appeng.util.item.AEFluidStackType;
|
||||
import appeng.util.item.AEItemStackType;
|
||||
|
||||
public class GuiSuperStockReplenisher extends AEBaseGui {
|
||||
|
||||
private static final ResourceLocation TEX_BG = FluidCraft.resource("textures/gui/superStockReplenisher.png");
|
||||
private final DecimalFormat df = new DecimalFormat("#.#");
|
||||
private Map<Integer, IAEStack<?>> list = new HashMap<>();
|
||||
private final ContainerSuperStockReplenisher containerSuperStockReplenisher;
|
||||
private final TileSuperStockReplenisher tileSuperStockReplenisher;
|
||||
|
||||
private final VirtualMEPhantomSlotPrecise[] configFluidsSlots = new VirtualMEPhantomSlotPrecise[9];
|
||||
private final VirtualMEPhantomSlotPrecise[] configItemsSlots = new VirtualMEPhantomSlotPrecise[63];
|
||||
|
||||
private GuiFCImgButton StockModeButton;
|
||||
|
||||
public GuiSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockReplenisher tile) {
|
||||
super(new ContainerSuperStockReplenisher(ipl, tile));
|
||||
|
||||
this.containerSuperStockReplenisher = (ContainerSuperStockReplenisher) inventorySlots;
|
||||
this.tileSuperStockReplenisher = tile;
|
||||
|
||||
this.ySize = 251;
|
||||
this.xSize = 216;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleMouseClick(Slot slot, int slotIdx, int ctrlDown, int mouseButton) {
|
||||
if (mouseButton == 3) {
|
||||
if (slot instanceof SlotFake) {
|
||||
if (slot.getHasStack()) {
|
||||
IAEItemStack stack = AEItemStack.create(slot.getStack());
|
||||
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
|
||||
for (int i = 0; i < this.inventorySlots.inventorySlots.size(); i++) {
|
||||
if (slot.equals(this.inventorySlots.inventorySlots.get(i))) {
|
||||
NetworkHandler.instance
|
||||
.sendToServer(new PacketSwitchGuis(GuiBridge.GUI_PATTERN_VALUE_AMOUNT));
|
||||
NetworkHandler.instance
|
||||
.sendToServer(new PacketVirtualSlot(StorageName.CRAFTING_INPUT, i, stack));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
this.StockModeButton = new GuiFCImgButton(
|
||||
guiLeft - 18,
|
||||
guiTop + 8,
|
||||
"stock mode button",
|
||||
this.containerSuperStockReplenisher.isFullStockMode() ? "fullstockMode" : "normalMode",
|
||||
true);
|
||||
this.containerSuperStockReplenisher.setModeButton(this.StockModeButton);
|
||||
buttonList.add(this.StockModeButton);
|
||||
this.initSlots();
|
||||
}
|
||||
|
||||
private void initSlots() {
|
||||
|
||||
final int xo = 8;
|
||||
final int yo = 8;
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
VirtualMEPhantomSlotPrecise slot = new VirtualMEPhantomSlotPrecise(
|
||||
xo + i * 18,
|
||||
yo,
|
||||
this.containerSuperStockReplenisher.configFluidsSlots,
|
||||
i,
|
||||
this::acceptType);
|
||||
this.configFluidsSlots[i] = slot;
|
||||
this.registerVirtualSlots(slot);
|
||||
}
|
||||
|
||||
final int iyo = 29;
|
||||
for (int y = 0; y < 7; y++) {
|
||||
for (int ix = 0; ix < 9; ix++) {
|
||||
VirtualMEPhantomSlotPrecise slot = new VirtualMEPhantomSlotPrecise(
|
||||
xo + ix * 18,
|
||||
iyo + y * 18,
|
||||
this.containerSuperStockReplenisher.configItemsSlots,
|
||||
y * 9 + ix,
|
||||
this::acceptType);
|
||||
this.configItemsSlots[y * 9 + ix] = slot;
|
||||
this.registerVirtualSlots(slot);
|
||||
}
|
||||
}
|
||||
super.handleMouseClick(slot, slotIdx, ctrlDown, mouseButton);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_146977_a(Slot s) {
|
||||
if (s instanceof SlotFake) {
|
||||
this.drawFillStatus(s);
|
||||
}
|
||||
super.func_146977_a(s);
|
||||
}
|
||||
private void drawFillStatus(VirtualMEPhantomSlotPrecise virtualSlot) {
|
||||
final int offsetX = virtualSlot.getX() - 8;
|
||||
final int offsetY = virtualSlot.getY() - 12;
|
||||
final IAEStack<?> aes = virtualSlot.getAEStack();
|
||||
final long stackSize = aes != null ? aes.getStackSize() : 0;
|
||||
final int slotIndex = virtualSlot.getStorageName() == StorageName.NONE ? virtualSlot.getSlotIndex()
|
||||
: virtualSlot.getSlotIndex() + 100;
|
||||
|
||||
private void drawFillStatus(Slot slotIn) {
|
||||
int offsetX = slotIn.xDisplayPosition - 8;
|
||||
int offsetY = slotIn.yDisplayPosition - 11;
|
||||
ItemStack itemstack = slotIn.getStack();
|
||||
int slotInt = slotIn.slotNumber;
|
||||
if (itemstack != null) {
|
||||
if (stackSize != 0) {
|
||||
String s = "0%";
|
||||
if (slotInt > 0 && slotInt < 10) {
|
||||
IAEStack<?> aeStack = list.get(slotInt - 1);
|
||||
if (aeStack != null)
|
||||
s = (int) (((float) aeStack.getStackSize() / ItemFluidPacket.getFluidAmount(itemstack)) * 100)
|
||||
+ "%";
|
||||
} else if (slotInt > 9 && slotInt < 73) {
|
||||
IAEStack<?> aeStack = list.get(slotInt + 90);
|
||||
if (aeStack != null && itemstack.stackSize > 0) {
|
||||
long i = aeStack.getStackSize();
|
||||
s = (int) (((float) i / itemstack.stackSize) * 100) + "%";
|
||||
}
|
||||
}
|
||||
IAEStack<?> aeStack = list.get(slotIndex);
|
||||
|
||||
if (aeStack != null) s = df.format((float) aeStack.getStackSize() / stackSize * 100) + "%";
|
||||
|
||||
float scale = 0.5f;
|
||||
float shiftX = 2;
|
||||
float shiftY = 1;
|
||||
final float inverseScaleFactor = 1.0f / scale;
|
||||
|
||||
final int X = (int) (((float) offsetX - shiftX + 10.0f) * inverseScaleFactor);
|
||||
final int Y = (int) (((float) offsetY - shiftY + 16.0f - 7.0f * scale) * inverseScaleFactor);
|
||||
final int X = (int) (((float) offsetX - shiftX + 10.0f) * inverseScaleFactor) + 1;
|
||||
final int Y = (int) (((float) offsetY - shiftY + 16.0f - 7.0f * scale) * inverseScaleFactor) + 2;
|
||||
GL11.glTranslatef(0.0f, 0.0f, 200.0f);
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
this.fontRendererObj.drawStringWithShadow(s, X, Y, 16777215);
|
||||
@@ -104,9 +122,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
|
||||
@@ -115,7 +139,25 @@ public class GuiSuperStockReplenisher extends AEBaseGui {
|
||||
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
if (actionPerformedCustomButtons(btn)) return;
|
||||
if (btn == StockModeButton) {
|
||||
boolean newMode = !containerSuperStockReplenisher.isFullStockMode();
|
||||
this.containerSuperStockReplenisher.setFullStockMode(newMode);
|
||||
StockModeButton.set(newMode ? "fullstockMode" : "normalMode");
|
||||
|
||||
this.flushPendingSync();
|
||||
}
|
||||
super.actionPerformed(btn);
|
||||
}
|
||||
|
||||
public void update(Map<Integer, IAEStack<?>> map) {
|
||||
this.list = map;
|
||||
}
|
||||
|
||||
private boolean acceptType(VirtualMEPhantomSlot slot, IAEStackType<?> type, int mouseButton) {
|
||||
if (slot.getStorageName() == StorageName.NONE) return type == AEFluidStackType.FLUID_STACK_TYPE;
|
||||
else return type == AEItemStackType.ITEM_STACK_TYPE;
|
||||
}
|
||||
}
|
||||
+11
-1
@@ -1,7 +1,10 @@
|
||||
package com.glodblock.github.client.gui.container;
|
||||
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.DROP;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.PACKET;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import com.glodblock.github.common.tile.TileFluidPacketDecoder;
|
||||
@@ -13,7 +16,14 @@ public class ContainerFluidPacketDecoder extends AEBaseContainer {
|
||||
|
||||
public ContainerFluidPacketDecoder(InventoryPlayer ipl, TileFluidPacketDecoder tile) {
|
||||
super(ipl, tile);
|
||||
addSlotToContainer(new FCSlotRestrictedInput(PACKET.stack(), tile.getInventory(), 0, 80, 35, ipl));
|
||||
addSlotToContainer(
|
||||
new FCSlotRestrictedInput(
|
||||
Arrays.asList(PACKET.stack(), DROP.stack()),
|
||||
tile.getInventory(),
|
||||
0,
|
||||
80,
|
||||
35,
|
||||
ipl));
|
||||
bindPlayerInventory(ipl, 0, 84);
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -110,7 +110,7 @@ public class ContainerLevelMaintainer extends ContainerSubGui implements IVirtua
|
||||
(EntityPlayerMP) this.getInventoryPlayer().player);
|
||||
}
|
||||
FluidCraft.proxy.netHandler.sendTo(
|
||||
new SPacketLevelMaintainerGuiUpdate(this.tile.requests, !this.isFirstUpdate),
|
||||
new SPacketLevelMaintainerGuiUpdate(this.tile.requests, !this.isFirstUpdate, this.tile.isLiteMode()),
|
||||
(EntityPlayerMP) this.getInventoryPlayer().player);
|
||||
this.isFirstUpdate = false;
|
||||
this.updateCount = 0;
|
||||
@@ -126,7 +126,7 @@ public class ContainerLevelMaintainer extends ContainerSubGui implements IVirtua
|
||||
NetworkHandler.instance
|
||||
.sendTo(new PacketVirtualSlot(StorageName.NONE, slotStacks), (EntityPlayerMP) player);
|
||||
FluidCraft.proxy.netHandler.sendTo(
|
||||
new SPacketLevelMaintainerGuiUpdate(this.tile.requests, false),
|
||||
new SPacketLevelMaintainerGuiUpdate(this.tile.requests, false, this.tile.isLiteMode()),
|
||||
(EntityPlayerMP) player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,9 +155,9 @@ public class ContainerLevelTerminal extends FCBaseContainer {
|
||||
if (update == null) update = new SPacketLevelTerminalUpdate();
|
||||
update.addOverwriteSlotEntry(knownTracker.id, i, null);
|
||||
} else if (!Platform.isStacksIdentical(prev[i].stack, curr[i].stack)
|
||||
|| prev[i].quantity == curr[i].quantity
|
||||
|| prev[i].batchSize == curr[i].batchSize
|
||||
|| prev[i].state == curr[i].state) {
|
||||
|| prev[i].quantity != curr[i].quantity
|
||||
|| prev[i].batchSize != curr[i].batchSize
|
||||
|| prev[i].state != curr[i].state) {
|
||||
knownTracker.infoList[i] = curr[i];
|
||||
if (update == null) update = new SPacketLevelTerminalUpdate();
|
||||
update.addOverwriteSlotEntry(knownTracker.id, i, curr[i]);
|
||||
|
||||
+82
-112
@@ -3,63 +3,70 @@ package com.glodblock.github.client.gui.container;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.item.FCBaseItemCell;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.client.gui.GuiFCImgButton;
|
||||
import com.glodblock.github.common.tile.TileSuperStockReplenisher;
|
||||
import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.inventory.slot.OptionalFluidSlotFake;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.network.SPacketSuperStockReplenisherUpdate;
|
||||
import com.glodblock.github.util.FluidPrimaryGui;
|
||||
|
||||
import appeng.api.implementations.items.IStorageCell;
|
||||
import appeng.api.storage.StorageName;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.client.gui.implementations.GuiPatternItemRenamer;
|
||||
import appeng.client.gui.implementations.GuiPatternValueAmount;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerOpenContext;
|
||||
import appeng.container.PrimaryGui;
|
||||
import appeng.container.interfaces.IVirtualSlotHolder;
|
||||
import appeng.container.interfaces.IVirtualSlotSource;
|
||||
import appeng.container.slot.IOptionalSlotHost;
|
||||
import appeng.container.slot.SlotPatternOutputs;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketVirtualSlot;
|
||||
import appeng.items.storage.ItemBasicStorageCell;
|
||||
import appeng.container.sync.SyncManager;
|
||||
import appeng.container.sync.handlers.AEStackInventorySyncHandler;
|
||||
import appeng.container.sync.handlers.BooleanSyncHandler;
|
||||
import appeng.tile.inventory.IAEStackInventory;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ContainerSuperStockReplenisher extends AEBaseContainer
|
||||
implements IOptionalSlotHost, IVirtualSlotHolder, IVirtualSlotSource {
|
||||
public class ContainerSuperStockReplenisher extends AEBaseContainer implements IVirtualSlotSource {
|
||||
|
||||
private final TileSuperStockReplenisher tile;
|
||||
private final IInventory configFluids;
|
||||
private final IInventory configItems;
|
||||
private int lastUpdated = 0;
|
||||
|
||||
private int lastUpdated = 1337;
|
||||
|
||||
private final IAEStackInventory configFluids;
|
||||
public final AEStackInventorySyncHandler configFluidsSlots;
|
||||
|
||||
private final IAEStackInventory configItems;
|
||||
public final AEStackInventorySyncHandler configItemsSlots;
|
||||
|
||||
public final BooleanSyncHandler fullStockModeSync;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private GuiFCImgButton modeButton;
|
||||
|
||||
public ContainerSuperStockReplenisher(InventoryPlayer ipl, TileSuperStockReplenisher tile) {
|
||||
super(ipl, tile);
|
||||
this.tile = tile;
|
||||
configFluids = tile.getConfigFluid();
|
||||
configItems = tile.getConfigItems();
|
||||
this.configFluids = tile.getConfigFluids();
|
||||
this.configItems = tile.getConfigItems();
|
||||
final IInventory cell = tile.getCell();
|
||||
|
||||
final int x = 8;
|
||||
final int fy = 8;
|
||||
final SyncManager sm = this.getSyncManager();
|
||||
this.configFluidsSlots = sm.root().aeStackInventory("fluidConfig", this.configFluids);
|
||||
this.configItemsSlots = sm.root().aeStackInventory("itemConfig", this.configItems);
|
||||
this.fullStockModeSync = sm.root().booleanSync("fullstockMode").onClientChange((oldValue, newValue) -> {
|
||||
if (this.modeButton != null) {
|
||||
this.modeButton.set(newValue ? "fullstockMode" : "normalMode");
|
||||
}
|
||||
}).onServerChange((oldValue, newValue) -> this.tile.setFullStockMode(newValue));
|
||||
|
||||
this.addSlotToContainer(
|
||||
new SlotRestrictedInput(
|
||||
@@ -67,56 +74,38 @@ public class ContainerSuperStockReplenisher extends AEBaseContainer
|
||||
cell,
|
||||
0,
|
||||
173,
|
||||
fy,
|
||||
8,
|
||||
this.getInventoryPlayer()));
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
addSlotToContainer(new OptionalFluidSlotFake(configFluids, this, i, x, fy, i, 0, 0));
|
||||
}
|
||||
|
||||
final int io = 29;
|
||||
for (int y = 0; y < 7; y++) {
|
||||
for (int ix = 0; ix < 9; ix++) {
|
||||
this.addSlotToContainer(new SlotPatternOutputs(configItems, this, y * 9 + ix, x, io, ix, y, y));
|
||||
}
|
||||
}
|
||||
|
||||
bindPlayerInventory(ipl, 0, 251 - 82);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setModeButton(GuiFCImgButton button) {
|
||||
this.modeButton = button;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack slotClick(int slotId, int clickedButton, int mode, EntityPlayer player) {
|
||||
if (slotId == 0 && player.inventory.getItemStack() == null && isConfigurated()) {
|
||||
return null;
|
||||
}
|
||||
if (slotId == 0 && player.inventory.getItemStack() == null && isConfigurated()) return null;
|
||||
return super.slotClick(slotId, clickedButton, mode, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlotEnabled(int idx) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting p_75132_1_) {
|
||||
super.addCraftingToCrafters(p_75132_1_);
|
||||
lastUpdated = 24;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
super.detectAndSendChanges();
|
||||
if (Platform.isClient()) return;
|
||||
|
||||
if (lastUpdated > 20) {
|
||||
lastUpdated = 0;
|
||||
if (this.lastUpdated > 20) {
|
||||
this.lastUpdated = 0;
|
||||
Map<Integer, IAEStack<?>> tmp = new HashMap<>();
|
||||
|
||||
for (int i = 0; i < tile.getInternalFluid().getSlots(); i++) {
|
||||
tmp.put(i, tile.getInternalFluid().getFluidInSlot(i));
|
||||
for (int i = 0; i < this.tile.getInternalFluid().getSlots(); i++) {
|
||||
tmp.put(i, this.tile.getInternalFluid().getFluidInSlot(i));
|
||||
}
|
||||
|
||||
for (int i = 0; i < tile.getInternalInventory().getSizeInventory(); i++) {
|
||||
tmp.put(i + 100, AEItemStack.create(tile.getInternalInventory().getStackInSlot(i)));
|
||||
for (int i = 0; i < this.tile.getInternalInventory().getSizeInventory(); i++) {
|
||||
tmp.put(i + 100, AEItemStack.create(this.tile.getInternalInventory().getStackInSlot(i)));
|
||||
}
|
||||
|
||||
for (final Object g : this.crafters) {
|
||||
@@ -124,21 +113,20 @@ public class ContainerSuperStockReplenisher extends AEBaseContainer
|
||||
FluidCraft.proxy.netHandler.sendTo(new SPacketSuperStockReplenisherUpdate(tmp), (EntityPlayerMP) g);
|
||||
}
|
||||
}
|
||||
|
||||
if (Platform.isServer()) this.setFullStockMode(this.tile.isFullStockMode());
|
||||
|
||||
}
|
||||
lastUpdated++;
|
||||
|
||||
this.lastUpdated++;
|
||||
}
|
||||
|
||||
private boolean isConfigurated() {
|
||||
for (int i = 0; i < configItems.getSizeInventory(); i++) {
|
||||
if (configItems.getStackInSlot(i) != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < configFluids.getSizeInventory(); i++) {
|
||||
if (configFluids.getStackInSlot(i) != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < this.configItems.getSizeInventory(); i++)
|
||||
if (this.configItems.getAEStackInSlot(i) != null) return true;
|
||||
|
||||
for (int i = 0; i < this.configFluids.getSizeInventory(); i++)
|
||||
if (this.configFluids.getAEStackInSlot(i) != null) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -148,17 +136,9 @@ public class ContainerSuperStockReplenisher extends AEBaseContainer
|
||||
long currentBytes = 0;
|
||||
long newBytes = -1;
|
||||
|
||||
if (s.getStack().getItem() instanceof ItemBasicStorageCell ibsc) {
|
||||
currentBytes = ibsc.getBytesLong(is);
|
||||
} else if (s.getStack().getItem() instanceof FCBaseItemCell fcbic) {
|
||||
currentBytes = fcbic.getBytes(is);
|
||||
}
|
||||
if (s.getStack().getItem() instanceof IStorageCell isc) currentBytes = isc.getBytesLong(is);
|
||||
|
||||
if (is.getItem() instanceof ItemBasicStorageCell ibsc) {
|
||||
newBytes = ibsc.getBytesLong(is);
|
||||
} else if (is.getItem() instanceof FCBaseItemCell fcbic) {
|
||||
newBytes = fcbic.getBytes(is);
|
||||
}
|
||||
if (is.getItem() instanceof IStorageCell isc) newBytes = isc.getBytesLong(is);
|
||||
|
||||
if (currentBytes > newBytes) {
|
||||
return false;
|
||||
@@ -167,10 +147,6 @@ public class ContainerSuperStockReplenisher extends AEBaseContainer
|
||||
return super.isValidForSlot(s, is);
|
||||
}
|
||||
|
||||
public TileSuperStockReplenisher getTile() {
|
||||
return tile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PrimaryGui createPrimaryGui() {
|
||||
ContainerOpenContext context = getOpenContext();
|
||||
@@ -181,40 +157,34 @@ public class ContainerSuperStockReplenisher extends AEBaseContainer
|
||||
context.getSide());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveSlotStacks(StorageName invName, Int2ObjectMap<IAEStack<?>> slotStacks) {
|
||||
var entry = slotStacks.int2ObjectEntrySet().iterator().next();
|
||||
IAEStack<?> aes = entry.getValue();
|
||||
int slotIndex = entry.getIntKey();
|
||||
|
||||
if (Platform.isServer()) {
|
||||
for (ICrafting crafter : this.crafters) {
|
||||
final EntityPlayerMP emp = (EntityPlayerMP) crafter;
|
||||
NetworkHandler.instance.sendTo(new PacketVirtualSlot(invName, slotIndex, aes), emp);
|
||||
}
|
||||
} else {
|
||||
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
|
||||
if (gs instanceof GuiPatternValueAmount gpva) {
|
||||
gpva.update();
|
||||
} else if (gs instanceof GuiPatternItemRenamer gpir) {
|
||||
gpir.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateVirtualSlot(StorageName invName, int slotId, IAEStack<?> aes) {
|
||||
if (aes instanceof IAEItemStack ais) {
|
||||
ItemStack newIs;
|
||||
if (ais.getItem() instanceof ItemFluidPacket) {
|
||||
newIs = ais.getItemStack();
|
||||
newIs.stackSize = 1;
|
||||
ItemFluidPacket.setFluidAmount(newIs, aes.getStackSize());
|
||||
} else {
|
||||
newIs = ais.getItemStack();
|
||||
if (aes != null && aes.getStackSize() > Integer.MAX_VALUE) aes.setStackSize(Integer.MAX_VALUE);
|
||||
switch (invName) {
|
||||
case NONE -> {
|
||||
this.configFluids.putAEStackInSlot(slotId, aes);
|
||||
this.configFluidsSlots.markDirty();
|
||||
}
|
||||
case CONFIG -> {
|
||||
this.configItems.putAEStackInSlot(slotId, aes);
|
||||
this.configItemsSlots.markDirty();
|
||||
}
|
||||
this.inventorySlots.get(slotId).putStack(newIs);
|
||||
}
|
||||
}
|
||||
|
||||
public TileSuperStockReplenisher getTile() {
|
||||
return this.tile;
|
||||
}
|
||||
|
||||
public boolean isFullStockMode() {
|
||||
return this.fullStockModeSync.get();
|
||||
}
|
||||
|
||||
public void setFullStockMode(final boolean fullStockMode) {
|
||||
this.fullStockModeSync.set(fullStockMode);
|
||||
}
|
||||
|
||||
public void markDirty() {
|
||||
this.fullStockModeSync.markDirty();
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,12 @@ public class ItemPacketRender implements IItemRenderer {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
final boolean entity = type.equals(ItemRenderType.ENTITY);
|
||||
if (entity) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glRotated(90.0D, 0.0D, 1.0D, 0.0D);
|
||||
GL11.glTranslated(-0.5D, -0.6D, 0.0D);
|
||||
}
|
||||
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(item);
|
||||
int RGB = fluid == null ? 0xFFFFFF : fluid.getFluid().getColor(fluid);
|
||||
@@ -65,6 +71,9 @@ public class ItemPacketRender implements IItemRenderer {
|
||||
0.0625F);
|
||||
}
|
||||
|
||||
if (entity) {
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
}
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
package com.glodblock.github.client.render;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.tile.TileWalrus;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
|
||||
@@ -19,9 +14,6 @@ import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
|
||||
public class ItemWalrusRender implements IItemRenderer {
|
||||
|
||||
IModelCustom modelWalrus = AdvancedModelLoader.loadModel(FluidCraft.resource("models/walrus.obj"));
|
||||
ResourceLocation textureWalrus = FluidCraft.resource("textures/blocks/walrus.png");
|
||||
|
||||
public ItemWalrusRender() {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileWalrus.class, new RenderBlockWalrus());
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ItemAndBlockHolder.WALRUS), this);
|
||||
@@ -34,7 +26,6 @@ public class ItemWalrusRender implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(this.textureWalrus);
|
||||
GL11.glPushMatrix();
|
||||
switch (type) {
|
||||
case EQUIPPED_FIRST_PERSON -> {
|
||||
@@ -44,7 +35,7 @@ public class ItemWalrusRender implements IItemRenderer {
|
||||
case INVENTORY -> GL11.glTranslatef(-0.5F, -0.5F, -0.1F);
|
||||
default -> {}
|
||||
}
|
||||
this.modelWalrus.renderAll();
|
||||
WalrusRenderer.render();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,25 +1,16 @@
|
||||
package com.glodblock.github.client.render;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.tile.TileWalrus;
|
||||
|
||||
public class RenderBlockWalrus extends TileEntitySpecialRenderer {
|
||||
|
||||
IModelCustom modelWalrus = AdvancedModelLoader.loadModel(FluidCraft.resource("models/walrus.obj"));
|
||||
ResourceLocation textureWalrus = FluidCraft.resource("textures/blocks/walrus.png");
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTickTime) {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(this.textureWalrus);
|
||||
if (!(tileentity instanceof TileWalrus Tile)) return;
|
||||
float scale = Tile.getWalrusScale();
|
||||
GL11.glPushMatrix();
|
||||
@@ -42,7 +33,7 @@ public class RenderBlockWalrus extends TileEntitySpecialRenderer {
|
||||
break;
|
||||
}
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
this.modelWalrus.renderAll();
|
||||
WalrusRenderer.render();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.glodblock.github.client.render;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.gtnewhorizon.gtnhlib.client.model.wavefront.WavefrontVBOBuilder;
|
||||
import com.gtnewhorizon.gtnhlib.client.renderer.vao.IVertexArrayObject;
|
||||
|
||||
public final class WalrusRenderer {
|
||||
|
||||
private static IVertexArrayObject walrus;
|
||||
private static final ResourceLocation textureWalrus = FluidCraft.resource("textures/blocks/walrus.png");
|
||||
|
||||
public static void load() {
|
||||
walrus = WavefrontVBOBuilder.compileToVBO(FluidCraft.resource("models/walrus.obj"));
|
||||
}
|
||||
|
||||
public static void render() {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(textureWalrus);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
walrus.render();
|
||||
}
|
||||
}
|
||||
@@ -12,12 +12,6 @@ import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public enum FCPartsTexture {
|
||||
|
||||
PartFluidTerminal_Bright("fluid_terminal_bright"),
|
||||
PartFluidTerminal_Dark("fluid_terminal_dark"),
|
||||
PartFluidTerminal_Colored("fluid_terminal_medium"),
|
||||
PartFluidPatternTerminal_Bright("pattern_terminal_bright"),
|
||||
PartFluidPatternTerminal_Dark("pattern_terminal_dark"),
|
||||
PartFluidPatternTerminal_Colored("pattern_terminal_medium"),
|
||||
PartLevelTerminal_Bright("level_terminal_bright"),
|
||||
PartLevelTerminal_Dark("level_terminal_dark"),
|
||||
PartLevelTerminal_Colored("level_terminal_medium"),
|
||||
@@ -28,9 +22,15 @@ public enum FCPartsTexture {
|
||||
BlockFluidInterfaceAlternate_Arrow("fluid_interface_arrow"),
|
||||
BlockInterfaceAlternate("fluid_interface_a"),
|
||||
BlockInterface_Face("fluid_interface"),
|
||||
PartFluidLevelEmitter("fluid_level_emitter"),
|
||||
BlockLevelMaintainer("level_maintainer"),
|
||||
BlockLevelMaintainer_Active("level_maintainer_active");
|
||||
BlockLevelMaintainer_Active("level_maintainer_active"),
|
||||
PartFluidFormationPlane("fluid_formation_plane"),
|
||||
PartFluidAnnihilationPlane("fluid_annihilation_plane"),
|
||||
PartFluidFormationPlaneOn("fluid_formation_plane_on"),
|
||||
PartFluidAnnihilationPlaneOn("fluid_annihilation_plane_on"),
|
||||
BlockMEChestFluid_Bright("fluid_terminal_light"),
|
||||
BlockMEChestFluid_Dark("fluid_terminal_dark"),
|
||||
BlockMEChestFluid_Medium("fluid_terminal_medium");
|
||||
|
||||
private final String name;
|
||||
public net.minecraft.util.IIcon IIcon;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,6 @@ import com.google.common.base.Optional;
|
||||
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.items.AEBaseCell;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public abstract class FCBaseItemCell extends AEBaseCell {
|
||||
|
||||
@@ -53,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());
|
||||
@@ -102,7 +103,7 @@ public class ItemBaseWirelessTerminal extends ToolWirelessTerminal implements II
|
||||
Item item = is.getItem();
|
||||
if (item instanceof ItemWirelessUltraTerminal) {
|
||||
if (!is.hasTagCompound()) is.setTagCompound(new NBTTagCompound());
|
||||
return UltraTerminalModes.values()[is.getTagCompound().getInteger(MODE)];
|
||||
return UltraTerminalModes.VALUES[is.getTagCompound().getInteger(MODE)];
|
||||
} else if (item instanceof ItemWirelessPatternTerminal) {
|
||||
return UltraTerminalModes.PATTERN;
|
||||
} else if (item instanceof ItemWirelessInterfaceTerminal) {
|
||||
|
||||
+9
-9
@@ -8,7 +8,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
import com.glodblock.github.common.parts.PartFluidConversionMonitor;
|
||||
import com.glodblock.github.common.parts.PartFluidAnnihilationPlane;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
@@ -18,11 +18,11 @@ 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);
|
||||
}
|
||||
|
||||
@@ -33,15 +33,15 @@ public class ItemFluidConversionMonitor extends FCBaseItem implements IPartItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemFluidConversionMonitor register() {
|
||||
GameRegistry.registerItem(this, NameConst.ITEM_PART_FLUID_CONVERSION_MONITOR, FluidCraft.MODID);
|
||||
public ItemFluidAnnihilationPlane register() {
|
||||
GameRegistry.registerItem(this, NameConst.ITEM_PART_FLUID_ANNIHILATION_PLANE, FluidCraft.MODID);
|
||||
setCreativeTab(FluidCraftingTabs.INSTANCE);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconIndex(ItemStack p_77650_1_) {
|
||||
return FCPartsTexture.PartTerminalBroad.getIcon();
|
||||
return FCPartsTexture.PartFluidAnnihilationPlane.getIcon();
|
||||
}
|
||||
|
||||
public void registerIcons(IIconRegister _iconRegister) {}
|
||||
@@ -52,7 +52,7 @@ public class ItemFluidConversionMonitor extends FCBaseItem implements IPartItem
|
||||
}
|
||||
|
||||
@Override
|
||||
public PartFluidConversionMonitor createPartFromItemStack(ItemStack is) {
|
||||
return new PartFluidConversionMonitor(is);
|
||||
public PartFluidAnnihilationPlane createPartFromItemStack(ItemStack is) {
|
||||
return new PartFluidAnnihilationPlane(is);
|
||||
}
|
||||
}
|
||||
+9
-9
@@ -8,7 +8,7 @@ import net.minecraft.world.World;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
import com.glodblock.github.common.parts.PartFluidStorageMonitor;
|
||||
import com.glodblock.github.common.parts.PartFluidFormationPlane;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
@@ -18,11 +18,11 @@ 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);
|
||||
}
|
||||
|
||||
@@ -33,15 +33,15 @@ public class ItemFluidStorageMonitor extends FCBaseItem implements IPartItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemFluidStorageMonitor register() {
|
||||
GameRegistry.registerItem(this, NameConst.ITEM_PART_FLUID_STORAGE_MONITOR, FluidCraft.MODID);
|
||||
public ItemFluidFormationPlane register() {
|
||||
GameRegistry.registerItem(this, NameConst.ITEM_PART_FLUID_FORMATION_PLANE, FluidCraft.MODID);
|
||||
setCreativeTab(FluidCraftingTabs.INSTANCE);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconIndex(ItemStack p_77650_1_) {
|
||||
return FCPartsTexture.PartTerminalBroad.getIcon();
|
||||
return FCPartsTexture.PartFluidFormationPlane.getIcon();
|
||||
}
|
||||
|
||||
public void registerIcons(IIconRegister _iconRegister) {}
|
||||
@@ -52,7 +52,7 @@ public class ItemFluidStorageMonitor extends FCBaseItem implements IPartItem {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PartFluidStorageMonitor createPartFromItemStack(ItemStack is) {
|
||||
return new PartFluidStorageMonitor(is);
|
||||
public PartFluidFormationPlane createPartFromItemStack(ItemStack is) {
|
||||
return new PartFluidFormationPlane(is);
|
||||
}
|
||||
}
|
||||
@@ -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(stack, 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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(stack, 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(stack, 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,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(stack, 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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.glodblock.github.common.item;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.common.tabs.FluidCraftingTabs;
|
||||
import com.glodblock.github.loader.IRegister;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.core.features.AEFeature;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class ItemWirelessFluidTerminal extends ItemBaseWirelessTerminal
|
||||
implements IRegister<ItemWirelessFluidTerminal> {
|
||||
|
||||
public ItemWirelessFluidTerminal() {
|
||||
super(null);
|
||||
AEApi.instance().registries().wireless().registerWirelessHandler(this);
|
||||
this.setFeature(EnumSet.of(AEFeature.WirelessAccessTerminal, AEFeature.PoweredTools));
|
||||
setUnlocalizedName(NameConst.ITEM_WIRELESS_FLUID_TERMINAL);
|
||||
setTextureName(FluidCraft.resource(NameConst.ITEM_WIRELESS_FLUID_TERMINAL).toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemWirelessFluidTerminal register() {
|
||||
GameRegistry.registerItem(this, NameConst.ITEM_WIRELESS_FLUID_TERMINAL, FluidCraft.MODID);
|
||||
setCreativeTab(FluidCraftingTabs.INSTANCE);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getInventory(ItemStack stack, World world, int x, int y, int z, EntityPlayer player) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCheckedInformation(ItemStack stack, EntityPlayer player, List<String> lines,
|
||||
boolean displayMoreInfo) {
|
||||
lines.add("§4DEPRECATED!");
|
||||
super.addCheckedInformation(stack, player, lines, displayMoreInfo);
|
||||
}
|
||||
}
|
||||
@@ -167,15 +167,6 @@ public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
|
||||
this.openGui(is, w, player, mode, Integer.MIN_VALUE);
|
||||
}
|
||||
|
||||
public static boolean hasInfinityBoosterCard(EntityPlayer player) {
|
||||
ImmutablePair<Integer, ItemStack> term = Util.getUltraWirelessTerm(player);
|
||||
if (term == null) return false;
|
||||
if (term.getRight().getItem() instanceof ItemWirelessUltraTerminal) {
|
||||
return Util.hasInfinityBoosterCard(term.getRight());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWornTick(ItemStack itemStack, EntityLivingBase entityLivingBase) {
|
||||
if (Platform.isServer() && entityLivingBase instanceof EntityPlayer player) {
|
||||
@@ -203,7 +194,7 @@ public class ItemWirelessUltraTerminal extends ItemBaseWirelessTerminal
|
||||
public IGuiItemObject getGuiObject(ItemStack is, World world, EntityPlayer p, int x, int y, int z) {
|
||||
final IWirelessTermHandler wh = AEApi.instance().registries().wireless().getWirelessTerminalHandler(is);
|
||||
if (wh == null) return null;
|
||||
return switch (y != Integer.MIN_VALUE ? UltraTerminalModes.values()[y] : getMode(is)) {
|
||||
return switch (y != Integer.MIN_VALUE ? UltraTerminalModes.VALUES[y] : getMode(is)) {
|
||||
case CRAFTING -> new WirelessCraftingTerminalGuiObject(wh, is, p, world, x, y, z);
|
||||
case PATTERN, PATTERN_EX -> new WirelessPatternTerminalGuiObject(wh, is, p, world, x, y, z);
|
||||
case INTERFACE -> new WirelessInterfaceTerminalGuiObject(wh, is, x);
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.glodblock.github.common.parts;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
|
||||
import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.parts.automation.PartBaseAnnihilationPlane;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class PartFluidAnnihilationPlane extends PartBaseAnnihilationPlane {
|
||||
|
||||
public PartFluidAnnihilationPlane(ItemStack is) {
|
||||
super(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborChanged() {
|
||||
final DimensionalCoord self = this.getLocation();
|
||||
final IMEMonitor<IAEFluidStack> monitor;
|
||||
final IEnergyGrid power;
|
||||
|
||||
try {
|
||||
monitor = this.getProxy().getStorage().getFluidInventory();
|
||||
power = this.getProxy().getEnergy();
|
||||
} catch (GridAccessException ignored) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (monitor == null || power == null) return;
|
||||
final World world = this.tile.getWorldObj();
|
||||
final ForgeDirection side = getSide();
|
||||
final Block fluidBlock = world.getBlock(self.x + side.offsetX, self.y + side.offsetY, self.z + side.offsetZ);
|
||||
final int meta = world.getBlockMetadata(self.x + side.offsetX, self.y + side.offsetY, self.z + side.offsetZ);
|
||||
final BaseActionSource src = new MachineSource(this);
|
||||
|
||||
if (fluidBlock instanceof IFluidBlock block) {
|
||||
final FluidStack drained = block
|
||||
.drain(world, self.x + side.offsetX, self.y + side.offsetY, self.z + side.offsetZ, false);
|
||||
if (drained == null) return;
|
||||
final IAEFluidStack toInject = Util.FluidUtil.createAEFluidStack(drained);
|
||||
final IAEFluidStack notInjected = Platform
|
||||
.poweredInsert(power, monitor, toInject, src, Actionable.SIMULATE);
|
||||
if (notInjected != null) return;
|
||||
Platform.poweredInsert(power, monitor, toInject, src, Actionable.MODULATE);
|
||||
block.drain(world, self.x + side.offsetX, self.y + side.offsetY, self.z + side.offsetZ, true);
|
||||
} else if (meta == 0) {
|
||||
if (fluidBlock == Blocks.flowing_water || fluidBlock == Blocks.water) {
|
||||
final IAEFluidStack toInject = Util.FluidUtil.createAEFluidStack(FluidRegistry.WATER);
|
||||
final IAEFluidStack notInjected = Platform
|
||||
.poweredInsert(power, monitor, toInject, src, Actionable.SIMULATE);
|
||||
if (notInjected != null) return;
|
||||
Platform.poweredInsert(power, monitor, toInject, src, Actionable.MODULATE);
|
||||
world.setBlockToAir(self.x + side.offsetX, self.y + side.offsetY, self.z + side.offsetZ);
|
||||
} else if (fluidBlock == Blocks.flowing_lava || fluidBlock == Blocks.lava) {
|
||||
final IAEFluidStack toInject = Util.FluidUtil.createAEFluidStack(FluidRegistry.LAVA);
|
||||
final IAEFluidStack notInjected = Platform
|
||||
.poweredInsert(power, monitor, toInject, src, Actionable.SIMULATE);
|
||||
if (notInjected != null) return;
|
||||
Platform.poweredInsert(power, monitor, toInject, src, Actionable.MODULATE);
|
||||
world.setBlockToAir(self.x + side.offsetX, self.y + side.offsetY, self.z + side.offsetZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getActiveIcon() {
|
||||
return FCPartsTexture.PartFluidAnnihilationPlaneOn.getIcon();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,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,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,17 +16,23 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.glodblock.github.client.FluidInterfaceButtons;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.inventory.AEFluidInventory;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import com.glodblock.github.inventory.IDualHost;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.DualHostSettings;
|
||||
import com.glodblock.github.util.DualityFluidInterface;
|
||||
import com.glodblock.github.util.Util;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
@@ -29,10 +40,13 @@ import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.helpers.ICustomButtonDataObject;
|
||||
import appeng.helpers.ICustomButtonProvider;
|
||||
import appeng.parts.misc.PartInterface;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.util.SettingsFrom;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -90,6 +104,18 @@ public class PartFluidInterface extends PartInterface implements IDualHost, ICus
|
||||
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());
|
||||
@@ -127,6 +153,7 @@ public class PartFluidInterface extends PartInterface implements IDualHost, ICus
|
||||
config.readFromNBT(data, "ConfigInv");
|
||||
fluidDuality.loadConfigFromPacket(this.config);
|
||||
getInternalFluid().readFromNBT(data, "FluidInv");
|
||||
fluidDuality.readCraftingTrackerFromNBT(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,6 +161,21 @@ public class PartFluidInterface extends PartInterface implements IDualHost, ICus
|
||||
super.writeToNBT(data);
|
||||
config.writeToNBT(data, "ConfigInv");
|
||||
getInternalFluid().writeToNBT(data, "FluidInv");
|
||||
fluidDuality.writeCraftingTrackerToNBT(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadSettings(@NotNull SettingsFrom from, @NotNull NBTTagCompound compound) {
|
||||
super.uploadSettings(from, compound);
|
||||
DualHostSettings.uploadSettings(this, compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public NBTTagCompound downloadSettings(SettingsFrom from) {
|
||||
NBTTagCompound output = super.downloadSettings(from);
|
||||
DualHostSettings.downloadSettings(this, output);
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -141,6 +183,26 @@ public class PartFluidInterface extends PartInterface implements IDualHost, ICus
|
||||
return getInterfaceDuality().getInstalledUpgrades(u);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableSet<ICraftingLink> getRequestedJobs() {
|
||||
return ImmutableSet.<ICraftingLink>builder().addAll(super.getRequestedJobs())
|
||||
.addAll(fluidDuality.getRequestedJobs()).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEStack<?> injectCraftedItems(final ICraftingLink link, final IAEStack<?> items, final Actionable mode) {
|
||||
if (items instanceof IAEFluidStack) {
|
||||
return fluidDuality.injectCraftedItems(link, items, mode);
|
||||
}
|
||||
return super.injectCraftedItems(link, items, mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jobStateChange(final ICraftingLink link) {
|
||||
super.jobStateChange(link);
|
||||
fluidDuality.jobStateChange(link);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
return fluidDuality.fill(from, resource, doFill);
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
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.item.ItemFluidPacket;
|
||||
|
||||
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.helpers.Reflected;
|
||||
import appeng.parts.automation.PartLevelEmitter;
|
||||
|
||||
public class PartFluidLevelEmitter extends PartLevelEmitter {
|
||||
|
||||
@Reflected
|
||||
public PartFluidLevelEmitter(final ItemStack is) {
|
||||
super(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound data) {
|
||||
super.readFromNBT(data);
|
||||
|
||||
final IAEStack<?> aes = this.getAEInventoryByName(StorageName.CONFIG).getAEStackInSlot(0);
|
||||
if (aes instanceof IAEItemStack ais && ais.getItem() instanceof ItemFluidPacket) {
|
||||
this.getAEInventoryByName(StorageName.CONFIG).putAEStackInSlot(0, ItemFluidPacket.getFluidAEStack(ais));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IAEStackType<?> getUltraLegacyType() {
|
||||
return FLUID_STACK_TYPE;
|
||||
}
|
||||
}
|
||||
@@ -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,21 +17,29 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.glodblock.github.client.FluidInterfaceButtons;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.inventory.AEFluidInventory;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import com.glodblock.github.inventory.IDualHost;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.DualHostSettings;
|
||||
import com.glodblock.github.util.DualityFluidInterface;
|
||||
import com.glodblock.github.util.Util;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.implementations.items.IMemoryCard;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.helpers.DualityInterface;
|
||||
import appeng.helpers.ICustomButtonDataObject;
|
||||
@@ -35,6 +48,7 @@ import appeng.parts.p2p.PartP2PInterface;
|
||||
import appeng.parts.p2p.PartP2PTunnel;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.SettingsFrom;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -63,6 +77,13 @@ public class PartFluidP2PInterface extends PartP2PInterface implements IDualHost
|
||||
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);
|
||||
@@ -70,6 +91,7 @@ public class PartFluidP2PInterface extends PartP2PInterface implements IDualHost
|
||||
NBTTagCompound data = memoryCard.getData(is);
|
||||
if (newTunnel instanceof PartFluidP2PInterface p2PInterface) {
|
||||
p2PInterface.duality.getConfigManager().readFromNBT(data);
|
||||
DualHostSettings.uploadSettings(p2PInterface, data);
|
||||
}
|
||||
return newTunnel;
|
||||
}
|
||||
@@ -82,9 +104,41 @@ public class PartFluidP2PInterface extends PartP2PInterface implements IDualHost
|
||||
IConfigManager config = fromInterface.duality.getConfigManager();
|
||||
config.getSettings()
|
||||
.forEach(setting -> newDuality.getConfigManager().putSetting(setting, config.getSetting(setting)));
|
||||
DualHostSettings.copySettings(this, fromInterface);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadSettings(@NotNull SettingsFrom from, @NotNull NBTTagCompound compound) {
|
||||
super.uploadSettings(from, compound);
|
||||
DualHostSettings.uploadSettings(this, compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public NBTTagCompound downloadSettings(SettingsFrom from) {
|
||||
NBTTagCompound output = super.downloadSettings(from);
|
||||
DualHostSettings.downloadSettings(this, output);
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(final NBTTagCompound data) {
|
||||
super.readFromNBT(data);
|
||||
config.readFromNBT(data, "ConfigInv");
|
||||
dualityFluid.loadConfigFromPacket(this.config);
|
||||
dualityFluid.getInternalFluid().readFromNBT(data, "FluidInv");
|
||||
dualityFluid.readCraftingTrackerFromNBT(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(final NBTTagCompound data) {
|
||||
super.writeToNBT(data);
|
||||
config.writeToNBT(data, "ConfigInv");
|
||||
dualityFluid.getInternalFluid().writeToNBT(data, "FluidInv");
|
||||
dualityFluid.writeCraftingTrackerToNBT(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(IGridNode node) {
|
||||
TickingRequest item = duality.getTickingRequest(node);
|
||||
@@ -107,6 +161,26 @@ public class PartFluidP2PInterface extends PartP2PInterface implements IDualHost
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableSet<ICraftingLink> getRequestedJobs() {
|
||||
return ImmutableSet.<ICraftingLink>builder().addAll(super.getRequestedJobs())
|
||||
.addAll(dualityFluid.getRequestedJobs()).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEStack<?> injectCraftedItems(final ICraftingLink link, final IAEStack<?> items, final Actionable mode) {
|
||||
if (items instanceof IAEFluidStack) {
|
||||
return dualityFluid.injectCraftedItems(link, items, mode);
|
||||
}
|
||||
return super.injectCraftedItems(link, items, mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jobStateChange(final ICraftingLink link) {
|
||||
super.jobStateChange(link);
|
||||
dualityFluid.jobStateChange(link);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
return dualityFluid.fill(from, resource, doFill);
|
||||
@@ -159,6 +233,18 @@ public class PartFluidP2PInterface extends PartP2PInterface implements IDualHost
|
||||
return this.dualityFluid.getFluidInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IMEMonitor<?> getMEMonitor(@NotNull IAEStackType<?> type) {
|
||||
if (type == ITEM_STACK_TYPE) {
|
||||
return this.getItemInventory();
|
||||
} else if (type == FLUID_STACK_TYPE) {
|
||||
return this.getFluidInventory();
|
||||
}
|
||||
|
||||
return this.dualityFluid.getMEMonitor(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppEngInternalAEInventory getConfig() {
|
||||
Util.mirrorFluidToPacket(config, dualityFluid.getConfig());
|
||||
|
||||
@@ -3,7 +3,14 @@ package com.glodblock.github.common.parts;
|
||||
import static appeng.util.item.AEFluidStackType.FLUID_STACK_TYPE;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.storage.StorageName;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.parts.misc.PartStorageBus;
|
||||
|
||||
@@ -17,4 +24,20 @@ public class PartFluidStorageBus extends PartStorageBus {
|
||||
public IAEStackType<?> getStackType() {
|
||||
return FLUID_STACK_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound data) {
|
||||
super.readFromNBT(data);
|
||||
|
||||
// Migrate from old data
|
||||
var config = this.getAEInventoryByName(StorageName.CONFIG);
|
||||
for (int i = 0; i < config.getSizeInventory(); i++) {
|
||||
IAEStack<?> stack = config.getAEStackInSlot(i);
|
||||
|
||||
if (stack instanceof IAEItemStack ais) {
|
||||
IAEFluidStack afs = Util.getAEFluidFromItem(ais.getItemStack());
|
||||
config.putAEStackInSlot(i, afs);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package com.glodblock.github.common.parts;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
import com.glodblock.github.common.parts.base.FCPart;
|
||||
|
||||
import appeng.core.sync.GuiBridge;
|
||||
|
||||
public class PartFluidTerminal extends FCPart {
|
||||
|
||||
private static final FCPartsTexture FRONT_BRIGHT_ICON = FCPartsTexture.PartFluidTerminal_Bright;
|
||||
private static final FCPartsTexture FRONT_DARK_ICON = FCPartsTexture.PartFluidTerminal_Colored;
|
||||
private static final FCPartsTexture FRONT_COLORED_ICON = FCPartsTexture.PartFluidTerminal_Dark;
|
||||
|
||||
public PartFluidTerminal(ItemStack is) {
|
||||
super(is, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FCPartsTexture getFrontBright() {
|
||||
return FRONT_BRIGHT_ICON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FCPartsTexture getFrontColored() {
|
||||
return FRONT_COLORED_ICON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FCPartsTexture getFrontDark() {
|
||||
return FRONT_DARK_ICON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLightSource() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBooting() {
|
||||
return super.isBooting();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiBridge getGui() {
|
||||
return GuiBridge.GUI_ME;
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,8 @@ public enum CellType {
|
||||
Cell4096kPart(6, AEFeature.StorageCells),
|
||||
Cell16384kPart(7, AEFeature.StorageCells);
|
||||
|
||||
public static final CellType[] VALUES = values();
|
||||
|
||||
private final EnumSet<AEFeature> features;
|
||||
private int damageValue;
|
||||
private Item itemInstance;
|
||||
@@ -53,7 +55,7 @@ public enum CellType {
|
||||
}
|
||||
|
||||
public static EnumChatFormatting getTypeColor(int type) {
|
||||
return getTypeColor(CellType.values()[type % CellType.values().length]);
|
||||
return getTypeColor(CellType.VALUES[type % CellType.VALUES.length]);
|
||||
}
|
||||
|
||||
public static EnumChatFormatting getTypeColor(CellType type) {
|
||||
|
||||
@@ -70,7 +70,8 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
return mainTank.drain(fluid, amount, doDrain, false);
|
||||
}
|
||||
|
||||
if (this.getFluid() == null) {
|
||||
Fluid currentFluid = this.getFluid();
|
||||
if (currentFluid == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -84,10 +85,10 @@ public class TileCertusQuartzTank extends TileEntity implements IFluidHandler {
|
||||
if (drained < amount) {
|
||||
TileCertusQuartzTank tankBelow = this.getTankBelow();
|
||||
if (tankBelow != null) {
|
||||
FluidStack externallyDrained = tankBelow.drain(this.getFluid(), amount - drained, doDrain, false);
|
||||
FluidStack externallyDrained = tankBelow.drain(currentFluid, amount - drained, doDrain, false);
|
||||
|
||||
if (externallyDrained != null) {
|
||||
return new FluidStack(this.getFluid(), drained + externallyDrained.amount);
|
||||
return new FluidStack(currentFluid, drained + externallyDrained.amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,15 +77,27 @@ public class TileFluidAutoFiller extends AENetworkInvTile
|
||||
public TileFluidAutoFiller() {
|
||||
getProxy().setIdlePowerUsage(1D);
|
||||
getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
|
||||
inventory.setInventorySlotContents(0, BUCKET);
|
||||
inventory.setInventorySlotContents(0, BUCKET.copy());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public ItemStack getContainerItem() {
|
||||
normalizeContainerItem();
|
||||
return getInventory().getStackInSlot(0);
|
||||
}
|
||||
|
||||
public void setContainerItem(ItemStack is) {
|
||||
getInventory().setInventorySlotContents(0, is);
|
||||
normalizeContainerItem();
|
||||
}
|
||||
|
||||
private void normalizeContainerItem() {
|
||||
ItemStack is = getInventory().getStackInSlot(0);
|
||||
if (is == null) {
|
||||
is = BUCKET.copy();
|
||||
getInventory().setInventorySlotContents(0, is);
|
||||
}
|
||||
is.stackSize = 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -102,18 +114,15 @@ public class TileFluidAutoFiller extends AENetworkInvTile
|
||||
}
|
||||
|
||||
public void updatePattern() {
|
||||
ItemStack is = inventory.getStackInSlot(0);
|
||||
if (is == null) return;
|
||||
this.setContainerItem(is);
|
||||
normalizeContainerItem();
|
||||
postEvent();
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBTEvent(NBTTagCompound data) {
|
||||
inventory.readFromNBT(data, "Inv");
|
||||
if (inventory.getStackInSlot(0) == null) {
|
||||
inventory.setInventorySlotContents(0, BUCKET);
|
||||
}
|
||||
ItemStack container = inventory.getStackInSlot(0);
|
||||
this.setContainerItem(container);
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
@@ -150,21 +159,21 @@ public class TileFluidAutoFiller extends AENetworkInvTile
|
||||
public void provideCrafting(ICraftingProviderHelper craftingTracker) {
|
||||
IStorageGrid storage = getStorageGrid();
|
||||
if (storage == null) return;
|
||||
ItemStack containerItem = this.getContainerItem();
|
||||
|
||||
if (this.fluids.isEmpty()) {
|
||||
this.fluids = storage.getFluidInventory().getStorageList();
|
||||
}
|
||||
for (IAEFluidStack fluidStack : this.fluids) {
|
||||
Fluid fluid = fluidStack.getFluid();
|
||||
if (fluid == null) continue;
|
||||
int maxCapacity = Util.FluidUtil.getCapacity(this.getContainerItem(), fluid);
|
||||
int maxCapacity = Util.FluidUtil.getCapacity(containerItem, fluid);
|
||||
if (maxCapacity == 0) continue;
|
||||
MutablePair<Integer, ItemStack> filled = Util.FluidUtil
|
||||
.fillStack(this.getContainerItem().copy(), new FluidStack(fluid, maxCapacity));
|
||||
.fillStack(containerItem.copy(), new FluidStack(fluid, maxCapacity));
|
||||
if (filled == null) continue;
|
||||
if (filled.right == null) continue;
|
||||
ItemStack pattern = getPattern(
|
||||
this.getContainerItem(),
|
||||
filled.right,
|
||||
fluidStack.copy().setStackSize(maxCapacity));
|
||||
ItemStack pattern = getPattern(containerItem, filled.right, fluidStack.copy().setStackSize(maxCapacity));
|
||||
ICraftingPatternItem patter = (ICraftingPatternItem) pattern.getItem();
|
||||
craftingTracker.addCraftingOption(this, patter.getPatternForItem(pattern, getWorldObj()));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.glodblock.github.common.tile;
|
||||
|
||||
import static appeng.util.item.AEFluidStackType.FLUID_STACK_TYPE;
|
||||
import static appeng.util.item.AEItemStackType.ITEM_STACK_TYPE;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@@ -14,19 +17,25 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.glodblock.github.client.FluidInterfaceButtons;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.inventory.AEFluidInventory;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import com.glodblock.github.inventory.IDualHost;
|
||||
import com.glodblock.github.loader.ItemAndBlockHolder;
|
||||
import com.glodblock.github.util.DualHostSettings;
|
||||
import com.glodblock.github.util.DualityFluidInterface;
|
||||
import com.glodblock.github.util.Util;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.SidelessMode;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
@@ -34,6 +43,8 @@ import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.storage.IMEMonitor;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.helpers.ICustomButtonDataObject;
|
||||
import appeng.helpers.ICustomButtonProvider;
|
||||
@@ -41,6 +52,7 @@ import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.tile.misc.TileInterface;
|
||||
import appeng.util.SettingsFrom;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@@ -110,6 +122,18 @@ public class TileFluidInterface extends TileInterface implements IDualHost, ICus
|
||||
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);
|
||||
@@ -160,15 +184,31 @@ public class TileFluidInterface extends TileInterface implements IDualHost, ICus
|
||||
config.readFromNBT(data, "ConfigInv");
|
||||
fluidDuality.loadConfigFromPacket(this.config);
|
||||
getInternalFluid().readFromNBT(data, "FluidInv");
|
||||
fluidDuality.readCraftingTrackerFromNBT(data);
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public NBTTagCompound writeToNBTEvent(NBTTagCompound data) {
|
||||
config.writeToNBT(data, "ConfigInv");
|
||||
getInternalFluid().writeToNBT(data, "FluidInv");
|
||||
fluidDuality.writeCraftingTrackerToNBT(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadSettings(SettingsFrom from, NBTTagCompound compound) {
|
||||
super.uploadSettings(from, compound);
|
||||
DualHostSettings.uploadSettings(this, compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound downloadSettings(SettingsFrom from) {
|
||||
NBTTagCompound output = super.downloadSettings(from);
|
||||
output = output == null ? new NBTTagCompound() : output;
|
||||
DualHostSettings.downloadSettings(this, output);
|
||||
return output;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected ItemStack getItemFromTile(final Object obj) {
|
||||
if (obj instanceof TileFluidInterface) {
|
||||
@@ -182,6 +222,26 @@ public class TileFluidInterface extends TileInterface implements IDualHost, ICus
|
||||
return getInterfaceDuality().getInstalledUpgrades(u);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableSet<ICraftingLink> getRequestedJobs() {
|
||||
return ImmutableSet.<ICraftingLink>builder().addAll(super.getRequestedJobs())
|
||||
.addAll(fluidDuality.getRequestedJobs()).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEStack<?> injectCraftedItems(final ICraftingLink link, final IAEStack<?> items, final Actionable mode) {
|
||||
if (items instanceof IAEFluidStack) {
|
||||
return fluidDuality.injectCraftedItems(link, items, mode);
|
||||
}
|
||||
return super.injectCraftedItems(link, items, mode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jobStateChange(final ICraftingLink link) {
|
||||
super.jobStateChange(link);
|
||||
fluidDuality.jobStateChange(link);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill) {
|
||||
return fluidDuality.fill(from, resource, doFill);
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.glodblock.github.common.tile;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
@@ -10,6 +11,7 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
|
||||
import appeng.api.networking.GridFlags;
|
||||
@@ -60,13 +62,22 @@ public class TileFluidPacketDecoder extends AENetworkTile
|
||||
return new TickingRequest(5, 120, false, true);
|
||||
}
|
||||
|
||||
private FluidStack getFluidStack() {
|
||||
final ItemStack stack = inventory.getStackInSlot(0);
|
||||
if (stack == null) return null;
|
||||
|
||||
if (stack.getItem() instanceof ItemFluidPacket) {
|
||||
return ItemFluidPacket.getFluidStack(stack);
|
||||
} else if (stack.getItem() instanceof ItemFluidDrop) {
|
||||
return ItemFluidDrop.getFluidStack(stack);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(IGridNode node, int ticksSinceLastCall) {
|
||||
ItemStack stack = inventory.getStackInSlot(0);
|
||||
if (stack == null || !(stack.getItem() instanceof ItemFluidPacket)) {
|
||||
return TickRateModulation.SLEEP;
|
||||
}
|
||||
FluidStack fluid = ItemFluidPacket.getFluidStack(stack);
|
||||
final FluidStack fluid = getFluidStack();
|
||||
if (fluid == null || fluid.amount <= 0) {
|
||||
inventory.setInventorySlotContents(0, null);
|
||||
return TickRateModulation.SLEEP;
|
||||
@@ -167,7 +178,8 @@ public class TileFluidPacketDecoder extends AENetworkTile
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slot, ItemStack stack) {
|
||||
return stack.getItem() instanceof ItemFluidPacket;
|
||||
final Item item = stack.getItem();
|
||||
return item instanceof ItemFluidPacket || item instanceof ItemFluidDrop;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -182,34 +194,27 @@ public class TileFluidPacketDecoder extends AENetworkTile
|
||||
|
||||
private FluidStack drain(FluidStack requestFluid, boolean doDrain) {
|
||||
if (requestFluid == null || requestFluid.amount <= 0) return null;
|
||||
ItemStack fluidPacket = this.inventory.getStackInSlot(0);
|
||||
if (fluidPacket != null) {
|
||||
FluidStack fs = ItemFluidPacket.getFluidStack(fluidPacket);
|
||||
if (fs == null) return null;
|
||||
if (fs.isFluidEqual(requestFluid)) {
|
||||
if (fs.amount > requestFluid.amount) {
|
||||
fs.amount -= requestFluid.amount;
|
||||
if (doDrain) this.inventory.setInventorySlotContents(0, ItemFluidPacket.newStack(fs));
|
||||
return requestFluid;
|
||||
} else {
|
||||
if (doDrain) this.inventory.setInventorySlotContents(0, null);
|
||||
return fs;
|
||||
}
|
||||
final FluidStack fs = this.getFluidStack();
|
||||
if (fs != null && fs.isFluidEqual(requestFluid)) {
|
||||
if (fs.amount > requestFluid.amount) {
|
||||
fs.amount -= requestFluid.amount;
|
||||
if (doDrain) this.inventory.setInventorySlotContents(0, ItemFluidPacket.newStack(fs));
|
||||
return requestFluid;
|
||||
} else {
|
||||
if (doDrain) this.inventory.setInventorySlotContents(0, null);
|
||||
return fs;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
ItemStack fluidPacket = this.inventory.getStackInSlot(0);
|
||||
if (fluidPacket != null) {
|
||||
FluidStack requestFluid = ItemFluidPacket.getFluidStack(fluidPacket);
|
||||
if (requestFluid == null) return null;
|
||||
requestFluid.amount = maxDrain;
|
||||
return this.drain(requestFluid, doDrain);
|
||||
}
|
||||
return null;
|
||||
final FluidStack requestFluid = this.getFluidStack();
|
||||
if (requestFluid == null) return null;
|
||||
requestFluid.amount = maxDrain;
|
||||
return this.drain(requestFluid, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -224,13 +229,8 @@ public class TileFluidPacketDecoder extends AENetworkTile
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
ItemStack fluidPacket = this.inventory.getStackInSlot(0);
|
||||
if (fluidPacket == null) {
|
||||
return new FluidTankInfo[0];
|
||||
} else {
|
||||
FluidStack fs = ItemFluidPacket.getFluidStack(fluidPacket);
|
||||
if (fs == null) return new FluidTankInfo[0];
|
||||
return new FluidTankInfo[] { new FluidTankInfo(fs, fs.amount) };
|
||||
}
|
||||
final FluidStack fs = this.getFluidStack();
|
||||
if (fs == null) return new FluidTankInfo[0];
|
||||
return new FluidTankInfo[] { new FluidTankInfo(fs, fs.amount) };
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.CraftingMode;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.features.ILevelViewable;
|
||||
import appeng.api.features.LevelItemInfo;
|
||||
@@ -50,12 +51,14 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.core.AELog;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.cache.CraftingGridCache;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.grid.AENetworkTile;
|
||||
import appeng.tile.inventory.IAEAppEngInventory;
|
||||
import appeng.tile.inventory.IAEStackInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.IterationCounter;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.SettingsFrom;
|
||||
import appeng.util.item.AEItemStack;
|
||||
@@ -72,12 +75,15 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
public static final String NBT_ENABLE = "enable";
|
||||
public static final String NBT_STATE = "state";
|
||||
public static final String NBT_LINK = "link";
|
||||
public static final String NBT_LITE_MODE = "lite_mode";
|
||||
|
||||
public final RequestInfo[] requests = new RequestInfo[REQ_COUNT];
|
||||
private final LevelMaintainerInventory inventory = new LevelMaintainerInventory(requests);
|
||||
private int firstRequest = 0;
|
||||
private final BaseActionSource source;
|
||||
private boolean isPowered = false;
|
||||
private boolean isLiteModeOverridden = false;
|
||||
private boolean isLiteMode = false;
|
||||
|
||||
public TileLevelMaintainer() {
|
||||
getProxy().setIdlePowerUsage(1D);
|
||||
@@ -164,6 +170,7 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
}
|
||||
try {
|
||||
final ICraftingGrid craftingGrid = getProxy().getCrafting();
|
||||
final CraftingGridCache craftingGridCache = (CraftingGridCache) craftingGrid;
|
||||
final IGrid grid = getProxy().getGrid();
|
||||
|
||||
// Check there are available crafting CPUs before doing any work.
|
||||
@@ -202,7 +209,7 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
IMEMonitor monitor = getProxy().getStorage().getMEMonitor(craftItem.getStackType());
|
||||
if (monitor == null) continue;
|
||||
|
||||
IAEStack<?> stackInStorage = monitor.getStorageList().findPrecise(craftItem);
|
||||
IAEStack<?> stackInStorage = monitor.getAvailableItem(craftItem, IterationCounter.fetchNewId());
|
||||
|
||||
long stackSize = stackInStorage == null ? 0 : stackInStorage.getStackSize();
|
||||
|
||||
@@ -273,9 +280,14 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
}
|
||||
} else if (itemToBegin != null) {
|
||||
// No jobs to submit, start calculating some item.
|
||||
|
||||
requests[itemToBeginIdx].job = craftingGrid
|
||||
.beginCraftingJob(this.worldObj, grid, source, itemToBegin, null);
|
||||
requests[itemToBeginIdx].job = craftingGridCache.beginCraftingJob(
|
||||
this.worldObj,
|
||||
grid,
|
||||
source,
|
||||
itemToBegin,
|
||||
CraftingMode.STANDARD,
|
||||
isLiteMode(),
|
||||
null);
|
||||
this.updateState(itemToBeginIdx, LevelState.Craft);
|
||||
|
||||
// Try the next item next time.
|
||||
@@ -369,6 +381,35 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
this.saveChanges();
|
||||
}
|
||||
|
||||
private boolean getLiteModeDefault() {
|
||||
try {
|
||||
final ICraftingGrid craftingGrid = getProxy().getCrafting();
|
||||
if (craftingGrid instanceof CraftingGridCache cache) {
|
||||
return cache.getLiteCraftingDefault();
|
||||
}
|
||||
} catch (GridAccessException ignored) {}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isLiteMode() {
|
||||
return this.isLiteModeOverridden ? this.isLiteMode : getLiteModeDefault();
|
||||
}
|
||||
|
||||
public void setLiteMode(boolean liteMode) {
|
||||
this.isLiteModeOverridden = true;
|
||||
this.isLiteMode = liteMode;
|
||||
this.saveChanges();
|
||||
}
|
||||
|
||||
public void toggleLiteMode() {
|
||||
this.setLiteMode(!this.isLiteMode());
|
||||
}
|
||||
|
||||
public void clearLiteMode() {
|
||||
this.isLiteModeOverridden = false;
|
||||
this.saveChanges();
|
||||
}
|
||||
|
||||
private void updateLink(int idx, @Nullable ICraftingLink link) {
|
||||
if (requests[idx] == null) return;
|
||||
requests[idx].link = link;
|
||||
@@ -416,6 +457,9 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
}
|
||||
}
|
||||
data.setTag(NBT_REQUESTS, tagList);
|
||||
if (this.isLiteModeOverridden) {
|
||||
data.setBoolean(NBT_LITE_MODE, this.isLiteMode);
|
||||
}
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
@@ -499,6 +543,10 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
this.requests[i].quantity = quantyties[i];
|
||||
}
|
||||
}
|
||||
if (data.hasKey(NBT_LITE_MODE)) {
|
||||
this.isLiteModeOverridden = true;
|
||||
this.isLiteMode = data.getBoolean(NBT_LITE_MODE);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove old format NBT data from ItemStack
|
||||
@@ -541,6 +589,12 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
}
|
||||
}
|
||||
}
|
||||
if (compound.hasKey(NBT_LITE_MODE)) {
|
||||
this.isLiteModeOverridden = true;
|
||||
this.isLiteMode = compound.getBoolean(NBT_LITE_MODE);
|
||||
} else {
|
||||
this.isLiteModeOverridden = false;
|
||||
}
|
||||
this.saveChanges();
|
||||
}
|
||||
|
||||
@@ -557,6 +611,9 @@ public class TileLevelMaintainer extends AENetworkTile
|
||||
}
|
||||
}
|
||||
compound.setTag(NBT_REQUESTS, tagList);
|
||||
if (isLiteModeOverridden) {
|
||||
compound.setBoolean(NBT_LITE_MODE, isLiteMode);
|
||||
}
|
||||
return compound;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,15 +15,19 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
import com.glodblock.github.common.item.FCBaseItemCell;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.inventory.AEFluidInventory;
|
||||
import com.glodblock.github.inventory.IAEFluidInventory;
|
||||
import com.glodblock.github.inventory.IAEFluidTank;
|
||||
import com.gtnewhorizon.gtnhlib.item.ItemStackNBT;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.implementations.IPowerChannelState;
|
||||
import appeng.api.implementations.items.IStorageCell;
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.events.MENetworkBootingStatusChange;
|
||||
@@ -36,60 +40,108 @@ 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;
|
||||
import appeng.core.AELog;
|
||||
import appeng.items.storage.ItemBasicStorageCell;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.grid.AENetworkInvTile;
|
||||
import appeng.tile.inventory.AppEngInternalAEInventory;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.tile.inventory.BiggerAppEngInventory;
|
||||
import appeng.tile.inventory.IAEStackInventory;
|
||||
import appeng.tile.inventory.IIAEStackInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
implements IAEFluidInventory, IFluidHandler, IPowerChannelState, IGridTickable, ITerminalHost {
|
||||
public class TileSuperStockReplenisher extends AENetworkInvTile implements IAEFluidInventory, IFluidHandler,
|
||||
IPowerChannelState, IGridTickable, ITerminalHost, IIAEStackInventory {
|
||||
|
||||
private final AppEngInternalInventory cell = new AppEngInternalInventory(this, 1);
|
||||
private final BiggerAppEngInventory invItems = new BiggerAppEngInventory(this, 63);
|
||||
private final AEFluidInventory invFluids = new AEFluidInventory(this, 9, Integer.MAX_VALUE);
|
||||
private final AppEngInternalAEInventory configFluids = new AppEngInternalAEInventory(this, 9);
|
||||
private final AppEngInternalAEInventory configItems = new AppEngInternalAEInventory(this, 63);
|
||||
private final IAEStackInventory configItems = new IAEStackInventory(this, 63, StorageName.CONFIG);
|
||||
private final IAEStackInventory configFluids = new IAEStackInventory(this, 9, StorageName.NONE) {
|
||||
|
||||
@Override
|
||||
public void readFromNBT(@Nullable NBTTagCompound data, String name) {
|
||||
super.readFromNBT(data, name);
|
||||
|
||||
for (int i = 0; i < this.getSizeInventory(); i++) {
|
||||
final IAEStack<?> aes = this.getAEStackInSlot(i);
|
||||
if (aes instanceof IAEItemStack ais && ais.getItem() instanceof ItemFluidPacket) {
|
||||
final IAEFluidStack ifs = ItemFluidPacket.getFluidAEStack(ais);
|
||||
if (ifs != null && ifs.getStackSize() > Integer.MAX_VALUE) ifs.setStackSize(Integer.MAX_VALUE);
|
||||
this.putAEStackInSlot(i, ifs);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
private final BaseActionSource source;
|
||||
private boolean isPowered;
|
||||
private long totalBytes;
|
||||
private long storedFluidCount;
|
||||
private long storedItemCount;
|
||||
protected boolean isFullStockMode;
|
||||
protected boolean isSlotsAccessible;
|
||||
protected boolean isNeedsFullyStocked;
|
||||
protected boolean modeChange;
|
||||
|
||||
private boolean needReCountStoredFluids = true;
|
||||
private boolean needReCountStoredItems = true;
|
||||
|
||||
public TileSuperStockReplenisher() {
|
||||
super(false);
|
||||
getProxy().setIdlePowerUsage(4D);
|
||||
getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
|
||||
this.getProxy().setIdlePowerUsage(4D);
|
||||
this.getProxy().setFlags(GridFlags.REQUIRE_CHANNEL);
|
||||
this.source = new MachineSource(this);
|
||||
invItems.setMaxStackSize(Integer.MAX_VALUE);
|
||||
this.isFullStockMode = false;
|
||||
this.isSlotsAccessible = true;
|
||||
this.isNeedsFullyStocked = false;
|
||||
this.modeChange = false;
|
||||
}
|
||||
|
||||
private TickRateModulation doWork() {
|
||||
final TickRateModulation tickRateModulation;
|
||||
|
||||
if (this.isFullStockMode()) {
|
||||
if (this.isNeedsFullyStocked()) {
|
||||
tickRateModulation = TickRateModulation.FASTER;
|
||||
} else tickRateModulation = TickRateModulation.SLOWER;
|
||||
} else tickRateModulation = TickRateModulation.IDLE;
|
||||
|
||||
this.fletchFluids();
|
||||
this.fletchItems();
|
||||
|
||||
this.needReCountStoredFluids = true;
|
||||
this.needReCountStoredItems = true;
|
||||
|
||||
return tickRateModulation;
|
||||
}
|
||||
|
||||
private void fletchFluids() {
|
||||
for (int i = 0; i < 9; i++) {
|
||||
IAEFluidStack invFluid = invFluids.getFluidInSlot(i);
|
||||
IAEItemStack configFluid = configFluids.getAEStackInSlot(i);
|
||||
if (configFluid != null) {
|
||||
IAEFluidStack fs = AEFluidStack.create(ItemFluidPacket.getFluidStack(configFluid));
|
||||
if (invFluid == null) requestFluid(fs, i);
|
||||
else if (invFluid.equals(fs)) {
|
||||
IAEStack<?> configFluid = configFluids.getAEStackInSlot(i);
|
||||
if (configFluid instanceof IAEFluidStack fs) {
|
||||
IAEFluidStack ifs = fs.copy();
|
||||
if (invFluid == null) requestFluid(ifs, i);
|
||||
else if (invFluid.equals(ifs)) {
|
||||
long invSize = invFluid.getStackSize();
|
||||
long confSize = fs.getStackSize();
|
||||
if (invSize < confSize / 2f) {
|
||||
fs.setStackSize(confSize - invSize);
|
||||
requestFluid(fs, i);
|
||||
long confSize = ifs.getStackSize();
|
||||
if (!this.isFullStockMode() && (invSize < confSize / 2f)
|
||||
|| (this.isFullStockMode() && (invSize < confSize))) {
|
||||
ifs.setStackSize(confSize - invSize);
|
||||
requestFluid(ifs, i);
|
||||
} else if (invSize > confSize) {
|
||||
returnFluid(i, invSize - confSize);
|
||||
}
|
||||
@@ -100,18 +152,21 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
returnFluid(i, Long.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void fletchItems() {
|
||||
for (int i = 0; i < 63; i++) {
|
||||
ItemStack invItem = invItems.getStackInSlot(i);
|
||||
IAEItemStack configItem = configItems.getAEStackInSlot(i);
|
||||
|
||||
if (configItem != null) {
|
||||
IAEItemStack is = configItem.copy();
|
||||
IAEStack<?> configItem = configItems.getAEStackInSlot(i);
|
||||
if (configItem instanceof IAEItemStack ais) {
|
||||
IAEItemStack is = ais.copy();
|
||||
if (invItem == null) requestItem(is, i);
|
||||
else if (is.equals(invItem)) {
|
||||
int invSize = invItem.stackSize;
|
||||
int confSize = (int) is.getStackSize();
|
||||
if (invItem.stackSize < confSize / 2f) {
|
||||
is.setStackSize(confSize - invItem.stackSize);
|
||||
if ((!this.isFullStockMode() && (invSize < confSize / 2f))
|
||||
|| ((this.isFullStockMode()) && (invSize < confSize))) {
|
||||
is.setStackSize(confSize - invSize);
|
||||
requestItem(is, i);
|
||||
} else if (invItem.stackSize > confSize) {
|
||||
returnItem(i, invItem.stackSize - confSize);
|
||||
@@ -123,8 +178,28 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
returnItem(i, Integer.MAX_VALUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TickRateModulation.SAME;
|
||||
private void countFluids() {
|
||||
if (this.needReCountStoredFluids) {
|
||||
this.needReCountStoredFluids = false;
|
||||
this.storedFluidCount = 0;
|
||||
for (int i = 0; i < this.invFluids.getSlots(); i++) {
|
||||
final IAEFluidStack fs = this.invFluids.getFluidInSlot(i);
|
||||
if (fs != null) this.storedFluidCount += fs.getStackSize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void countItems() {
|
||||
if (this.needReCountStoredItems) {
|
||||
this.needReCountStoredItems = false;
|
||||
this.storedItemCount = 0;
|
||||
for (int i = 0; i < this.invItems.getSizeInventory(); i++) {
|
||||
final ItemStack is = this.invItems.getStackInSlot(i);
|
||||
if (is != null) this.storedItemCount += is.stackSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void returnFluid(int index, long amount) {
|
||||
@@ -136,6 +211,7 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
if (notInserted != null) {
|
||||
invFluids.fill(index, notInserted, true);
|
||||
storedFluidCount += notInserted.getStackSize();
|
||||
checkSlotsAccessible();
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
}
|
||||
@@ -150,6 +226,7 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
if (extracted != null) {
|
||||
storedFluidCount += extracted.getStackSize();
|
||||
invFluids.fill(index, extracted, true);
|
||||
checkSlotsAccessible();
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
}
|
||||
@@ -161,21 +238,25 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
is.stackSize = is.stackSize - amount;
|
||||
is = is.copy();
|
||||
is.stackSize = amount;
|
||||
storedItemCount -= is.stackSize;
|
||||
} else {
|
||||
invItems.setInventorySlotContents(index, null);
|
||||
}
|
||||
|
||||
this.storedItemCount -= is.stackSize;
|
||||
|
||||
IAEItemStack notInserted = this.getProxy().getStorage().getItemInventory()
|
||||
.injectItems(AEItemStack.create(is), Actionable.MODULATE, this.source);
|
||||
if (notInserted != null) {
|
||||
ItemStack tempStack = invItems.getStackInSlot(index);
|
||||
if (tempStack != null) {
|
||||
if (invItems.getStackInSlot(index) != null) {
|
||||
ItemStack tempStack = invItems.getStackInSlot(index).copy();
|
||||
tempStack.stackSize = tempStack.stackSize + (int) notInserted.getStackSize();
|
||||
storedItemCount += notInserted.getStackSize();
|
||||
|
||||
saveChanges();
|
||||
} else invItems.setInventorySlotContents(index, notInserted.getItemStack());
|
||||
invItems.setInventorySlotContents(index, tempStack);
|
||||
checkSlotsAccessible();
|
||||
} else {
|
||||
invItems.setInventorySlotContents(index, notInserted.getItemStack());
|
||||
checkSlotsAccessible();
|
||||
}
|
||||
this.storedItemCount += notInserted.getStackSize();
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
}
|
||||
@@ -188,20 +269,160 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
IAEItemStack extracted = this.getProxy().getStorage().getItemInventory()
|
||||
.extractItems(is, Actionable.MODULATE, this.source);
|
||||
if (extracted != null) {
|
||||
ItemStack tempStack = invItems.getStackInSlot(index);
|
||||
if (tempStack != null) {
|
||||
if (invItems.getStackInSlot(index) != null) {
|
||||
ItemStack tempStack = invItems.getStackInSlot(index).copy();
|
||||
tempStack.stackSize = tempStack.stackSize + (int) extracted.getStackSize();
|
||||
storedItemCount += extracted.getStackSize();
|
||||
invItems.setInventorySlotContents(index, tempStack);
|
||||
checkSlotsAccessible();
|
||||
|
||||
saveChanges();
|
||||
} else invItems.setInventorySlotContents(index, extracted.getItemStack());
|
||||
} else {
|
||||
invItems.setInventorySlotContents(index, extracted.getItemStack());
|
||||
checkSlotsAccessible();
|
||||
|
||||
}
|
||||
|
||||
this.storedItemCount += extracted.getStackSize();
|
||||
}
|
||||
} catch (final GridAccessException ignored) {}
|
||||
}
|
||||
|
||||
public boolean isFullStockMode() {
|
||||
return this.isFullStockMode;
|
||||
}
|
||||
|
||||
public void setFullStockMode(boolean fullStockMode) {
|
||||
|
||||
if (this.isFullStockMode == fullStockMode) return;
|
||||
|
||||
if (fullStockMode) this.modeChange = true;
|
||||
|
||||
this.isFullStockMode = fullStockMode;
|
||||
checkSlotsAccessible();
|
||||
this.modeChange = false;
|
||||
}
|
||||
|
||||
public boolean isSlotsAccessible() {
|
||||
return this.isSlotsAccessible;
|
||||
}
|
||||
|
||||
public boolean isNeedsFullyStocked() {
|
||||
return this.isNeedsFullyStocked;
|
||||
}
|
||||
|
||||
public boolean hasModeChangedToTrue() {
|
||||
return this.modeChange;
|
||||
}
|
||||
|
||||
public void setSlotsAccessible() {
|
||||
if (this.isFullStockMode()) {
|
||||
|
||||
if (this.hasModeChangedToTrue()) {
|
||||
|
||||
this.isSlotsAccessible = false;
|
||||
|
||||
}
|
||||
if (this.isSlotsAccessible()) {
|
||||
|
||||
if ((this.needsFullyStocked())) this.isSlotsAccessible = false;
|
||||
|
||||
} else {
|
||||
|
||||
if (this.isFullyStocked()) this.isSlotsAccessible = true;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
this.isSlotsAccessible = true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void checkSlotsAccessible() {
|
||||
this.setSlotsAccessible();
|
||||
this.notifyNeighbors();
|
||||
}
|
||||
|
||||
private boolean needsFullyStocked() {
|
||||
int configSlots = 0;
|
||||
int emptySlots = 0;
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
IAEStack<?> config = configFluids.getAEStackInSlot(i);
|
||||
|
||||
if (config instanceof IAEFluidStack cfg) {
|
||||
configSlots++;
|
||||
IAEFluidStack inv = invFluids.getFluidInSlot(i);
|
||||
|
||||
if (inv == null) {
|
||||
emptySlots++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 63; i++) {
|
||||
IAEStack<?> config = configItems.getAEStackInSlot(i);
|
||||
|
||||
if (config instanceof IAEItemStack cfg) {
|
||||
configSlots++;
|
||||
ItemStack inv = invItems.getStackInSlot(i);
|
||||
|
||||
if (inv == null) {
|
||||
emptySlots++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.isNeedsFullyStocked = (emptySlots == configSlots) && (configSlots > 0);
|
||||
|
||||
return isNeedsFullyStocked;
|
||||
}
|
||||
|
||||
private boolean isFullyStocked() {
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
IAEStack<?> config = configFluids.getAEStackInSlot(i);
|
||||
|
||||
if (config instanceof IAEFluidStack cfg) {
|
||||
IAEFluidStack cfgFis = cfg.copy();
|
||||
IAEFluidStack inv = invFluids.getFluidInSlot(i);
|
||||
|
||||
if (inv == null || inv.getStackSize() < cfgFis.getStackSize()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 63; i++) {
|
||||
IAEStack<?> config = configItems.getAEStackInSlot(i);
|
||||
|
||||
if (config instanceof IAEItemStack cfg) {
|
||||
IAEItemStack cfgIs = cfg.copy();
|
||||
ItemStack inv = invItems.getStackInSlot(i);
|
||||
|
||||
if (inv == null || inv.stackSize < (int) cfgIs.getStackSize()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide(ForgeDirection whichSide) {
|
||||
return IntStream.rangeClosed(0, 62).toArray();
|
||||
return ((this.isSlotsAccessible()) ? IntStream.rangeClosed(0, 62).toArray() : new int[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotIndex, ItemStack itemStackIn, int side) {
|
||||
return this.isSlotsAccessible();
|
||||
}
|
||||
|
||||
public void notifyNeighbors() {
|
||||
if (this.getWorldObj() != null) {
|
||||
this.markDirty();
|
||||
this.getWorldObj().notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType());
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -210,12 +431,12 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
return invItems;
|
||||
}
|
||||
|
||||
public AppEngInternalAEInventory getConfigFluid() {
|
||||
return configFluids;
|
||||
public IAEStackInventory getConfigFluids() {
|
||||
return this.configFluids;
|
||||
}
|
||||
|
||||
public AppEngInternalAEInventory getConfigItems() {
|
||||
return configItems;
|
||||
public IAEStackInventory getConfigItems() {
|
||||
return this.configItems;
|
||||
}
|
||||
|
||||
public AppEngInternalInventory getCell() {
|
||||
@@ -223,6 +444,9 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
}
|
||||
|
||||
public long getFreeBytes() {
|
||||
this.countFluids();
|
||||
this.countItems();
|
||||
|
||||
return totalBytes - (((storedItemCount + getUnusedItemCount()) / 8)
|
||||
+ ((storedFluidCount + getUnusedFluidCount()) / 2048));
|
||||
}
|
||||
@@ -263,24 +487,12 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
case setInventorySlotContents -> {
|
||||
if (inv == cell) {
|
||||
if (added != null) {
|
||||
if (added.getItem() instanceof ItemBasicStorageCell ibsc) {
|
||||
totalBytes = ibsc.getBytesLong(added);
|
||||
} else if (added.getItem() instanceof FCBaseItemCell fcbic) {
|
||||
totalBytes = fcbic.getBytes(added);
|
||||
}
|
||||
if (added.getItem() instanceof IStorageCell isc) totalBytes = isc.getBytesLong(added);
|
||||
getProxy().setIdlePowerUsage(Math.sqrt(Math.pow(totalBytes, 0.576D)));
|
||||
} else if (removed != null) {
|
||||
totalBytes = 0;
|
||||
getProxy().setIdlePowerUsage(4d);
|
||||
}
|
||||
} else if (inv == invItems) {
|
||||
if (added != null) {
|
||||
storedItemCount += added.stackSize;
|
||||
}
|
||||
|
||||
if (removed != null) {
|
||||
storedItemCount -= removed.stackSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
case decreaseStackSize -> {
|
||||
@@ -288,10 +500,6 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
totalBytes = 0;
|
||||
getProxy().setIdlePowerUsage(4d);
|
||||
}
|
||||
|
||||
if (inv == invItems) {
|
||||
storedItemCount -= removed.stackSize;
|
||||
}
|
||||
}
|
||||
case markDirty -> markDirty();
|
||||
}
|
||||
@@ -301,6 +509,8 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
} catch (GridAccessException e) {
|
||||
AELog.error(e, "Couldn't wake up level emitter for delayed updates");
|
||||
}
|
||||
|
||||
checkSlotsAccessible();
|
||||
}
|
||||
|
||||
public void fullRefund() {
|
||||
@@ -319,12 +529,26 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
|
||||
@Override
|
||||
public void getDrops(World w, int x, int y, int z, List<ItemStack> drops) {
|
||||
this.fullRefund();
|
||||
|
||||
if (cell.getStackInSlot(0) != null) drops.add(cell.getStackInSlot(0));
|
||||
final ItemStack container = AEApi.instance().definitions().items().itemMEStackPacket().maybeStack(1).get();
|
||||
|
||||
for (int i = 0; i < 9; i++) {
|
||||
ItemStack ifp = ItemFluidPacket.newStack(invFluids.getFluidStackInSlot(i));
|
||||
if (ifp != null) drops.add(ifp);
|
||||
final FluidStack fs = this.invFluids.getFluidStackInSlot(i);
|
||||
if (fs == null) continue;
|
||||
final ItemStack temp = container.copy();
|
||||
Platform.writeStackNBT(AEFluidStack.create(fs), ItemStackNBT.get(temp));
|
||||
drops.add(temp);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 63; i++) {
|
||||
final ItemStack is = this.invItems.getStackInSlot(i);
|
||||
if (is == null) continue;
|
||||
final ItemStack temp = container.copy();
|
||||
Platform.writeStackNBT(AEItemStack.create(is), ItemStackNBT.get(temp));
|
||||
drops.add(temp);
|
||||
}
|
||||
super.getDrops(w, x, y, z, drops);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -339,16 +563,12 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain) {
|
||||
FluidStack fs = invFluids.drain(from, resource, doDrain);
|
||||
if (doDrain && fs != null) storedFluidCount -= fs.amount;
|
||||
return fs;
|
||||
return (this.isFullStockMode() && !this.isSlotsAccessible()) ? null : invFluids.drain(from, resource, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain) {
|
||||
FluidStack fs = invFluids.drain(from, maxDrain, doDrain);
|
||||
if (doDrain && fs != null) storedFluidCount -= fs.amount;
|
||||
return fs;
|
||||
return (this.isFullStockMode() && !this.isSlotsAccessible()) ? null : invFluids.drain(from, maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -358,17 +578,19 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid) {
|
||||
return invFluids.canDrain(from, fluid);
|
||||
return (this.isFullStockMode() && !this.isSlotsAccessible()) ? false : invFluids.canDrain(from, fluid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from) {
|
||||
return invFluids.getTankInfo(from);
|
||||
return (this.isFullStockMode() && !this.isSlotsAccessible()) ? new FluidTankInfo[0]
|
||||
: invFluids.getTankInfo(from);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFluidInventoryChanged(IAEFluidTank inv, int slot) {
|
||||
saveChanges();
|
||||
this.markDirty();
|
||||
checkSlotsAccessible();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -395,9 +617,10 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
configItems.readFromNBT(data, "configItems");
|
||||
configFluids.readFromNBT(data, "configFluids");
|
||||
cell.readFromNBT(data, "cellHolder");
|
||||
isFullStockMode = data.getBoolean("isFullStockMode");
|
||||
checkSlotsAccessible();
|
||||
isSlotsAccessible = data.getBoolean("isSlotsAccessible");
|
||||
totalBytes = data.getLong("totalBytes");
|
||||
storedFluidCount = data.getLong("storedFluidCount");
|
||||
storedItemCount = data.getLong("storedItemCount");
|
||||
getProxy().setIdlePowerUsage(data.getDouble("powerDraw"));
|
||||
}
|
||||
|
||||
@@ -408,9 +631,9 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
configItems.writeToNBT(data, "configItems");
|
||||
configFluids.writeToNBT(data, "configFluids");
|
||||
cell.writeToNBT(data, "cellHolder");
|
||||
data.setBoolean("isFullStockMode", isFullStockMode);
|
||||
data.setBoolean("isSlotsAccessible", isSlotsAccessible);
|
||||
data.setLong("totalBytes", totalBytes);
|
||||
data.setLong("storedFluidCount", storedFluidCount);
|
||||
data.setLong("storedItemCount", storedItemCount);
|
||||
data.setDouble("powerDraw", getProxy().getIdlePowerUsage());
|
||||
return data;
|
||||
}
|
||||
@@ -460,7 +683,7 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(IGridNode node) {
|
||||
return new TickingRequest(120, 120, false, false);
|
||||
return new TickingRequest(10, 120, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -482,4 +705,18 @@ public class TileSuperStockReplenisher extends AENetworkInvTile
|
||||
public IConfigManager getConfigManager() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveAEStackInv() {
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEStackInventory getAEInventoryByName(StorageName name) {
|
||||
return switch (name) {
|
||||
case NONE -> this.configFluids;
|
||||
case CONFIG -> this.configItems;
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
}
|
||||
+7
-8
@@ -13,7 +13,7 @@ import com.glodblock.github.util.DualityFluidInterface;
|
||||
import com.glodblock.github.util.NameConst;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.util.Platform;
|
||||
import li.cil.oc.api.driver.EnvironmentProvider;
|
||||
import li.cil.oc.api.driver.NamedBlock;
|
||||
import li.cil.oc.api.driver.SidedBlock;
|
||||
@@ -104,20 +104,19 @@ public class DriverDualFluidInterface implements SidedBlock {
|
||||
if (te instanceof TileFluidInterface) {
|
||||
return true;
|
||||
}
|
||||
if (te instanceof IPartHost) {
|
||||
return ((IPartHost) te).getPart(face) instanceof PartFluidInterface;
|
||||
}
|
||||
|
||||
return Platform.getPartFromTE(te, face) instanceof PartFluidInterface;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static DualityFluidInterface getInterface(TileEntity te, ForgeDirection face) {
|
||||
if (te != null) {
|
||||
if (te instanceof TileFluidInterface) {
|
||||
return ((TileFluidInterface) te).getDualityFluid();
|
||||
if (te instanceof TileFluidInterface tile) {
|
||||
return tile.getDualityFluid();
|
||||
}
|
||||
if (te instanceof IPartHost && ((IPartHost) te).getPart(face) instanceof PartFluidInterface) {
|
||||
return ((PartFluidInterface) ((IPartHost) te).getPart(face)).getDualityFluid();
|
||||
if (Platform.getPartFromTE(te, face) instanceof PartFluidInterface part) {
|
||||
return part.getDualityFluid();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
+17
-14
@@ -1,7 +1,5 @@
|
||||
package com.glodblock.github.crossmod.thaumcraft;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -9,13 +7,10 @@ import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
import appeng.api.storage.data.AEStackTypeRegistry;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import cpw.mods.fml.common.Optional.Method;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
import thaumicenergistics.common.items.ItemCraftingAspect;
|
||||
import thaumicenergistics.common.storage.AEEssentiaStack;
|
||||
|
||||
public class ThaumicEnergisticsCrafting {
|
||||
|
||||
@@ -37,18 +32,23 @@ public class ThaumicEnergisticsCrafting {
|
||||
}
|
||||
|
||||
public static IAEStack<?> convertItemAspectStack(IAEStack<?> stack) {
|
||||
if (stack instanceof IAEItemStack ais && isAspectStack(ais.getItemStack())) {
|
||||
Aspect aspect = getAspect(ais.getItemStack());
|
||||
if (aspect == null) return stack;
|
||||
if (AEStackTypeRegistry.getType("essentia") == null) return stack;
|
||||
|
||||
return new AEEssentiaStack(aspect, stack.getStackSize());
|
||||
if (stack instanceof IAEItemStack ais && isAspectStack(ais.getItemStack())) {
|
||||
String aspectTag = getAspectTag(ais.getItemStack());
|
||||
if (aspectTag == null || aspectTag.isEmpty()) return stack;
|
||||
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
tag.setString("StackType", "essentia");
|
||||
tag.setString("AspectTag", aspectTag);
|
||||
tag.setLong("Cnt", stack.getStackSize());
|
||||
return IAEStack.fromNBTGeneric(tag);
|
||||
} else {
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
|
||||
@Method(modid = "thaumicenergistics")
|
||||
private static @Nullable Aspect getAspect(ItemStack stack) {
|
||||
private static String getAspectTag(ItemStack stack) {
|
||||
if (stack == null) return null;
|
||||
|
||||
if (stack.getItem() == neiAddonAspect) {
|
||||
@@ -58,11 +58,14 @@ public class ThaumicEnergisticsCrafting {
|
||||
String aspect = aspects.getCompoundTagAt(0).getString("key");
|
||||
if (aspect.isEmpty()) return null;
|
||||
|
||||
return Aspect.getAspect(aspect);
|
||||
return aspect;
|
||||
}
|
||||
|
||||
if (stack.getItem() == thaumicEnergisticsAspect) {
|
||||
return Aspect.getAspect(ItemCraftingAspect.getAspect(stack).getTag());
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
if (tag != null && tag.hasKey("Aspect")) {
|
||||
return tag.getString("Aspect");
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.glodblock.github.common.tile.TileCertusQuartzTank;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.tile.AEBaseTile;
|
||||
import appeng.util.Platform;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
@@ -19,8 +21,12 @@ public class WailaInit {
|
||||
|
||||
public static void register(final IWailaRegistrar registrar) {
|
||||
final IWailaDataProvider part = new PartWailaDataProvider();
|
||||
registrar.registerBodyProvider(part, IPartHost.class);
|
||||
registrar.registerNBTProvider(part, IPartHost.class);
|
||||
registerPartProvider(registrar, part, IPartHost.class);
|
||||
if (IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.FMP)) {
|
||||
try {
|
||||
registerPartProvider(registrar, part, Class.forName("codechicken.multipart.TileMultipart"));
|
||||
} catch (final ClassNotFoundException ignored) {}
|
||||
}
|
||||
if (Platform.isClient()) GuiContainerManager.addTooltipHandler(new FCTooltipHandlerWaila());
|
||||
|
||||
final IWailaDataProvider tile = new TileWailaDataProvider();
|
||||
@@ -32,4 +38,10 @@ public class WailaInit {
|
||||
registrar.registerBodyProvider(certusQuartzTank, TileCertusQuartzTank.class);
|
||||
}
|
||||
}
|
||||
|
||||
private static void registerPartProvider(final IWailaRegistrar registrar, final IWailaDataProvider provider,
|
||||
final Class<?> tileClass) {
|
||||
registrar.registerBodyProvider(provider, tileClass);
|
||||
registrar.registerNBTProvider(provider, tileClass);
|
||||
}
|
||||
}
|
||||
@@ -432,7 +432,10 @@ public class AEFluidInventory implements IAEFluidTank {
|
||||
if (doFill) {
|
||||
if (getFluid() == null) AEFluidInventory.this
|
||||
.setFluidInSlot(this.slot, AEFluidStack.create(new FluidStack(resource.getFluid(), acc)));
|
||||
else getFluid().amount += acc;
|
||||
else {
|
||||
getFluid().amount += acc;
|
||||
AEFluidInventory.this.onContentChanged(this.slot);
|
||||
}
|
||||
}
|
||||
return acc;
|
||||
}
|
||||
@@ -446,7 +449,10 @@ public class AEFluidInventory implements IAEFluidTank {
|
||||
if (doDrain) {
|
||||
if (amt == getFluid().amount) {
|
||||
AEFluidInventory.this.setFluidInSlot(this.slot, null);
|
||||
} else getFluid().amount -= amt;
|
||||
} else {
|
||||
getFluid().amount -= amt;
|
||||
AEFluidInventory.this.onContentChanged(this.slot);
|
||||
}
|
||||
}
|
||||
return remove;
|
||||
}
|
||||
|
||||
+4
-5
@@ -3,13 +3,12 @@ package com.glodblock.github.inventory.external;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import appeng.api.implementations.tiles.ITileStorageMonitorable;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class AEFluidInterfaceHandler implements IExternalStorageHandler {
|
||||
|
||||
@@ -18,7 +17,7 @@ public class AEFluidInterfaceHandler implements IExternalStorageHandler {
|
||||
if (channel == StorageChannel.FLUIDS) {
|
||||
if (te instanceof ITileStorageMonitorable) {
|
||||
return true;
|
||||
} else return Util.getPart(te, d.getOpposite()) instanceof ITileStorageMonitorable;
|
||||
} else return Platform.getPartFromTE(te, d.getOpposite()) instanceof ITileStorageMonitorable;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -30,8 +29,8 @@ public class AEFluidInterfaceHandler implements IExternalStorageHandler {
|
||||
if (te instanceof ITileStorageMonitorable
|
||||
&& ((ITileStorageMonitorable) te).getMonitorable(d, src) != null) {
|
||||
return ((ITileStorageMonitorable) te).getMonitorable(d, src).getFluidInventory();
|
||||
} else if (Util.getPart(te, d.getOpposite()) instanceof ITileStorageMonitorable part
|
||||
&& ((ITileStorageMonitorable) Util.getPart(te, d.getOpposite())).getMonitorable(d, src) != null) {
|
||||
} else if (Platform.getPartFromTE(te, d.getOpposite()) instanceof ITileStorageMonitorable part
|
||||
&& part.getMonitorable(d, src) != null) {
|
||||
return part.getMonitorable(d, src).getFluidInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public abstract class PartGuiFactory<T> extends TileGuiFactory<T> {
|
||||
|
||||
@@ -17,12 +17,11 @@ public abstract class PartGuiFactory<T> extends TileGuiFactory<T> {
|
||||
@Nullable
|
||||
@Override
|
||||
protected T getInventory(TileEntity tile, ForgeDirection face) {
|
||||
if (tile instanceof IPartHost) {
|
||||
IPart part = ((IPartHost) tile).getPart(face);
|
||||
if (invClass.isInstance(part)) {
|
||||
return invClass.cast(part);
|
||||
}
|
||||
IPart part = Platform.getPartFromTE(tile, face);
|
||||
if (invClass.isInstance(part)) {
|
||||
return invClass.cast(part);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public abstract class TileOrPartGuiFactory<T> extends TileGuiFactory<T> {
|
||||
|
||||
@@ -17,12 +17,11 @@ public abstract class TileOrPartGuiFactory<T> extends TileGuiFactory<T> {
|
||||
@Nullable
|
||||
@Override
|
||||
protected T getInventory(TileEntity tile, ForgeDirection face) {
|
||||
if (tile instanceof IPartHost) {
|
||||
IPart part = ((IPartHost) tile).getPart(face);
|
||||
if (invClass.isInstance(part)) {
|
||||
return invClass.cast(part);
|
||||
}
|
||||
IPart part = Platform.getPartFromTE(tile, face);
|
||||
if (invClass.isInstance(part)) {
|
||||
return invClass.cast(part);
|
||||
}
|
||||
|
||||
return super.getInventory(tile, face);
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,9 @@ public class WirelessMagnet {
|
||||
|
||||
Off,
|
||||
Inv,
|
||||
ME
|
||||
ME;
|
||||
|
||||
public static final Mode[] VALUES = values();
|
||||
}
|
||||
|
||||
public enum ListMode {
|
||||
@@ -138,7 +140,7 @@ public class WirelessMagnet {
|
||||
if (is != null && is.getItem() instanceof ItemWirelessUltraTerminal) {
|
||||
NBTTagCompound data = Platform.openNbtData(is);
|
||||
if (data.hasKey(modeKey)) {
|
||||
return Mode.values()[data.getInteger(modeKey)];
|
||||
return Mode.VALUES[data.getInteger(modeKey)];
|
||||
}
|
||||
setMode(is, Mode.Off);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package com.glodblock.github.inventory.slot;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -17,10 +20,22 @@ public class FCSlotRestrictedInput extends SlotRestrictedInput {
|
||||
MutablePair<Boolean, ItemStack> isItemValid(final ItemStack inputItem);
|
||||
}
|
||||
|
||||
private final Filter filter;
|
||||
private final List<Filter> filter = new ArrayList<>();
|
||||
private final InventoryPlayer p;
|
||||
private ItemStack validItem = null;
|
||||
|
||||
public FCSlotRestrictedInput(List<ItemStack> validList, IInventory i, int slotIndex, int x, int y,
|
||||
InventoryPlayer p) {
|
||||
super(PlacableItemType.INSCRIBER_PLATE, i, slotIndex, x, y, p);
|
||||
validList.forEach(
|
||||
valid -> filter.add(
|
||||
(inputItem) -> new MutablePair<>(
|
||||
valid.getItem().getClass().isAssignableFrom(inputItem.getItem().getClass()),
|
||||
valid)));
|
||||
this.p = p;
|
||||
this.validItem = validList.get(0);
|
||||
}
|
||||
|
||||
public FCSlotRestrictedInput(ItemStack valid, IInventory i, int slotIndex, int x, int y, InventoryPlayer p) {
|
||||
this(
|
||||
(inputItem) -> new MutablePair<>(
|
||||
@@ -36,14 +51,15 @@ public class FCSlotRestrictedInput extends SlotRestrictedInput {
|
||||
|
||||
public FCSlotRestrictedInput(Filter filter, IInventory i, int slotIndex, int x, int y, InventoryPlayer p) {
|
||||
super(PlacableItemType.INSCRIBER_PLATE, i, slotIndex, x, y, p);
|
||||
this.filter = filter;
|
||||
this.filter.add(filter);
|
||||
this.p = p;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(final ItemStack inputItem) {
|
||||
MutablePair<Boolean, ItemStack> result = this.filter.isItemValid(inputItem);
|
||||
return result.left;
|
||||
for (Filter filter : this.filter) if (filter.isItemValid(inputItem).left) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean getAllowEdit() {
|
||||
|
||||
@@ -17,29 +17,24 @@ import com.glodblock.github.common.item.ItemBasicFluidStorageCell;
|
||||
import com.glodblock.github.common.item.ItemBasicFluidStoragePart;
|
||||
import com.glodblock.github.common.item.ItemCreativeFluidStorageCell;
|
||||
import com.glodblock.github.common.item.ItemEnergyCard;
|
||||
import com.glodblock.github.common.item.ItemFluidConversionMonitor;
|
||||
import com.glodblock.github.common.item.ItemFluidAnnihilationPlane;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.item.ItemFluidEncodedPattern;
|
||||
import com.glodblock.github.common.item.ItemFluidExportBus;
|
||||
import com.glodblock.github.common.item.ItemFluidExtremeStorageCell;
|
||||
import com.glodblock.github.common.item.ItemFluidFormationPlane;
|
||||
import com.glodblock.github.common.item.ItemFluidImportBus;
|
||||
import com.glodblock.github.common.item.ItemFluidLevelEmitter;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.glodblock.github.common.item.ItemFluidStorageHousing;
|
||||
import com.glodblock.github.common.item.ItemFluidStorageMonitor;
|
||||
import com.glodblock.github.common.item.ItemFluidVoidStorageCell;
|
||||
import com.glodblock.github.common.item.ItemInfinityWaterStorageCell;
|
||||
import com.glodblock.github.common.item.ItemMultiFluidStorageCell;
|
||||
import com.glodblock.github.common.item.ItemPartFluidInterface;
|
||||
import com.glodblock.github.common.item.ItemPartFluidP2PInterface;
|
||||
import com.glodblock.github.common.item.ItemPartFluidPatternTerminal;
|
||||
import com.glodblock.github.common.item.ItemPartFluidPatternTerminalEx;
|
||||
import com.glodblock.github.common.item.ItemPartFluidStorageBus;
|
||||
import com.glodblock.github.common.item.ItemPartFluidTerminal;
|
||||
import com.glodblock.github.common.item.ItemPartLevelTerminal;
|
||||
import com.glodblock.github.common.item.ItemPortableFluidCell;
|
||||
import com.glodblock.github.common.item.ItemQuantumBridgeCard;
|
||||
import com.glodblock.github.common.item.ItemWirelessFluidTerminal;
|
||||
import com.glodblock.github.common.item.ItemWirelessInterfaceTerminal;
|
||||
import com.glodblock.github.common.item.ItemWirelessLevelTerminal;
|
||||
import com.glodblock.github.common.item.ItemWirelessPatternTerminal;
|
||||
@@ -65,25 +60,21 @@ public class ItemAndBlockHolder {
|
||||
public static BlockSuperStockReplenisher SUPER_STOCK_RERPLENISHER = new BlockSuperStockReplenisher().register();
|
||||
public static ItemFluidDrop DROP = new ItemFluidDrop().register();
|
||||
public static ItemFluidEncodedPattern PATTERN = new ItemFluidEncodedPattern().register();
|
||||
public static ItemPartFluidTerminal FLUID_TERM = new ItemPartFluidTerminal().register();
|
||||
public static ItemPartFluidPatternTerminal FLUID_TERMINAL = new ItemPartFluidPatternTerminal().register();
|
||||
public static ItemPartFluidPatternTerminalEx FLUID_TERMINAL_EX = new ItemPartFluidPatternTerminalEx().register();
|
||||
public static ItemPartFluidInterface FLUID_INTERFACE = new ItemPartFluidInterface().register();
|
||||
public static ItemPartFluidP2PInterface FLUID_INTERFACE_P2P = new ItemPartFluidP2PInterface().register();
|
||||
public static ItemPartLevelTerminal LEVEL_TERMINAL = new ItemPartLevelTerminal().register();
|
||||
public static ItemFluidImportBus FLUID_IMPORT_BUS = new ItemFluidImportBus().register();
|
||||
public static ItemFluidExportBus FLUID_EXPORT_BUS = new ItemFluidExportBus().register();
|
||||
public static ItemPartFluidStorageBus FLUID_STORAGE_BUS = new ItemPartFluidStorageBus().register();
|
||||
public static ItemFluidLevelEmitter FLUID_LEVEL_EMITTER = new ItemFluidLevelEmitter().register();
|
||||
public static ItemFluidStorageMonitor FLUID_STORAGE_MONITOR = new ItemFluidStorageMonitor().register();
|
||||
public static ItemFluidConversionMonitor FLUID_CONVERSION_MONITOR = new ItemFluidConversionMonitor().register();
|
||||
public static ItemPortableFluidCell PORTABLE_FLUID_CELL = new ItemPortableFluidCell().register();
|
||||
public static ItemWirelessFluidTerminal WIRELESS_FLUID_TERM = new ItemWirelessFluidTerminal().register();
|
||||
public static ItemWirelessLevelTerminal WIRELESS_LEVEL_TERM = new ItemWirelessLevelTerminal().register();
|
||||
public static ItemWirelessPatternTerminal WIRELESS_PATTERN_TERM = new ItemWirelessPatternTerminal().register();
|
||||
public static ItemWirelessUltraTerminal WIRELESS_ULTRA_TERM = new ItemWirelessUltraTerminal().register();
|
||||
public static ItemWirelessInterfaceTerminal WIRELESS_INTERFACE_TERM = new ItemWirelessInterfaceTerminal()
|
||||
.register();
|
||||
public static ItemFluidFormationPlane FLUID_FORMATION_PLANE = new ItemFluidFormationPlane().register();
|
||||
public static ItemFluidAnnihilationPlane FLUID_ANNIHILATION_PLANE = new ItemFluidAnnihilationPlane().register();
|
||||
|
||||
public static ItemFluidPacket PACKET = new ItemFluidPacket().register();
|
||||
public static ItemBasicFluidStorageCell CELL1K = new ItemBasicFluidStorageCell(CellType.Cell1kPart, 0, 1)
|
||||
.register();
|
||||
|
||||
@@ -26,17 +26,11 @@ import static com.glodblock.github.loader.ItemAndBlockHolder.ENCODER;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.ENERGY_CARD;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_AUTO_FILLER;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_BUFFER;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_CONVERSION_MONITOR;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_EXPORT_BUS;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_IMPORT_BUS;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_INTERFACE;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_INTERFACE_P2P;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_LEVEL_EMITTER;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_STORAGE_BUS;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_STORAGE_MONITOR;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_TERM;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_TERMINAL;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_TERMINAL_EX;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.FLUID_VOID_CELL;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.INFINITY_WATER_CELL;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.INTERFACE;
|
||||
@@ -50,7 +44,6 @@ import static com.glodblock.github.loader.ItemAndBlockHolder.QUANTUM_BRIDGE_CARD
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.QUANTUM_CELL;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.SINGULARITY_CELL;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.WALRUS;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.WIRELESS_FLUID_TERM;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.WIRELESS_INTERFACE_TERM;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.WIRELESS_LEVEL_TERM;
|
||||
import static com.glodblock.github.loader.ItemAndBlockHolder.WIRELESS_PATTERN_TERM;
|
||||
@@ -182,8 +175,6 @@ public class RecipeLoader implements Runnable {
|
||||
GameRegistry.findItem("appliedenergistics2", "item.ItemMultiMaterial"),
|
||||
1,
|
||||
43);
|
||||
private static final ItemStack WCT_WIRELESS_TERM = GameRegistry
|
||||
.findItemStack("ae2wct", "wirelessCraftingTerminal", 1);
|
||||
public static final ItemStack BUCKET = new ItemStack(Items.bucket, 1);
|
||||
public static final ItemStack IRON_BAR = new ItemStack(Blocks.iron_bars, 1);
|
||||
public static final ItemStack AE2_ADVANCED_CARD = new ItemStack(
|
||||
@@ -278,28 +269,8 @@ public class RecipeLoader implements Runnable {
|
||||
'W',
|
||||
AE2_WORK_BENCH));
|
||||
GameRegistry.addShapelessRecipe(FLUID_STORAGE_BUS.stack(), FLUID_INTERFACE, STICKY_PISTON, PISTON);
|
||||
GameRegistry.addShapelessRecipe(FLUID_STORAGE_BUS.stack(), FLUID_STORAGE_BUS);
|
||||
GameRegistry.addShapelessRecipe(FLUID_STORAGE_BUS.stack(), INTERFACE, STICKY_PISTON, PISTON);
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
FLUID_STORAGE_MONITOR.stack(),
|
||||
"EIP",
|
||||
"P ",
|
||||
'I',
|
||||
"itemIlluminatedPanel",
|
||||
'E',
|
||||
AE2_LEVEL_EMITTER,
|
||||
'P',
|
||||
"dyeBlue"));
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
FLUID_CONVERSION_MONITOR.stack(),
|
||||
"ASF",
|
||||
'A',
|
||||
AE2_CORE_ANN,
|
||||
'S',
|
||||
FLUID_STORAGE_MONITOR,
|
||||
'F',
|
||||
AE2_CORE_FOM));
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(
|
||||
BUFFER.stack(),
|
||||
@@ -341,13 +312,6 @@ public class RecipeLoader implements Runnable {
|
||||
GameRegistry
|
||||
.addShapelessRecipe(LEVEL_MAINTAINER.stack(), AE2_CRAFTING_CP_UNIT, ENCODER, AE2_PATTERN_CAPACITY_CARD);
|
||||
|
||||
// Deprecated
|
||||
GameRegistry.addShapelessRecipe(AE2_TERMINAL, FLUID_TERM.stack());
|
||||
GameRegistry.addShapelessRecipe(AE2_WIRELESS_TERMINAL, WIRELESS_FLUID_TERM.stack());
|
||||
GameRegistry.addShapelessRecipe(AE2_LEVEL_EMITTER, FLUID_LEVEL_EMITTER.stack());
|
||||
GameRegistry.addShapelessRecipe(AE2_PATTERN_TERM, FLUID_TERMINAL.stack());
|
||||
GameRegistry.addShapelessRecipe(AE2_PATTERN_TERM_EX, FLUID_TERMINAL_EX.stack());
|
||||
|
||||
if (Config.fluidCells) {
|
||||
OreDictionary.registerOre("anyCertusCrystal", AE2_PURE_CERTUS);
|
||||
for (ItemStack it : OreDictionary.getOres("crystalCertusQuartz"))
|
||||
@@ -746,7 +710,8 @@ public class RecipeLoader implements Runnable {
|
||||
}
|
||||
|
||||
ItemStack[] term = { AE2_WIRELESS_TERMINAL, WIRELESS_PATTERN_TERM.stack(), WIRELESS_INTERFACE_TERM.stack(),
|
||||
WIRELESS_LEVEL_TERM.stack(), WCT_WIRELESS_TERM };
|
||||
WIRELESS_LEVEL_TERM.stack(),
|
||||
ModAndClassUtil.WCT ? GameRegistry.findItemStack("ae2wct", "wirelessCraftingTerminal", 1) : null };
|
||||
GameRegistry.addShapelessRecipe(
|
||||
WIRELESS_ULTRA_TERM.stack(),
|
||||
Arrays.stream(term).filter(Objects::nonNull).toArray());
|
||||
|
||||
@@ -4,11 +4,13 @@ import com.glodblock.github.client.render.ItemCertusQuartzTankRender;
|
||||
import com.glodblock.github.client.render.ItemDropRender;
|
||||
import com.glodblock.github.client.render.ItemPacketRender;
|
||||
import com.glodblock.github.client.render.ItemWalrusRender;
|
||||
import com.glodblock.github.client.render.WalrusRenderer;
|
||||
|
||||
public class RenderLoader implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
WalrusRenderer.load();
|
||||
new ItemDropRender();
|
||||
new ItemPacketRender();
|
||||
new ItemWalrusRender();
|
||||
|
||||
@@ -9,35 +9,41 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.p455w0rd.wirelesscraftingterminal.items.ItemEnum;
|
||||
import net.p455w0rd.wirelesscraftingterminal.items.ItemInfinityBooster;
|
||||
|
||||
import com.glodblock.github.common.item.ItemBaseWirelessTerminal;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class WirelessTerminalRecipe extends ShapelessRecipes {
|
||||
|
||||
private static final ItemStack infinityBoosterCard = ItemEnum.BOOSTER_CARD.getStack();
|
||||
private static ItemStack infinityBoosterCard;
|
||||
private final ItemStack installedTerm;
|
||||
|
||||
public WirelessTerminalRecipe(ItemStack term) {
|
||||
super(term, Arrays.asList(term, infinityBoosterCard));
|
||||
super(term, Arrays.asList(term, getInfinityBoosterCard()));
|
||||
this.installedTerm = installInfinityBoosterCard(term);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting inv, World w) {
|
||||
ItemStack term = inv.getStackInSlot(0);
|
||||
ItemStack infinityBoosterCard = inv.getStackInSlot(1);
|
||||
ItemStack card = inv.getStackInSlot(1);
|
||||
ItemStack recipeCard = getInfinityBoosterCard();
|
||||
return term != null && term.getItem() instanceof ItemBaseWirelessTerminal
|
||||
&& !hasInfinityBoosterCard(term)
|
||||
&& infinityBoosterCard != null
|
||||
&& infinityBoosterCard.getItem() instanceof ItemInfinityBooster;
|
||||
&& card != null
|
||||
&& recipeCard != null
|
||||
&& card.getItem() == recipeCard.getItem();
|
||||
}
|
||||
|
||||
public static ItemStack getInfinityBoosterCard() {
|
||||
return infinityBoosterCard.copy();
|
||||
if (!ModAndClassUtil.WCT) return null;
|
||||
if (infinityBoosterCard == null) {
|
||||
infinityBoosterCard = GameRegistry.findItemStack("ae2wct", "infinityBoosterCard", 1);
|
||||
}
|
||||
return infinityBoosterCard == null ? null : infinityBoosterCard.copy();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -119,7 +119,12 @@ public class NEICellViewHandler implements IUsageHandler {
|
||||
final String usedBytes = Platform.formatByteDouble(cellHandler.getUsedBytes());
|
||||
final String totalBytes = Platform.formatByteDouble(cellHandler.getTotalBytes());
|
||||
fontRenderer.drawString(
|
||||
usedBytes + " " + GuiText.Of.getLocal() + ' ' + totalBytes + ' ' + GuiText.BytesUsed.getLocal(),
|
||||
usedBytes + " "
|
||||
+ GuiText.Of.getLocal()
|
||||
+ ' '
|
||||
+ totalBytes
|
||||
+ ' '
|
||||
+ GuiText.FromStoragePercent.getLocal(),
|
||||
OFFSET_X,
|
||||
INFO_OFFSET_Y,
|
||||
0);
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
package com.glodblock.github.nei;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
|
||||
public class NEIUtils {
|
||||
|
||||
public static List<OrderStack<?>> compress(List<OrderStack<?>> list) {
|
||||
List<OrderStack<?>> comp = new LinkedList<>();
|
||||
for (OrderStack<?> orderStack : list) {
|
||||
if (orderStack == null) continue;
|
||||
if (orderStack.getStack() instanceof FluidStack) {
|
||||
comp.add(orderStack);
|
||||
continue;
|
||||
}
|
||||
ItemStack currentStack = (ItemStack) orderStack.getStack();
|
||||
if (currentStack.stackSize == 0) continue;
|
||||
boolean find = false;
|
||||
for (OrderStack<?> storedStack : comp) {
|
||||
if (storedStack == null || !(storedStack.getStack() instanceof ItemStack firstStack)) continue;
|
||||
boolean areItemStackEqual = firstStack.isItemEqual(currentStack)
|
||||
&& ItemStack.areItemStackTagsEqual(firstStack, currentStack);
|
||||
if (areItemStackEqual
|
||||
&& (firstStack.stackSize + currentStack.stackSize) <= firstStack.getMaxStackSize()) {
|
||||
find = true;
|
||||
((ItemStack) storedStack.getStack()).stackSize = firstStack.stackSize + currentStack.stackSize;
|
||||
}
|
||||
}
|
||||
if (!find) {
|
||||
comp.add(orderStack);
|
||||
}
|
||||
}
|
||||
return comp.stream().filter(Objects::nonNull).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static List<OrderStack<?>> clearNull(List<OrderStack<?>> list) {
|
||||
AtomicInteger i = new AtomicInteger(0);
|
||||
return list.stream().filter(Objects::nonNull)
|
||||
.filter(
|
||||
orderStack -> !(orderStack.getStack() != null && orderStack.getStack() instanceof ItemStack
|
||||
&& ((ItemStack) orderStack.getStack()).stackSize == 0))
|
||||
.peek(orderStack -> orderStack.setIndex(i.getAndIncrement())).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.glodblock.github.nei.object;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
public interface IRecipeExtractor {
|
||||
|
||||
List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs);
|
||||
|
||||
List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs);
|
||||
|
||||
default List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs, IRecipeHandler recipe, int index) {
|
||||
return getInputIngredients(rawInputs);
|
||||
}
|
||||
|
||||
default List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs, IRecipeHandler recipe,
|
||||
int index) {
|
||||
return getOutputIngredients(rawOutputs);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.glodblock.github.nei.object;
|
||||
|
||||
public interface IRecipeExtractorLegacy extends IRecipeExtractor {
|
||||
|
||||
String getClassName();
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package com.glodblock.github.nei.object;
|
||||
|
||||
public class IllegalOrderStackID extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = -3782749325355674453L;
|
||||
|
||||
public IllegalOrderStackID(int id) {
|
||||
super("Illegal type id: " + id);
|
||||
}
|
||||
}
|
||||
@@ -1,146 +0,0 @@
|
||||
package com.glodblock.github.nei.object;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
|
||||
public class OrderStack<T> {
|
||||
|
||||
private T RealStack;
|
||||
private int index;
|
||||
private ItemStack[] items;
|
||||
|
||||
public static final int ITEM = 1;
|
||||
public static final int FLUID = 2;
|
||||
public static final int CUSTOM = 3;
|
||||
|
||||
public OrderStack(T stack, int order) {
|
||||
if (stack == null || order < 0)
|
||||
throw new IllegalArgumentException("Trying to create a null or negative order stack!");
|
||||
this.RealStack = stack;
|
||||
this.index = order;
|
||||
}
|
||||
|
||||
public OrderStack(T stack, int order, ItemStack[] items) {
|
||||
this(stack, order);
|
||||
if (items.length > 1) {
|
||||
this.items = items;
|
||||
}
|
||||
}
|
||||
|
||||
public void putStack(T stack) {
|
||||
this.RealStack = stack;
|
||||
}
|
||||
|
||||
public void putItems(ItemStack[] items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
public ItemStack[] getItems() {
|
||||
return this.items;
|
||||
}
|
||||
|
||||
public final void setIndex(int i) {
|
||||
this.index = i;
|
||||
}
|
||||
|
||||
public T getStack() {
|
||||
return RealStack;
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
public static OrderStack<ItemStack> pack(PositionedStack stack, int index) {
|
||||
if (stack != null && stack.items != null && stack.items.length > 0) {
|
||||
if (Items.feather.getDamage(stack.items[0]) == OreDictionary.WILDCARD_VALUE) {
|
||||
ItemStack tmp = stack.items[0].copy();
|
||||
tmp.setItemDamage(0);
|
||||
return new OrderStack<>(tmp, index);
|
||||
} else return new OrderStack<>(stack.items[0].copy(), index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static OrderStack<?> packFluid(PositionedStack stack, int index) {
|
||||
if (stack != null && stack.items != null && stack.items.length > 0) {
|
||||
FluidStack fluid = Util.getFluidFromItem(stack.items[0]);
|
||||
if (fluid != null) return new OrderStack<>(fluid.copy(), index);
|
||||
else return pack(stack, index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void customNBTWriter(NBTTagCompound buf) {}
|
||||
|
||||
protected T customNBTReader(NBTTagCompound buf) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public final void writeToNBT(NBTTagCompound buf) {
|
||||
if (RealStack instanceof ItemStack) {
|
||||
NBTTagCompound tmp = new NBTTagCompound();
|
||||
tmp.setByte("t", (byte) ITEM);
|
||||
Util.writeItemStackToNBT(((ItemStack) RealStack), tmp);
|
||||
// replacement items
|
||||
if (items != null) {
|
||||
NBTTagList list = new NBTTagList();
|
||||
for (ItemStack is : this.items) {
|
||||
Util.writeItemStackToNBT(is, new NBTTagCompound());
|
||||
}
|
||||
tmp.setTag(index + ":", list);
|
||||
}
|
||||
buf.setTag(index + ":", tmp);
|
||||
} else if (RealStack instanceof FluidStack) {
|
||||
NBTTagCompound tmp = new NBTTagCompound();
|
||||
tmp.setByte("t", (byte) FLUID);
|
||||
((FluidStack) RealStack).writeToNBT(tmp);
|
||||
buf.setTag(index + ":", tmp);
|
||||
} else {
|
||||
NBTTagCompound tmp = new NBTTagCompound();
|
||||
tmp.setByte("t", (byte) CUSTOM);
|
||||
customNBTWriter(tmp);
|
||||
buf.setTag(index + ":", tmp);
|
||||
}
|
||||
}
|
||||
|
||||
public static OrderStack<?> readFromNBT(NBTTagCompound buf, @Nullable OrderStack<?> dummy, int index) {
|
||||
if (!buf.hasKey(index + ":")) return null;
|
||||
NBTTagCompound info = buf.getCompoundTag(index + ":");
|
||||
byte id = info.getByte("t");
|
||||
switch (id) {
|
||||
case ITEM -> {
|
||||
List<ItemStack> list = new ArrayList<>();
|
||||
if (info.hasKey(index + ":")) {
|
||||
NBTTagList items = info.getTagList(index + ":", 10);
|
||||
for (int x = 0; x < items.tagCount(); x++) {
|
||||
final NBTTagCompound item = items.getCompoundTagAt(x);
|
||||
list.add(Util.loadItemStackFromNBT(item));
|
||||
}
|
||||
}
|
||||
return new OrderStack<>(Util.loadItemStackFromNBT(info), index, list.toArray(new ItemStack[0]));
|
||||
}
|
||||
case FLUID -> {
|
||||
return new OrderStack<>(FluidStack.loadFluidStackFromNBT(info), index);
|
||||
}
|
||||
case CUSTOM -> {
|
||||
if (dummy == null) throw new IllegalOrderStackID(id);
|
||||
return new OrderStack<>(dummy.customNBTReader(buf), index);
|
||||
}
|
||||
default -> throw new IllegalOrderStackID(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
package com.glodblock.github.nei.recipes;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import com.glodblock.github.nei.recipes.extractor.AvaritiaRecipeExtractor;
|
||||
import com.glodblock.github.nei.recipes.extractor.EnderIORecipeExtractor;
|
||||
import com.glodblock.github.nei.recipes.extractor.ForestryRecipeExtractor;
|
||||
import com.glodblock.github.nei.recipes.extractor.GTPPRecipeExtractor;
|
||||
import com.glodblock.github.nei.recipes.extractor.GregTech5RecipeExtractor;
|
||||
import com.glodblock.github.nei.recipes.extractor.GregTech6RecipeExtractor;
|
||||
import com.glodblock.github.nei.recipes.extractor.IndustrialCraftRecipeExtractor;
|
||||
import com.glodblock.github.nei.recipes.extractor.VanillaRecipeExtractor;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
|
||||
import forestry.factory.recipes.nei.NEIHandlerBottler;
|
||||
import forestry.factory.recipes.nei.NEIHandlerCarpenter;
|
||||
import forestry.factory.recipes.nei.NEIHandlerCentrifuge;
|
||||
import forestry.factory.recipes.nei.NEIHandlerFabricator;
|
||||
import forestry.factory.recipes.nei.NEIHandlerFermenter;
|
||||
import forestry.factory.recipes.nei.NEIHandlerMoistener;
|
||||
import forestry.factory.recipes.nei.NEIHandlerSqueezer;
|
||||
import forestry.factory.recipes.nei.NEIHandlerStill;
|
||||
import gregapi.recipes.Recipe;
|
||||
|
||||
public class DefaultExtractorLoader implements Runnable {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
FluidRecipe.addRecipeMap("smelting", new VanillaRecipeExtractor(false));
|
||||
FluidRecipe.addRecipeMap("brewing", new VanillaRecipeExtractor(false));
|
||||
FluidRecipe.addRecipeMap("crafting", new VanillaRecipeExtractor(true));
|
||||
FluidRecipe.addRecipeMap("crafting2x2", new VanillaRecipeExtractor(true));
|
||||
|
||||
if (ModAndClassUtil.GT5) {
|
||||
try {
|
||||
Class<?> recipeMapClazz = Class.forName("gregtech.api.util.GTRecipe$GT_Recipe_Map");
|
||||
Collection<?> sMappings = (Collection<?>) recipeMapClazz.getDeclaredField("sMappings").get(null);
|
||||
for (Object tMap : sMappings) {
|
||||
String mNEIName = (String) recipeMapClazz.getDeclaredField("mNEIName").get(tMap);
|
||||
FluidRecipe.addRecipeMap(
|
||||
mNEIName,
|
||||
new GregTech5RecipeExtractor(
|
||||
mNEIName.equals("gt.recipe.scanner")
|
||||
|| mNEIName.equals("gt.recipe.fakeAssemblylineProcess")));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (ModAndClassUtil.GT6) {
|
||||
for (Recipe.RecipeMap tMap : Recipe.RecipeMap.RECIPE_MAPS.values()) {
|
||||
FluidRecipe.addRecipeMap(tMap.mNameNEI, new GregTech6RecipeExtractor(tMap));
|
||||
}
|
||||
}
|
||||
|
||||
if (ModAndClassUtil.GTPP && !ModAndClassUtil.GT5NH) {
|
||||
try {
|
||||
Class<?> gtRecipeMapClazz = Class.forName("gregtech.api.util.GT_Recipe$GT_Recipe_Map");
|
||||
Class<?> gtppRecipeMapClazz = Class.forName("gregtech.api.util.GTPP_Recipe$GTPP_Recipe_Map_Internal");
|
||||
Collection<?> sMappingsEx = (Collection<?>) gtppRecipeMapClazz.getDeclaredField("sMappingsEx")
|
||||
.get(null);
|
||||
for (Object gtppMap : sMappingsEx) {
|
||||
boolean mNEIAllowed = gtRecipeMapClazz.getDeclaredField("mNEIAllowed").getBoolean(gtppMap);
|
||||
if (mNEIAllowed) {
|
||||
String mNEIName = (String) gtRecipeMapClazz.getDeclaredField("mNEIName").get(gtppMap);
|
||||
FluidRecipe.addRecipeMap(mNEIName, new GTPPRecipeExtractor());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (ModAndClassUtil.EIO) {
|
||||
FluidRecipe.addRecipeMap("EIOEnchanter", new EnderIORecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("EnderIOAlloySmelter", new EnderIORecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("EnderIOSagMill", new EnderIORecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("EnderIOSliceAndSplice", new EnderIORecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("EnderIOSoulBinder", new EnderIORecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("EnderIOVat", new EnderIORecipeExtractor());
|
||||
}
|
||||
|
||||
if (ModAndClassUtil.AVARITIA) {
|
||||
FluidRecipe.addRecipeMap("extreme", new AvaritiaRecipeExtractor());
|
||||
}
|
||||
|
||||
if (ModAndClassUtil.FTR) {
|
||||
// GTNH
|
||||
FluidRecipe.addRecipeMap("forestry.bottler", new ForestryRecipeExtractor(new NEIHandlerBottler()));
|
||||
FluidRecipe.addRecipeMap("forestry.carpenter", new ForestryRecipeExtractor(new NEIHandlerCarpenter()));
|
||||
FluidRecipe.addRecipeMap("forestry.centrifuge", new ForestryRecipeExtractor(new NEIHandlerCentrifuge()));
|
||||
FluidRecipe.addRecipeMap("forestry.fabricator", new ForestryRecipeExtractor(new NEIHandlerFabricator()));
|
||||
FluidRecipe.addRecipeMap("forestry.fermenter", new ForestryRecipeExtractor(new NEIHandlerFermenter()));
|
||||
FluidRecipe.addRecipeMap("forestry.moistener", new ForestryRecipeExtractor(new NEIHandlerMoistener()));
|
||||
FluidRecipe.addRecipeMap("forestry.squeezer", new ForestryRecipeExtractor(new NEIHandlerSqueezer()));
|
||||
FluidRecipe.addRecipeMap("forestry.still", new ForestryRecipeExtractor(new NEIHandlerStill()));
|
||||
|
||||
// LEGACY
|
||||
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerBottler()));
|
||||
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerCarpenter()));
|
||||
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerCentrifuge()));
|
||||
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerFabricator()));
|
||||
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerFermenter()));
|
||||
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerMoistener()));
|
||||
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerSqueezer()));
|
||||
FluidRecipe.addRecipeMap(null, new ForestryRecipeExtractor(new NEIHandlerStill()));
|
||||
}
|
||||
|
||||
if (ModAndClassUtil.IC2) {
|
||||
FluidRecipe.addRecipeMap("blastfurnace", new IndustrialCraftRecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("BlockCutter", new IndustrialCraftRecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("centrifuge", new IndustrialCraftRecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("compressor", new IndustrialCraftRecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("extractor", new IndustrialCraftRecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("fluidcanner", new IndustrialCraftRecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("macerator", new IndustrialCraftRecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("metalformer", new IndustrialCraftRecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("oreWashing", new IndustrialCraftRecipeExtractor());
|
||||
FluidRecipe.addRecipeMap("solidcanner", new IndustrialCraftRecipeExtractor());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
package com.glodblock.github.nei.recipes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.glodblock.github.nei.object.IRecipeExtractor;
|
||||
import com.glodblock.github.nei.object.IRecipeExtractorLegacy;
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
|
||||
public final class FluidRecipe {
|
||||
|
||||
private static final HashMap<String, IRecipeExtractor> IdentifierMap = new HashMap<>();
|
||||
private static final HashMap<String, IRecipeExtractor> IdentifierMapLegacy = new HashMap<>();
|
||||
|
||||
public static void addRecipeMap(String recipeIdentifier, IRecipeExtractor extractor) {
|
||||
IdentifierMap.put(recipeIdentifier, extractor);
|
||||
if (recipeIdentifier == null && extractor instanceof IRecipeExtractorLegacy) {
|
||||
IdentifierMapLegacy.put(((IRecipeExtractorLegacy) extractor).getClassName(), extractor);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<OrderStack<?>> getPackageInputs(IRecipeHandler recipe, int index, boolean priority) {
|
||||
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
|
||||
if (tRecipe == null) return new ArrayList<>();
|
||||
if (!IdentifierMap.containsKey(tRecipe.getOverlayIdentifier())) return getDefaultPackageInputs(tRecipe, index);
|
||||
if (tRecipe.getOverlayIdentifier() == null) return getPackageInputsLegacy(recipe, index);
|
||||
IRecipeExtractor extractor = IdentifierMap.get(tRecipe.getOverlayIdentifier());
|
||||
if (extractor == null) return new ArrayList<>();
|
||||
List<PositionedStack> tmp = new ArrayList<>(tRecipe.getIngredientStacks(index));
|
||||
List<OrderStack<?>> out = extractor.getInputIngredients(tmp, recipe, index);
|
||||
if (priority) {
|
||||
List<OrderStack<?>> reordered = new ArrayList<>();
|
||||
byte numFluids = 0;
|
||||
for (OrderStack<?> orderStack : out) {
|
||||
if (orderStack != null && orderStack.getStack() instanceof FluidStack) {
|
||||
reordered.add(new OrderStack<>(orderStack.getStack(), numFluids++));
|
||||
}
|
||||
}
|
||||
for (OrderStack<?> orderStack : out) {
|
||||
if (orderStack != null && orderStack.getStack() instanceof ItemStack) {
|
||||
reordered.add(new OrderStack<>(orderStack.getStack(), numFluids++));
|
||||
}
|
||||
}
|
||||
return reordered;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
private static List<OrderStack<?>> getDefaultPackageInputs(TemplateRecipeHandler tRecipe, int index) {
|
||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||
AtomicInteger i = new AtomicInteger(0);
|
||||
tRecipe.getIngredientStacks(index)
|
||||
.forEach(ps -> tmp.add(new OrderStack<>(ps.item, i.getAndIncrement(), ps.items)));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
private static List<OrderStack<?>> getDefaultPackageOutputs(TemplateRecipeHandler tRecipe, int index) {
|
||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||
AtomicInteger i = new AtomicInteger(0);
|
||||
tmp.add(new OrderStack<>(tRecipe.getResultStack(index).item, i.getAndIncrement()));
|
||||
tRecipe.getOtherStacks(index).forEach(ps -> tmp.add(new OrderStack<>(ps.item, i.getAndIncrement())));
|
||||
return tmp;
|
||||
}
|
||||
|
||||
public static List<OrderStack<?>> getPackageOutputs(IRecipeHandler recipe, int index, boolean useOther) {
|
||||
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
|
||||
if (tRecipe == null) return new ArrayList<>();
|
||||
if (!IdentifierMap.containsKey(tRecipe.getOverlayIdentifier())) return getDefaultPackageOutputs(tRecipe, index);
|
||||
if (tRecipe.getOverlayIdentifier() == null) return getPackageOutputsLegacy(recipe, index, useOther);
|
||||
IRecipeExtractor extractor = IdentifierMap.get(tRecipe.getOverlayIdentifier());
|
||||
if (extractor == null) return new ArrayList<>();
|
||||
List<PositionedStack> tmp = new ArrayList<>(Collections.singleton(tRecipe.getResultStack(index)));
|
||||
if (useOther) tmp.addAll(tRecipe.getOtherStacks(index));
|
||||
return extractor.getOutputIngredients(tmp, recipe, index);
|
||||
}
|
||||
|
||||
public static List<String> getSupportRecipes() {
|
||||
return new ArrayList<>(IdentifierMap.keySet());
|
||||
}
|
||||
|
||||
public static List<OrderStack<?>> getPackageInputsLegacy(IRecipeHandler recipe, int index) {
|
||||
if (recipe == null || !IdentifierMapLegacy.containsKey(recipe.getClass().getName())) return new ArrayList<>();
|
||||
IRecipeExtractor extractor = IdentifierMapLegacy.get(recipe.getClass().getName());
|
||||
if (extractor == null) return new ArrayList<>();
|
||||
List<PositionedStack> tmp = new ArrayList<>(recipe.getIngredientStacks(index));
|
||||
return extractor.getInputIngredients(tmp, recipe, index);
|
||||
}
|
||||
|
||||
public static List<OrderStack<?>> getPackageOutputsLegacy(IRecipeHandler recipe, int index, boolean useOther) {
|
||||
if (recipe == null || !IdentifierMapLegacy.containsKey(recipe.getClass().getName())) return new ArrayList<>();
|
||||
IRecipeExtractor extractor = IdentifierMapLegacy.get(recipe.getClass().getName());
|
||||
if (extractor == null) return new ArrayList<>();
|
||||
List<PositionedStack> tmp = new ArrayList<>(Collections.singleton(recipe.getResultStack(index)));
|
||||
if (useOther) tmp.addAll(recipe.getOtherStacks(index));
|
||||
return extractor.getOutputIngredients(tmp, recipe, index);
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.glodblock.github.nei.recipes.extractor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.glodblock.github.nei.NEIUtils;
|
||||
import com.glodblock.github.nei.object.IRecipeExtractor;
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
|
||||
public class AvaritiaRecipeExtractor implements IRecipeExtractor {
|
||||
|
||||
public AvaritiaRecipeExtractor() {}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs, IRecipeHandler recipe, int index) {
|
||||
return getInputIngredients(rawInputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs, IRecipeHandler recipe,
|
||||
int index) {
|
||||
return getOutputIngredients(rawOutputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
||||
return NEIUtils.compress(ExtractorUtil.packItemStack(rawInputs));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
||||
return ExtractorUtil.packItemStack(rawOutputs);
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
package com.glodblock.github.nei.recipes.extractor;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.glodblock.github.nei.object.IRecipeExtractor;
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
import com.glodblock.github.util.Ae2Reflect;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import crazypants.enderio.machine.crusher.CrusherRecipeManager;
|
||||
import crazypants.enderio.nei.VatRecipeHandler;
|
||||
|
||||
public class EnderIORecipeExtractor implements IRecipeExtractor {
|
||||
|
||||
public EnderIORecipeExtractor() {}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
||||
return ExtractorUtil.packItemStack(rawInputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
||||
return ExtractorUtil.packItemStack(rawOutputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs, IRecipeHandler recipe, int index) {
|
||||
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
|
||||
List<OrderStack<?>> tmp;
|
||||
if (tRecipe.arecipes.get(index) instanceof VatRecipeHandler.InnerVatRecipe vatRecipe) {
|
||||
ArrayList<PositionedStack> inputs = ReflectEIO.getInputs(vatRecipe);
|
||||
tmp = ExtractorUtil.packItemStack(inputs);
|
||||
FluidStack in = ReflectEIO.getInputFluid(vatRecipe);
|
||||
if (in != null) {
|
||||
tmp.add(new OrderStack<>(in, inputs.size()));
|
||||
}
|
||||
return tmp;
|
||||
} else if (tRecipe.getOverlayIdentifier().equals("EnderIOSagMill")) {
|
||||
for (int i = rawInputs.size() - 1; i >= 0; i--) {
|
||||
PositionedStack stack = rawInputs.get(i);
|
||||
if (stack != null && CrusherRecipeManager.getInstance().isValidSagBall(stack.items[0])) {
|
||||
rawInputs.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return getInputIngredients(rawInputs);
|
||||
} else {
|
||||
return getInputIngredients(rawInputs);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs, IRecipeHandler recipe,
|
||||
int index) {
|
||||
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
|
||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||
if (tRecipe.arecipes.get(index) instanceof VatRecipeHandler.InnerVatRecipe vatRecipe) {
|
||||
FluidStack result = ReflectEIO.getResult(vatRecipe);
|
||||
if (result != null) {
|
||||
tmp.add(new OrderStack<>(result, 0));
|
||||
}
|
||||
return tmp;
|
||||
} else {
|
||||
return getOutputIngredients(rawOutputs);
|
||||
}
|
||||
}
|
||||
|
||||
private static class ReflectEIO {
|
||||
|
||||
private static final Field inputsF;
|
||||
private static final Field resultF;
|
||||
private static final Field inFluidF;
|
||||
|
||||
static {
|
||||
try {
|
||||
inputsF = Ae2Reflect.reflectField(VatRecipeHandler.InnerVatRecipe.class, "inputs");
|
||||
resultF = Ae2Reflect.reflectField(VatRecipeHandler.InnerVatRecipe.class, "result");
|
||||
inFluidF = Ae2Reflect.reflectField(VatRecipeHandler.InnerVatRecipe.class, "inFluid");
|
||||
} catch (NoSuchFieldException e) {
|
||||
throw new IllegalStateException("Failed to initialize EIO reflection hacks!", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static ArrayList<PositionedStack> getInputs(VatRecipeHandler.InnerVatRecipe vat) {
|
||||
return Ae2Reflect.readField(vat, inputsF);
|
||||
}
|
||||
|
||||
private static FluidStack getResult(VatRecipeHandler.InnerVatRecipe vat) {
|
||||
return Ae2Reflect.readField(vat, resultF);
|
||||
}
|
||||
|
||||
private static FluidStack getInputFluid(VatRecipeHandler.InnerVatRecipe vat) {
|
||||
return Ae2Reflect.readField(vat, inFluidF);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.glodblock.github.nei.recipes.extractor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
|
||||
public final class ExtractorUtil {
|
||||
|
||||
public static List<OrderStack<?>> packItemStack(List<PositionedStack> items) {
|
||||
AtomicInteger index = new AtomicInteger(-1);
|
||||
return items.stream().map(item -> {
|
||||
index.getAndIncrement();
|
||||
return OrderStack.pack(item, index.get());
|
||||
}).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public static List<OrderStack<?>> packItemStack(List<PositionedStack> items,
|
||||
Function<PositionedStack, Object> transformer) {
|
||||
AtomicInteger index = new AtomicInteger(-1);
|
||||
return items.stream().map(item -> {
|
||||
index.getAndIncrement();
|
||||
Object o = transformer.apply(item);
|
||||
return o != null ? new OrderStack<>(o, index.get(), item.items) : null;
|
||||
}).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
package com.glodblock.github.nei.recipes.extractor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.glodblock.github.nei.object.IRecipeExtractorLegacy;
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import forestry.core.recipes.nei.PositionedFluidTank;
|
||||
import forestry.core.recipes.nei.RecipeHandlerBase;
|
||||
import forestry.factory.recipes.nei.NEIHandlerFabricator;
|
||||
import forestry.factory.recipes.nei.NEIHandlerSqueezer;
|
||||
|
||||
public class ForestryRecipeExtractor implements IRecipeExtractorLegacy {
|
||||
|
||||
private final IRecipeHandler handler;
|
||||
|
||||
public ForestryRecipeExtractor(IRecipeHandler recipes) {
|
||||
handler = recipes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getClassName() {
|
||||
return handler.getClass().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
||||
return ExtractorUtil.packItemStack(rawInputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
||||
return ExtractorUtil.packItemStack(rawOutputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs, IRecipeHandler recipe, int index) {
|
||||
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
|
||||
List<OrderStack<?>> tmp = new ArrayList<>();
|
||||
if (tRecipe.arecipes.get(index) instanceof RecipeHandlerBase.CachedBaseRecipe) {
|
||||
tmp = getInputIngredients(rawInputs);
|
||||
List<PositionedFluidTank> tanks = ((RecipeHandlerBase.CachedBaseRecipe) tRecipe.arecipes.get(index))
|
||||
.getFluidTanks();
|
||||
if (tanks.size() > 0 && !(handler instanceof NEIHandlerSqueezer)) {
|
||||
FluidStack fluid = tanks.get(0).tank.getFluid();
|
||||
if (fluid != null) {
|
||||
tmp.add(new OrderStack<>(fluid, rawInputs.size()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs, IRecipeHandler recipe,
|
||||
int index) {
|
||||
TemplateRecipeHandler tRecipe = (TemplateRecipeHandler) recipe;
|
||||
removeGlass(rawOutputs);
|
||||
List<OrderStack<?>> tmp = new ArrayList<>();
|
||||
if (tRecipe.arecipes.get(index) instanceof RecipeHandlerBase.CachedBaseRecipe) {
|
||||
tmp = getOutputIngredients(rawOutputs);
|
||||
List<PositionedFluidTank> tanks = ((RecipeHandlerBase.CachedBaseRecipe) tRecipe.arecipes.get(index))
|
||||
.getFluidTanks();
|
||||
if (tanks.size() > 0 && handler instanceof NEIHandlerSqueezer) {
|
||||
FluidStack fluid = tanks.get(0).tank.getFluid();
|
||||
if (fluid != null) {
|
||||
tmp.add(new OrderStack<>(fluid, rawOutputs.size()));
|
||||
}
|
||||
} else if (tanks.size() > 1) {
|
||||
FluidStack fluid = tanks.get(1).tank.getFluid();
|
||||
if (fluid != null) {
|
||||
tmp.add(new OrderStack<>(fluid, rawOutputs.size()));
|
||||
}
|
||||
}
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
private void removeGlass(List<PositionedStack> list) {
|
||||
if (handler instanceof NEIHandlerFabricator) {
|
||||
list.remove(list.size() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.glodblock.github.nei.recipes.extractor;
|
||||
|
||||
public class GTPPRecipeExtractor extends GregTech5RecipeExtractor {
|
||||
|
||||
public GTPPRecipeExtractor() {
|
||||
super(false);
|
||||
}
|
||||
}
|
||||
-62
@@ -1,62 +0,0 @@
|
||||
package com.glodblock.github.nei.recipes.extractor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.glodblock.github.nei.object.IRecipeExtractor;
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import gregtech.api.enums.ItemList;
|
||||
import gregtech.common.items.ItemFluidDisplay;
|
||||
|
||||
public class GregTech5RecipeExtractor implements IRecipeExtractor {
|
||||
|
||||
boolean removeSpecial;
|
||||
|
||||
public GregTech5RecipeExtractor(boolean removeSpecial) {
|
||||
this.removeSpecial = removeSpecial;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
||||
if (removeSpecial) removeSpecial(rawInputs);
|
||||
return ExtractorUtil.packItemStack(rawInputs, GregTech5RecipeExtractor::getFluidFromDisplay);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
||||
return ExtractorUtil.packItemStack(rawOutputs, GregTech5RecipeExtractor::getFluidFromDisplay);
|
||||
}
|
||||
|
||||
private void removeSpecial(List<PositionedStack> list) {
|
||||
for (int i = list.size() - 1; i >= 0; i--) {
|
||||
PositionedStack positionedStack = list.get(i);
|
||||
if (positionedStack != null && (positionedStack.items[0].isItemEqual(ItemList.Tool_DataStick.get(1))
|
||||
|| positionedStack.items[0].isItemEqual(ItemList.Tool_DataOrb.get(1)))) {
|
||||
list.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Object getFluidFromDisplay(PositionedStack stack) {
|
||||
if (stack != null) {
|
||||
ItemStack item = stack.items[0].copy();
|
||||
if (item.getItem() instanceof ItemFluidDisplay) {
|
||||
if (item.getTagCompound() != null) {
|
||||
Fluid fluid = FluidRegistry.getFluid(item.getItemDamage());
|
||||
int amt = (int) item.getTagCompound().getLong("mFluidDisplayAmount");
|
||||
return amt > 0 && fluid != null ? new FluidStack(fluid, amt) : null;
|
||||
}
|
||||
} else {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
-62
@@ -1,62 +0,0 @@
|
||||
package com.glodblock.github.nei.recipes.extractor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.glodblock.github.nei.object.IRecipeExtractor;
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import gregapi.item.ItemFluidDisplay;
|
||||
import gregapi.recipes.Recipe;
|
||||
|
||||
public class GregTech6RecipeExtractor implements IRecipeExtractor {
|
||||
|
||||
private final Recipe.RecipeMap Recipes;
|
||||
|
||||
public GregTech6RecipeExtractor(Recipe.RecipeMap aMap) {
|
||||
Recipes = aMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
||||
this.removeMachine(rawInputs);
|
||||
return ExtractorUtil.packItemStack(rawInputs, GregTech6RecipeExtractor::getFluidFromDisplay);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
||||
return ExtractorUtil.packItemStack(rawOutputs, GregTech6RecipeExtractor::getFluidFromDisplay);
|
||||
}
|
||||
|
||||
private void removeMachine(List<PositionedStack> list) {
|
||||
for (int i = list.size() - 1; i >= 0; i--) {
|
||||
PositionedStack positionedStack = list.get(i);
|
||||
if (positionedStack != null) {
|
||||
for (ItemStack machine : this.Recipes.mRecipeMachineList) {
|
||||
if (positionedStack.items[0].isItemEqual(machine)) {
|
||||
list.remove(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Object getFluidFromDisplay(PositionedStack stack) {
|
||||
if (stack != null) {
|
||||
ItemStack item = stack.items[0].copy();
|
||||
if (item.getItem() instanceof ItemFluidDisplay) {
|
||||
if (item.getTagCompound() != null) {
|
||||
FluidStack fluid = ((ItemFluidDisplay) item.getItem()).getFluid(item);
|
||||
return fluid != null && fluid.amount > 0 ? fluid : null;
|
||||
}
|
||||
} else {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
-107
@@ -1,107 +0,0 @@
|
||||
package com.glodblock.github.nei.recipes.extractor;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import com.glodblock.github.nei.object.IRecipeExtractor;
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
import com.glodblock.github.util.Ae2Reflect;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.IRecipeHandler;
|
||||
import ic2.neiIntegration.core.recipehandler.FluidCannerRecipeHandler;
|
||||
import ic2.neiIntegration.core.recipehandler.OreWashingRecipeHandler;
|
||||
|
||||
public class IndustrialCraftRecipeExtractor implements IRecipeExtractor {
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
||||
return ExtractorUtil.packItemStack(rawInputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
||||
return ExtractorUtil.packItemStack(rawOutputs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs, IRecipeHandler recipe, int index) {
|
||||
List<OrderStack<?>> stacks = new LinkedList<>();
|
||||
|
||||
if (recipe instanceof FluidCannerRecipeHandler) {
|
||||
FluidCannerRecipeHandler.CachedFluidCannerRecipe cachedRecipe = (FluidCannerRecipeHandler.CachedFluidCannerRecipe) ((FluidCannerRecipeHandler) recipe).arecipes
|
||||
.get(index);
|
||||
FluidStack input = ReflectIC2.getInputFluid(cachedRecipe);
|
||||
PositionedStack add = rawInputs.size() > 1 ? rawInputs.get(1) : null;
|
||||
stacks.add(OrderStack.pack(add, 0));
|
||||
stacks.add(new OrderStack<>(input, 1));
|
||||
} else if (recipe instanceof OreWashingRecipeHandler) {
|
||||
stacks = getInputIngredients(rawInputs);
|
||||
int water = ReflectIC2.getOreWasherWater((OreWashingRecipeHandler) recipe, index);
|
||||
stacks.add(new OrderStack<>(new FluidStack(FluidRegistry.WATER, water), stacks.size()));
|
||||
} else {
|
||||
stacks = getInputIngredients(rawInputs);
|
||||
}
|
||||
|
||||
return stacks.stream().filter(Objects::nonNull).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs, IRecipeHandler recipe,
|
||||
int index) {
|
||||
List<OrderStack<?>> stacks = new LinkedList<>();
|
||||
|
||||
if (recipe instanceof FluidCannerRecipeHandler) {
|
||||
FluidCannerRecipeHandler.CachedFluidCannerRecipe cachedRecipe = (FluidCannerRecipeHandler.CachedFluidCannerRecipe) ((FluidCannerRecipeHandler) recipe).arecipes
|
||||
.get(index);
|
||||
FluidStack output = ReflectIC2.getOutputFluid(cachedRecipe);
|
||||
stacks.add(new OrderStack<>(output, 0));
|
||||
} else {
|
||||
stacks = getOutputIngredients(rawOutputs);
|
||||
}
|
||||
|
||||
return stacks.stream().filter(Objects::nonNull).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private static class ReflectIC2 {
|
||||
|
||||
private static final Field inputsF;
|
||||
private static final Field resultF;
|
||||
|
||||
private static final Method oreWasherWater;
|
||||
|
||||
static {
|
||||
try {
|
||||
inputsF = Ae2Reflect.reflectField(FluidCannerRecipeHandler.CachedFluidCannerRecipe.class, "fluidInput");
|
||||
resultF = Ae2Reflect
|
||||
.reflectField(FluidCannerRecipeHandler.CachedFluidCannerRecipe.class, "fluidOutput");
|
||||
oreWasherWater = Ae2Reflect.reflectMethod(OreWashingRecipeHandler.class, "getreqWater", int.class);
|
||||
} catch (NoSuchFieldException | NoSuchMethodException e) {
|
||||
throw new IllegalStateException("Failed to initialize IC2 reflection hacks!", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static FluidStack getInputFluid(FluidCannerRecipeHandler.CachedFluidCannerRecipe recipe) {
|
||||
return Ae2Reflect.readField(recipe, inputsF);
|
||||
}
|
||||
|
||||
private static FluidStack getOutputFluid(FluidCannerRecipeHandler.CachedFluidCannerRecipe recipe) {
|
||||
return Ae2Reflect.readField(recipe, resultF);
|
||||
}
|
||||
|
||||
private static int getOreWasherWater(OreWashingRecipeHandler recipeHandler, int index) {
|
||||
try {
|
||||
return (int) oreWasherWater.invoke(recipeHandler, index);
|
||||
} catch (Exception e) {
|
||||
throw new IllegalStateException("Failed to invoke method: " + oreWasherWater, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.glodblock.github.nei.recipes.extractor;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.glodblock.github.nei.object.IRecipeExtractor;
|
||||
import com.glodblock.github.nei.object.OrderStack;
|
||||
|
||||
import codechicken.nei.PositionedStack;
|
||||
|
||||
public class VanillaRecipeExtractor implements IRecipeExtractor {
|
||||
|
||||
private final boolean c;
|
||||
|
||||
public VanillaRecipeExtractor(boolean isCraft) {
|
||||
c = isCraft;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getInputIngredients(List<PositionedStack> rawInputs) {
|
||||
List<OrderStack<?>> tmp = new LinkedList<>();
|
||||
for (int i = 0; i < rawInputs.size(); i++) {
|
||||
if (rawInputs.get(i) == null) continue;
|
||||
final int col = (rawInputs.get(i).relx - 25) / 18;
|
||||
final int row = (rawInputs.get(i).rely - 6) / 18;
|
||||
int index = col + row * 3;
|
||||
OrderStack<?> stack = OrderStack.pack(rawInputs.get(i), c ? index : i);
|
||||
if (stack != null) tmp.add(stack);
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderStack<?>> getOutputIngredients(List<PositionedStack> rawOutputs) {
|
||||
return getInputIngredients(rawOutputs);
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,8 @@ public class CPacketLevelMaintainer implements IMessage {
|
||||
Batch,
|
||||
Enable,
|
||||
Disable,
|
||||
ToggleLiteMode,
|
||||
ClearLiteMode,
|
||||
}
|
||||
|
||||
private Action action;
|
||||
@@ -25,6 +27,12 @@ public class CPacketLevelMaintainer implements IMessage {
|
||||
@SuppressWarnings("unused")
|
||||
public CPacketLevelMaintainer() {}
|
||||
|
||||
public CPacketLevelMaintainer(Action action) {
|
||||
this.action = action;
|
||||
this.slotIndex = -1;
|
||||
this.size = 0;
|
||||
}
|
||||
|
||||
public CPacketLevelMaintainer(Action action, int slotIndex) {
|
||||
this.action = action;
|
||||
this.slotIndex = slotIndex;
|
||||
@@ -62,6 +70,8 @@ public class CPacketLevelMaintainer implements IMessage {
|
||||
case Batch -> clm.getTile().updateBatchSize(message.slotIndex, message.size);
|
||||
case Enable -> clm.getTile().updateStatus(message.slotIndex, false);
|
||||
case Disable -> clm.getTile().updateStatus(message.slotIndex, true);
|
||||
case ToggleLiteMode -> clm.getTile().toggleLiteMode();
|
||||
case ClearLiteMode -> clm.getTile().clearLiteMode();
|
||||
}
|
||||
clm.updateGui();
|
||||
}
|
||||
|
||||
@@ -12,8 +12,6 @@ import com.glodblock.github.inventory.gui.GuiType;
|
||||
import com.glodblock.github.util.BlockPos;
|
||||
|
||||
import appeng.api.parts.ILevelEmitter;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.PrimaryGui;
|
||||
import appeng.container.interfaces.IContainerSubGui;
|
||||
@@ -125,16 +123,13 @@ public class CPacketLevelTerminalCommands implements IMessage {
|
||||
TileEntity tile = DimensionManager.getWorld(message.dim)
|
||||
.getTileEntity(message.x, message.y, message.z);
|
||||
|
||||
if (tile instanceof IPartHost host) {
|
||||
IPart part = host.getPart(message.side);
|
||||
if (part instanceof ILevelEmitter) {
|
||||
InventoryHandler.openGui(
|
||||
player,
|
||||
tile.getWorldObj(),
|
||||
new BlockPos(tile),
|
||||
message.side,
|
||||
GuiType.LEVEL_EMITTER_PROXY);
|
||||
}
|
||||
if (Platform.getPartFromTE(tile, message.side) instanceof ILevelEmitter) {
|
||||
InventoryHandler.openGui(
|
||||
player,
|
||||
tile.getWorldObj(),
|
||||
new BlockPos(tile),
|
||||
message.side,
|
||||
GuiType.LEVEL_EMITTER_PROXY);
|
||||
} else {
|
||||
InventoryHandler.openGui(
|
||||
player,
|
||||
|
||||
@@ -28,6 +28,7 @@ import appeng.container.ContainerOpenContext;
|
||||
import appeng.container.PrimaryGui;
|
||||
import appeng.container.interfaces.IContainerSubGui;
|
||||
import appeng.helpers.ICustomButtonProvider;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
@@ -54,7 +55,7 @@ public class CPacketSwitchGuis implements IMessage {
|
||||
@Override
|
||||
public void fromBytes(ByteBuf byteBuf) {
|
||||
final int ord = byteBuf.readInt();
|
||||
mode = ord != -1 ? UltraTerminalModes.values()[ord] : null;
|
||||
mode = ord != -1 ? UltraTerminalModes.VALUES[ord] : null;
|
||||
switchTerminal = byteBuf.readBoolean();
|
||||
}
|
||||
|
||||
@@ -75,7 +76,7 @@ public class CPacketSwitchGuis implements IMessage {
|
||||
// switch terminal
|
||||
|
||||
if (message.switchTerminal) {
|
||||
ImmutablePair<Integer, ItemStack> temp = Util.getUltraWirelessTerm(player);
|
||||
ImmutablePair<Integer, ItemStack> temp = getTerminalToSwitch(player, cont);
|
||||
if (temp != null && temp.getRight().getItem() instanceof ItemWirelessUltraTerminal iwut) {
|
||||
if (message.mode != null && cont instanceof AEBaseContainer abc) {
|
||||
abc.setSwitchAbleGuiNext(message.mode.ordinal());
|
||||
@@ -118,6 +119,21 @@ public class CPacketSwitchGuis implements IMessage {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static ImmutablePair<Integer, ItemStack> getTerminalToSwitch(EntityPlayerMP player, Container cont) {
|
||||
if (cont instanceof AEBaseContainer aeBaseContainer) {
|
||||
final int slot = aeBaseContainer.getTargetSlotIndex();
|
||||
if (slot == Integer.MIN_VALUE) return null;
|
||||
|
||||
final ItemStack terminal = Platform.getItemFromPlayerInventoryBySlotIndex(player, slot);
|
||||
return terminal != null && terminal.getItem() instanceof ItemWirelessUltraTerminal
|
||||
? new ImmutablePair<>(slot, terminal)
|
||||
: null;
|
||||
}
|
||||
|
||||
// Global terminal hotkeys have no open item GUI from which to obtain an exact slot.
|
||||
return Util.getUltraWirelessTerm(player);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -72,8 +72,9 @@ public class CPacketValueConfig implements IMessage {
|
||||
: NameConst.TT_ULTRA_TERMINAL_RESTOCK_OFF)));
|
||||
} else {
|
||||
IGridNode gridNode = Util.getWirelessGrid(wirelessTerm);
|
||||
if (gridNode != null && Util.isRestock(wirelessTerm)
|
||||
&& Util.rangeCheck(wirelessTerm, player, gridNode)) {
|
||||
boolean inRange = AEApi.instance().registries().wireless().checkRange(wirelessTerm, player);
|
||||
|
||||
if (gridNode != null && Util.isRestock(wirelessTerm) && inRange) {
|
||||
restockItems(wirelessTerm, gridNode, result.getLeft(), player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,13 +18,15 @@ public class SPacketLevelMaintainerGuiUpdate implements IMessage {
|
||||
|
||||
private Info[] infoList;
|
||||
private boolean onlyState;
|
||||
private boolean isLiteMode;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public SPacketLevelMaintainerGuiUpdate() {}
|
||||
|
||||
public SPacketLevelMaintainerGuiUpdate(RequestInfo[] requests, boolean onlyState) {
|
||||
public SPacketLevelMaintainerGuiUpdate(RequestInfo[] requests, boolean onlyState, boolean isLiteMode) {
|
||||
this.infoList = new Info[REQ_COUNT];
|
||||
this.onlyState = onlyState;
|
||||
this.isLiteMode = isLiteMode;
|
||||
|
||||
for (int i = 0; i < REQ_COUNT; i++) {
|
||||
if (requests[i] == null) {
|
||||
@@ -43,6 +45,7 @@ public class SPacketLevelMaintainerGuiUpdate implements IMessage {
|
||||
public void fromBytes(ByteBuf buf) {
|
||||
this.infoList = new Info[REQ_COUNT];
|
||||
this.onlyState = buf.readBoolean();
|
||||
this.isLiteMode = buf.readBoolean();
|
||||
|
||||
for (int i = 0; i < REQ_COUNT; i++) {
|
||||
if (buf.readBoolean()) {
|
||||
@@ -64,6 +67,7 @@ public class SPacketLevelMaintainerGuiUpdate implements IMessage {
|
||||
@Override
|
||||
public void toBytes(ByteBuf buf) {
|
||||
buf.writeBoolean(this.onlyState);
|
||||
buf.writeBoolean(this.isLiteMode);
|
||||
for (Info info : this.infoList) {
|
||||
buf.writeBoolean(info != null);
|
||||
if (info == null) continue;
|
||||
@@ -114,6 +118,8 @@ public class SPacketLevelMaintainerGuiUpdate implements IMessage {
|
||||
gui.updateComponent(i, info.quantity, info.batchSize, info.enable, info.state);
|
||||
}
|
||||
}
|
||||
|
||||
gui.updateComponent(message.isLiteMode);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -11,13 +11,10 @@ import com.glodblock.github.FluidCraft;
|
||||
import com.glodblock.github.loader.KeybindLoader;
|
||||
import com.glodblock.github.loader.ListenerLoader;
|
||||
import com.glodblock.github.loader.RenderLoader;
|
||||
import com.glodblock.github.nei.recipes.DefaultExtractorLoader;
|
||||
import com.glodblock.github.network.CPacketValueConfig;
|
||||
import com.glodblock.github.util.ModAndClassUtil;
|
||||
import com.glodblock.github.util.Util;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLLoadCompleteEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
@@ -46,14 +43,6 @@ public class ClientProxy extends CommonProxy {
|
||||
super.postInit(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadComplete(FMLLoadCompleteEvent event) {
|
||||
super.onLoadComplete(event);
|
||||
if (ModAndClassUtil.NEI) {
|
||||
new DefaultExtractorLoader().run();
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void tickEvent(TickEvent.PlayerTickEvent e) {
|
||||
if (refreshTick + reStockTime < System.currentTimeMillis()) {
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.glodblock.github.proxy;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
|
||||
|
||||
@@ -54,7 +53,6 @@ public class CommonProxy {
|
||||
EntityPlayer player = e.entityPlayer;
|
||||
EntityItem itemEntity = e.item;
|
||||
ItemStack stack = itemEntity.getEntityItem();
|
||||
World world = player.getEntityWorld();
|
||||
|
||||
ImmutablePair<Integer, ItemStack> result = Util.getUltraWirelessTerm(player);
|
||||
if (result != null) {
|
||||
@@ -62,7 +60,9 @@ public class CommonProxy {
|
||||
WirelessMagnet.Mode mode = WirelessMagnet.getMode(wirelessTerm);
|
||||
if (mode == WirelessMagnet.Mode.ME) {
|
||||
IGridNode gridNode = Util.getWirelessGrid(wirelessTerm);
|
||||
if (gridNode != null && Util.rangeCheck(wirelessTerm, player, gridNode)) {
|
||||
boolean inRange = AEApi.instance().registries().wireless().checkRange(wirelessTerm, player);
|
||||
|
||||
if (gridNode != null && inRange) {
|
||||
WirelessMagnetCardFilterInventory inv = FilterCache
|
||||
.getFilter(wirelessTerm, result.getLeft(), gridNode, player);
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.glodblock.github.util;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.util.Constants.NBT;
|
||||
|
||||
import com.glodblock.github.inventory.IDualHost;
|
||||
|
||||
public final class DualHostSettings {
|
||||
|
||||
private static final String FLUID_CONFIG_KEY = "fluidConfig";
|
||||
|
||||
private DualHostSettings() {}
|
||||
|
||||
public static void uploadSettings(IDualHost host, NBTTagCompound compound) {
|
||||
if (compound.hasKey(FLUID_CONFIG_KEY, NBT.TAG_COMPOUND)) {
|
||||
host.getDualityFluid().readConfigFromNBT(compound, FLUID_CONFIG_KEY);
|
||||
host.getConfig();
|
||||
}
|
||||
}
|
||||
|
||||
public static void downloadSettings(IDualHost host, NBTTagCompound output) {
|
||||
host.getDualityFluid().writeConfigToNBT(output, FLUID_CONFIG_KEY);
|
||||
}
|
||||
|
||||
public static void copySettings(IDualHost target, IDualHost source) {
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
downloadSettings(source, data);
|
||||
uploadSettings(target, data);
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import static appeng.util.item.AEItemStackType.ITEM_STACK_TYPE;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -26,12 +25,14 @@ 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.google.common.collect.ImmutableSet;
|
||||
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.implementations.IUpgradeableHost;
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.crafting.ICraftingLink;
|
||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
@@ -46,10 +47,12 @@ import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.data.AEStackTypeRegistry;
|
||||
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.api.util.IConfigManager;
|
||||
import appeng.core.settings.TickRates;
|
||||
import appeng.helpers.IInterfaceHost;
|
||||
import appeng.helpers.MultiCraftingTracker;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
import appeng.me.storage.MEMonitorIFluidHandler;
|
||||
@@ -75,7 +78,7 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
||||
private final IAEFluidStack[] requireWork;
|
||||
private int isWorking = -1;
|
||||
private final Map<IAEStackType<?>, MEMonitorPassThrough<?>> monitorMap;
|
||||
private boolean resetConfigCache = true;
|
||||
private final MultiCraftingTracker craftingTracker;
|
||||
|
||||
public DualityFluidInterface(final AENetworkProxy networkProxy, final IInterfaceHost ih) {
|
||||
this.gridProxy = networkProxy;
|
||||
@@ -95,6 +98,8 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
this.requireWork[i] = null;
|
||||
}
|
||||
|
||||
this.craftingTracker = new MultiCraftingTracker(this.iHost, NUMBER_OF_TANKS);
|
||||
}
|
||||
|
||||
public IAEFluidStack getStandardFluid(IAEFluidStack fluid) {
|
||||
@@ -148,6 +153,28 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
||||
this.readConfig();
|
||||
}
|
||||
|
||||
public void writeCraftingTrackerToNBT(NBTTagCompound data) {
|
||||
final NBTTagCompound tracker = new NBTTagCompound();
|
||||
this.craftingTracker.writeToNBT(tracker);
|
||||
data.setTag("fluidCraftingLinks", tracker);
|
||||
}
|
||||
|
||||
public void readCraftingTrackerFromNBT(NBTTagCompound data) {
|
||||
if (data.hasKey("fluidCraftingLinks")) {
|
||||
this.craftingTracker.readFromNBT(data.getCompoundTag("fluidCraftingLinks"));
|
||||
}
|
||||
}
|
||||
|
||||
public void writeConfigToNBT(NBTTagCompound data, String name) {
|
||||
this.config.writeToNBT(data, name);
|
||||
}
|
||||
|
||||
public void readConfigFromNBT(NBTTagCompound data, String name) {
|
||||
this.config.readFromNBT(data, name);
|
||||
this.readConfig();
|
||||
this.saveChanges();
|
||||
}
|
||||
|
||||
public AEFluidInventory getConfig() {
|
||||
return this.config;
|
||||
}
|
||||
@@ -164,6 +191,8 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
||||
}
|
||||
|
||||
private IMEMonitor<IAEFluidStack> getFluidGrid() {
|
||||
if (!this.gridProxy.isActive()) return null;
|
||||
|
||||
try {
|
||||
return gridProxy.getGrid().<IStorageGrid>getCache(IStorageGrid.class).getFluidInventory();
|
||||
} catch (GridAccessException e) {
|
||||
@@ -173,7 +202,7 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
||||
|
||||
@Override
|
||||
public int getInstalledUpgrades(Upgrades u) {
|
||||
return 0;
|
||||
return this.iHost.getInstalledUpgrades(u);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -223,10 +252,7 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
||||
@SuppressWarnings("unchecked")
|
||||
public IMEMonitor<IAEFluidStack> getFluidInventory() {
|
||||
if (this.hasConfig) {
|
||||
if (this.resetConfigCache) {
|
||||
this.resetConfigCache = false;
|
||||
return new InterfaceInventory(this);
|
||||
}
|
||||
return new InterfaceInventory(this);
|
||||
}
|
||||
return (IMEMonitor<IAEFluidStack>) this.monitorMap.get(FLUID_STACK_TYPE);
|
||||
}
|
||||
@@ -264,7 +290,6 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
||||
had = this.hasConfig;
|
||||
this.readConfig();
|
||||
if (had != this.hasConfig) {
|
||||
this.resetConfigCache = true;
|
||||
this.notifyNeighbors();
|
||||
}
|
||||
} else if (inventory == this.tanks) {
|
||||
@@ -321,9 +346,11 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
||||
}
|
||||
IAEFluidStack toStore;
|
||||
if (work.getStackSize() > 0L) {
|
||||
if ((long) this.tanks.fill(slot, work.getFluidStack(), false) != work.getStackSize()) {
|
||||
if (this.craftingTracker.isBusy(slot)) {
|
||||
changed = this.handleCrafting(slot, work);
|
||||
} else if ((long) this.tanks.fill(slot, work.getFluidStack(), false) != work.getStackSize()) {
|
||||
changed = true;
|
||||
} else if (Objects.requireNonNull(getFluidGrid()).getStorageList().findPrecise(work) != null) {
|
||||
} else {
|
||||
toStore = dest.extractItems(work, Actionable.MODULATE, this.mySource);
|
||||
if (toStore != null) {
|
||||
changed = true;
|
||||
@@ -331,6 +358,8 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
||||
if ((long) filled != toStore.getStackSize()) {
|
||||
throw new IllegalStateException("bad attempt at managing tanks. ( fill )");
|
||||
}
|
||||
} else {
|
||||
changed = this.handleCrafting(slot, work);
|
||||
}
|
||||
}
|
||||
} else if (work.getStackSize() < 0L) {
|
||||
@@ -360,6 +389,57 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
|
||||
return changed;
|
||||
}
|
||||
|
||||
private boolean handleCrafting(final int slot, final IAEFluidStack fluidStack) {
|
||||
try {
|
||||
if (this.getInstalledUpgrades(Upgrades.CRAFTING) > 0 && fluidStack != null) {
|
||||
return this.craftingTracker.handleCrafting(
|
||||
slot,
|
||||
fluidStack.getStackSize(),
|
||||
(IAEStack<?>) fluidStack,
|
||||
this.iHost.getTileEntity().getWorldObj(),
|
||||
this.gridProxy.getGrid(),
|
||||
this.gridProxy.getCrafting(),
|
||||
this.mySource);
|
||||
}
|
||||
} catch (final GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ImmutableSet<ICraftingLink> getRequestedJobs() {
|
||||
return this.craftingTracker.getRequestedJobs();
|
||||
}
|
||||
|
||||
public IAEStack<?> injectCraftedItems(final ICraftingLink link, final IAEStack<?> acquired, final Actionable mode) {
|
||||
final int slot = this.craftingTracker.getSlot(link);
|
||||
|
||||
if (acquired instanceof IAEFluidStack afs && slot >= 0 && slot < NUMBER_OF_TANKS) {
|
||||
if (mode == Actionable.SIMULATE) {
|
||||
final int filled = this.tanks.fill(slot, afs.getFluidStack(), false);
|
||||
return filled >= afs.getFluidStack().amount ? null
|
||||
: AEFluidStack.create(drainRemainder(afs.getFluidStack(), filled));
|
||||
} else {
|
||||
final int filled = this.tanks.fill(slot, afs.getFluidStack(), true);
|
||||
this.updatePlan(slot);
|
||||
return filled >= afs.getFluidStack().amount ? null
|
||||
: AEFluidStack.create(drainRemainder(afs.getFluidStack(), filled));
|
||||
}
|
||||
}
|
||||
|
||||
return acquired;
|
||||
}
|
||||
|
||||
private static FluidStack drainRemainder(final FluidStack original, final int accepted) {
|
||||
final FluidStack remainder = original.copy();
|
||||
remainder.amount -= accepted;
|
||||
return remainder;
|
||||
}
|
||||
|
||||
public void jobStateChange(final ICraftingLink link) {
|
||||
this.craftingTracker.jobStateChange(link);
|
||||
}
|
||||
|
||||
private void updatePlan(int slot) {
|
||||
IAEFluidStack req = this.config.getFluidInSlot(slot);
|
||||
IAEFluidStack stored = this.tanks.getFluidInSlot(slot);
|
||||
|
||||
@@ -1,46 +1,20 @@
|
||||
package com.glodblock.github.util;
|
||||
|
||||
import net.minecraft.util.StatCollector;
|
||||
import com.gtnewhorizon.gtnhlib.color.ColorResource;
|
||||
|
||||
import appeng.core.AELog;
|
||||
public class FCGuiColors {
|
||||
|
||||
public enum FCGuiColors {
|
||||
private static final ColorResource.Factory color = new ColorResource.Factory("ae2fc");
|
||||
|
||||
// ARGB Colors: Name and default value
|
||||
StateNone(0x00000000),
|
||||
StateIdle(0xFF55FF55),
|
||||
StateCraft(0xFFFFFF55),
|
||||
StateExport(0xFFAA00AA),
|
||||
StateError(0xFFFF5555);
|
||||
public static final ColorResource
|
||||
// spotless:off
|
||||
guiTextColorGray = color.rgb("guiTextColorGray", "0x404040"),
|
||||
|
||||
private final String root;
|
||||
private final int color;
|
||||
|
||||
FCGuiColors() {
|
||||
this.root = "ae2fc.gui.color";
|
||||
this.color = 0x000000;
|
||||
}
|
||||
|
||||
FCGuiColors(final int hex) {
|
||||
this.root = "ae2fc.gui.color";
|
||||
this.color = hex;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
String hex = StatCollector.translateToLocal(this.getUnlocalized());
|
||||
int color = this.color;
|
||||
|
||||
if (hex.length() <= 8) {
|
||||
try {
|
||||
color = Integer.parseUnsignedInt(hex, 16);
|
||||
} catch (final NumberFormatException e) {
|
||||
AELog.warn("Couldn't format color correctly for: " + this.root + " -> " + hex);
|
||||
}
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
public String getUnlocalized() {
|
||||
return this.root + '.' + this.toString();
|
||||
}
|
||||
stateNone = color.argb("stateNone", "0x00000000"),
|
||||
stateIdle = color.argb("stateIdle", "0xFF55FF55"),
|
||||
stateCraft = color.argb("stateCraft", "0xFFFFFF55"),
|
||||
stateExport = color.argb("stateExport", "0xFFAA00AA"),
|
||||
stateError = color.argb("stateError", "0xFFFF5555"),
|
||||
itemSlotOverlayUnpowered = color.argb("itemSlotOverlayUnpowered", "0x66111111");
|
||||
// spotless:on
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.glodblock.github.util;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import com.glodblock.github.client.textures.FCPartsTexture;
|
||||
import com.glodblock.github.common.item.FCBaseItemCell;
|
||||
|
||||
import appeng.api.implementations.items.IStorageCell;
|
||||
import appeng.api.implementations.tiles.IChestOrDrive;
|
||||
import appeng.api.storage.ICellHandler;
|
||||
import appeng.api.storage.ICellInventoryHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IMEInventoryHandler;
|
||||
import appeng.api.storage.ISaveProvider;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.me.storage.CellInventory;
|
||||
import appeng.me.storage.FluidCellInventoryHandler;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class FluidCellHandler implements ICellHandler {
|
||||
|
||||
@Override
|
||||
public boolean isCell(final ItemStack is) {
|
||||
/*
|
||||
* FCBaseItemCell covers Basic, Multi, and Extreme fluid storage
|
||||
*/
|
||||
return is != null && is.getItem() instanceof FCBaseItemCell;
|
||||
}
|
||||
|
||||
/**
|
||||
* ME Chest icon
|
||||
*/
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getTopTexture_Dark() {
|
||||
return FCPartsTexture.BlockMEChestFluid_Dark.getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getTopTexture_Light() {
|
||||
return FCPartsTexture.BlockMEChestFluid_Bright.getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getTopTexture_Medium() {
|
||||
return FCPartsTexture.BlockMEChestFluid_Medium.getIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChestGui(final EntityPlayer player, final IChestOrDrive chest, final ICellHandler cellHandler,
|
||||
@SuppressWarnings("rawtypes") final IMEInventoryHandler inv, final ItemStack itemStack,
|
||||
final StorageChannel channel) {
|
||||
Platform.openGUI(player, (TileEntity) chest, chest.getUp(), GuiBridge.GUI_ME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusForCell(ItemStack is, IMEInventory handler) {
|
||||
if (handler instanceof FluidCellInventoryHandler ci) {
|
||||
return ci.getStatusForCell();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double cellIdleDrain(final ItemStack is, @SuppressWarnings("rawtypes") final IMEInventory handler) {
|
||||
return ((ICellInventoryHandler) handler).getCellInv().getIdleDrain();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventoryHandler getCellInventory(ItemStack fluidCell, ISaveProvider saveProvider, IAEStackType<?> type) {
|
||||
if (fluidCell != null && fluidCell.getItem() instanceof IStorageCell cell && cell.getStackType() == type) {
|
||||
return CellInventory.getCell(fluidCell, saveProvider, type);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ import java.util.WeakHashMap;
|
||||
|
||||
import com.glodblock.github.api.registries.ILevelTerminalRegistry;
|
||||
import com.glodblock.github.api.registries.ILevelViewableAdapter;
|
||||
import com.glodblock.github.common.parts.PartFluidLevelEmitter;
|
||||
import com.glodblock.github.common.tile.TileLevelMaintainer;
|
||||
|
||||
import appeng.api.features.ILevelViewable;
|
||||
@@ -28,7 +27,6 @@ public class LevelTerminalRegistry implements ILevelTerminalRegistry {
|
||||
{
|
||||
this.register(TileLevelMaintainer.class);
|
||||
this.register(PartLevelEmitter.class);
|
||||
this.register(PartFluidLevelEmitter.class);
|
||||
}
|
||||
|
||||
public Set<Class<? extends ILevelViewable>> getSupportedClasses() {
|
||||
|
||||
@@ -23,18 +23,12 @@ public class NameConst {
|
||||
public static final String BLOCK_SUPER_STOCK_REPLENISHER = "super_stock_replenisher";
|
||||
public static final String ITEM_FLUID_DROP = "fluid_drop";
|
||||
public static final String ITEM_FLUID_ENCODED_PATTERN = "fluid_encoded_pattern";
|
||||
public static final String ITEM_PART_FLUID_STORAGE_MONITOR = "part_fluid_storage_monitor";
|
||||
public static final String ITEM_PART_FLUID_CONVERSION_MONITOR = "part_fluid_conversion_monitor";
|
||||
public static final String ITEM_PART_FLUID_TERMINAL = "part_fluid_terminal";
|
||||
public static final String ITEM_PART_LEVEL_TERMINAL = "part_level_terminal";
|
||||
public static final String ITEM_PART_FLUID_PATTERN_TERMINAL = "part_fluid_pattern_terminal";
|
||||
public static final String ITEM_PART_FLUID_PATTERN_TERMINAL_EX = "part_fluid_pattern_terminal_ex";
|
||||
public static final String ITEM_PART_FLUID_INTERFACE = "part_fluid_interface";
|
||||
public static final String ITEM_PART_FLUID_P2P_INTERFACE = "part_fluid_p2p_interface";
|
||||
public static final String ITEM_PART_FLUID_IMPORT = "part_fluid_import";
|
||||
public static final String ITEM_PART_FLUID_EXPORT = "part_fluid_export";
|
||||
public static final String ITEM_PART_FLUID_STORAGE_BUS = "part_fluid_storage_bus";
|
||||
public static final String ITEM_PART_FLUID_LEVEL_EMITTER = "part_fluid_level_emitter";
|
||||
public static final String ITEM_FLUID_PACKET = "fluid_packet";
|
||||
public static final String ITEM_FLUID_STORAGE = "fluid_storage";
|
||||
public static final String ITEM_MULTI_FLUID_STORAGE = "multi_fluid_storage";
|
||||
@@ -46,7 +40,6 @@ public class NameConst {
|
||||
public static final String ITEM_INFINITY_WATER_FLUID_STORAGE = ITEM_INFINITY_FLUID_STORAGE + ".water";
|
||||
public static final String ITEM_CREATIVE_FLUID_STORAGE = "creative_" + ITEM_FLUID_STORAGE;
|
||||
public static final String ITEM_FLUID_PORTABLE_CELL = "portable_fluid_cell";
|
||||
public static final String ITEM_WIRELESS_FLUID_TERMINAL = "wireless_fluid_terminal";
|
||||
public static final String ITEM_WIRELESS_INTERFACE_TERMINAL = "wireless_interface_terminal";
|
||||
public static final String ITEM_WIRELESS_LEVEL_TERMINAL = "wireless_level_terminal";
|
||||
public static final String ITEM_WIRELESS_ULTRA_TERMINAL = "wireless_ultra_terminal";
|
||||
@@ -55,11 +48,13 @@ public class NameConst {
|
||||
public static final String ITEM_FLUID_STORAGE_HOUSING = "fluid_storage_housing";
|
||||
public static final String ITEM_QUANTUM_BRIDGE_CARD = "quantum_bridge_card";
|
||||
public static final String ITEM_ENERGY_CARD = "energy_card";
|
||||
public static final String ITEM_PART_FLUID_FORMATION_PLANE = "part_fluid_formation_plane";
|
||||
public static final String ITEM_PART_FLUID_ANNIHILATION_PLANE = "part_fluid_annihilation_plane";
|
||||
|
||||
public static final String TT_KEY = FluidCraft.MODID + ".tooltip.";
|
||||
public static final String TT_FLUID_TERMINAL = TT_KEY + "fluid_terminal";
|
||||
public static final String TT_LEVEL_TERMINAL = TT_KEY + "level_terminal";
|
||||
public static final String TT_INVALID_FLUID = TT_KEY + "invalid_fluid";
|
||||
public static final String TT_FLUID_PACKET_TIPS = TT_KEY + "item_fluid_packet";
|
||||
public static final String TT_FLUID_PACKET = TT_KEY + "fluid_packet";
|
||||
public static final String TT_ENCODE_PATTERN = TT_KEY + "encode_pattern";
|
||||
public static final String TT_EMPTY = TT_KEY + "empty";
|
||||
@@ -92,6 +87,7 @@ public class NameConst {
|
||||
public static final String TT_LEVEL_MAINTAINER_NOT_FOUND_DESC = TT_LEVEL_MAINTAINER + "not_found_desc";
|
||||
public static final String TT_LEVEL_MAINTAINER_CANT_CRAFT = TT_LEVEL_MAINTAINER + "cant_craft";
|
||||
public static final String TT_LEVEL_MAINTAINER_CANT_CRAFT_DESC = TT_LEVEL_MAINTAINER + "cant_craft_desc";
|
||||
public static final String TT_LEVEL_MAINTAINER_LITE_CRAFT_DESC = TT_LEVEL_MAINTAINER + "lite_craft_desc";
|
||||
public static final String TT_CELL_PORTABLE = TT_KEY + "cell_portable";
|
||||
public static final String TT_WIRELESS = TT_KEY + "wireless.";
|
||||
public static final String TT_WIRELESS_INSTALLED = TT_WIRELESS + "installed";
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.glodblock.github.util;
|
||||
|
||||
public enum UltraTerminalModes {
|
||||
|
||||
CRAFTING,
|
||||
PATTERN,
|
||||
PATTERN_EX,
|
||||
INTERFACE,
|
||||
LEVEL
|
||||
LEVEL;
|
||||
|
||||
public static final UltraTerminalModes[] VALUES = values();
|
||||
}
|
||||
@@ -38,7 +38,6 @@ import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.implementations.tiles.IWirelessAccessPoint;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
@@ -50,12 +49,9 @@ import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.items.tools.powered.ToolWirelessTerminal;
|
||||
import appeng.me.storage.NullInventory;
|
||||
import appeng.tile.networking.TileCableBus;
|
||||
import appeng.tile.networking.TileWireless;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.AEFluidStack;
|
||||
import appeng.util.item.AEItemStack;
|
||||
@@ -105,32 +101,6 @@ public final class Util {
|
||||
return ticks;
|
||||
}
|
||||
|
||||
public static boolean rangeCheck(ItemStack is, EntityPlayer player, IGridNode grid) {
|
||||
if (grid.getGrid() == null) return false;
|
||||
return rangeCheck(is, player, grid.getGrid());
|
||||
}
|
||||
|
||||
public static boolean rangeCheck(ItemStack is, EntityPlayer player, IGrid grid) {
|
||||
boolean canConnect = false;
|
||||
if (hasInfinityBoosterCard(is)) {
|
||||
canConnect = true;
|
||||
} else {
|
||||
for (IGridNode node : grid.getMachines(TileWireless.class)) {
|
||||
IWirelessAccessPoint accessPoint = (IWirelessAccessPoint) node.getMachine();
|
||||
if (accessPoint.isActive() && accessPoint.getLocation().getDimension() == player.dimension) {
|
||||
WorldCoord distance = accessPoint.getLocation()
|
||||
.subtract((int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
int squaredDistance = distance.x * distance.x + distance.y * distance.y + distance.z * distance.z;
|
||||
if (squaredDistance <= accessPoint.getRange() * accessPoint.getRange()) {
|
||||
canConnect = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return canConnect;
|
||||
}
|
||||
|
||||
public static boolean isRestock(ItemStack is) {
|
||||
if (is.getItem() instanceof ItemBaseWirelessTerminal) {
|
||||
NBTTagCompound data = Platform.openNbtData(is);
|
||||
@@ -155,8 +125,8 @@ public final class Util {
|
||||
}
|
||||
|
||||
public static IGridNode getWirelessGrid(ItemStack is) {
|
||||
if (is.getItem() instanceof ToolWirelessTerminal) {
|
||||
String key = ((ToolWirelessTerminal) is.getItem()).getEncryptionKey(is);
|
||||
if (is.getItem() instanceof ToolWirelessTerminal wirelessTerminal) {
|
||||
String key = wirelessTerminal.getEncryptionKey(is);
|
||||
IGridHost securityTerminal = (IGridHost) AEApi.instance().registries().locatable()
|
||||
.getLocatableBy(Long.parseLong(key));
|
||||
if (securityTerminal == null) return null;
|
||||
@@ -166,34 +136,36 @@ public final class Util {
|
||||
}
|
||||
|
||||
public static IMEInventoryHandler<?> getWirelessInv(ItemStack is, EntityPlayer player, StorageChannel channel) {
|
||||
if (Platform.isServer()) {
|
||||
IGridNode gridNode = getWirelessGrid(is);
|
||||
if (gridNode != null) {
|
||||
IGrid grid = gridNode.getGrid();
|
||||
if (grid != null) {
|
||||
if (rangeCheck(is, player, grid)) {
|
||||
IStorageGrid gridCache = grid.getCache(IStorageGrid.class);
|
||||
if (gridCache != null) {
|
||||
if (channel == StorageChannel.FLUIDS) {
|
||||
return gridCache.getFluidInventory();
|
||||
} else {
|
||||
return gridCache.getItemInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Platform.isClient()) return new NullInventory<>();
|
||||
|
||||
IGridNode gridNode = getWirelessGrid(is);
|
||||
if (gridNode == null) return null;
|
||||
|
||||
IGrid grid = gridNode.getGrid();
|
||||
if (grid == null) return null;
|
||||
|
||||
boolean inRange = AEApi.instance().registries().wireless().checkRange(is, player);
|
||||
if (inRange) {
|
||||
IStorageGrid gridCache = grid.getCache(IStorageGrid.class);
|
||||
if (gridCache != null) {
|
||||
if (channel == StorageChannel.FLUIDS) {
|
||||
return gridCache.getFluidInventory();
|
||||
} else {
|
||||
return gridCache.getItemInventory();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return new NullInventory<>();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ImmutablePair<Integer, ItemStack> getUltraWirelessTerm(EntityPlayer player) {
|
||||
int invSize = player.inventory.getSizeInventory();
|
||||
final ImmutablePair<Integer, ItemStack> baublesTerminal = getBaublesUltraWirelessTerm(player);
|
||||
return baublesTerminal != null ? baublesTerminal : getInventoryUltraWirelessTerm(player);
|
||||
}
|
||||
|
||||
if (invSize <= 0) {
|
||||
return null;
|
||||
}
|
||||
private static ImmutablePair<Integer, ItemStack> getInventoryUltraWirelessTerm(EntityPlayer player) {
|
||||
final int invSize = player.inventory.getSizeInventory();
|
||||
for (int i = 0; i < invSize; ++i) {
|
||||
ItemStack is = player.inventory.getStackInSlot(i);
|
||||
if (is != null && is.getItem() instanceof ItemWirelessUltraTerminal) {
|
||||
@@ -201,10 +173,14 @@ public final class Util {
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static ImmutablePair<Integer, ItemStack> getBaublesUltraWirelessTerm(EntityPlayer player) {
|
||||
if (ModAndClassUtil.BAUBLES) {
|
||||
IInventory handler = BaublesApi.getBaubles(player);
|
||||
final IInventory handler = BaublesApi.getBaubles(player);
|
||||
if (handler != null) {
|
||||
invSize = handler.getSizeInventory();
|
||||
final int invSize = handler.getSizeInventory();
|
||||
for (int i = 0; i < invSize; ++i) {
|
||||
ItemStack is = handler.getStackInSlot(i);
|
||||
if (is != null && is.getItem() instanceof ItemWirelessUltraTerminal) {
|
||||
@@ -373,13 +349,6 @@ public final class Util {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static IPart getPart(Object te, ForgeDirection face) {
|
||||
if (te instanceof TileCableBus) {
|
||||
return ((TileCableBus) te).getPart(face);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void writeFluidMapToBuf(Map<Integer, IAEFluidStack> list, ByteBuf buf) throws IOException {
|
||||
buf.writeInt(list.size());
|
||||
for (Map.Entry<Integer, IAEFluidStack> fs : list.entrySet()) {
|
||||
|
||||
@@ -1,19 +1,12 @@
|
||||
item.fluid_drop.name=Tropfen %s
|
||||
item.fluid_encoded_pattern.name=Kodierte ME-Flüssigkeitsschablone
|
||||
item.part_fluid_terminal.name=ME-Flüssigkeitskonsole
|
||||
item.part_fluid_pattern_terminal.name=ME-Flüssigkeitsschablonenkonsole
|
||||
item.part_fluid_pattern_terminal_ex.name=ME-Flüssigkeitsverarbeitungsschablonenkonsole
|
||||
item.part_fluid_interface.name=ME-Dualschnittstelle
|
||||
item.part_fluid_p2p_interface.name=P2P-Tunnel - ME-Dualschnittstelle
|
||||
item.part_fluid_import.name=ME-Flüssigkeits-Importbus
|
||||
item.part_fluid_export.name=ME-Flüssigkeits-Exportbus
|
||||
item.part_fluid_storage_bus.name=ME-Flüssigkeitsspeicherbus
|
||||
item.part_fluid_level_emitter.name=ME-Flüssigkeitsfüllstandsemitter
|
||||
item.part_fluid_storage_monitor.name=ME-Flüssigkeitsspeicherkonsole
|
||||
item.part_fluid_conversion_monitor.name=ME-Flüssigkeitsumwandlungskonsole
|
||||
item.part_level_terminal.name=ME-Füllstandkonsole
|
||||
item.portable_fluid_cell.name=Tragbare Flüssigkeitszelle
|
||||
item.wireless_fluid_terminal.name=Flüssigkeits-Handkonsole
|
||||
item.wireless_level_terminal.name=Füllstands-Handkonsole
|
||||
item.wireless_fluid_pattern_terminal.name=Flüssigkeitsschablonen-Handkonsole
|
||||
item.wireless_interface_terminal.name=Schnittstellen-Handkonsole
|
||||
@@ -197,12 +190,6 @@ ae2fc.gui.magnet.ore=Ore Dictionary benutzen
|
||||
ae2fc.gui.magnet.whitelist=Whitelist
|
||||
ae2fc.gui.magnet.blacklist=Blacklist
|
||||
|
||||
ae2fc.gui.color.StateNone=00000000
|
||||
ae2fc.gui.color.StateIdle=FF55FF55
|
||||
ae2fc.gui.color.StateCraft=FFFFFF55
|
||||
ae2fc.gui.color.StateExport=FFAA00AA
|
||||
ae2fc.gui.color.StateError=FFFF5555
|
||||
|
||||
error.unknown=Unbekannt
|
||||
|
||||
ae2fc.key.OpenTerminal=Handkonsole öffnen
|
||||
@@ -213,17 +200,4 @@ ae2fc.key.OpenPatternTerminal=Open Wireless Universal Pattern Terminal
|
||||
ae2fc.key.OpenPatternExTerminal=Open Wireless Universal Processing Pattern Terminal
|
||||
ae2fc.key.Restock=Wiederauffüllen
|
||||
|
||||
itemGroup.ae2fc=Flüssigkeitsfertigung für AE2
|
||||
|
||||
item.ec2placeholder.oc.upgrade.name=[EC2 PLACEHOLDER] ME-Upgrade
|
||||
item.ec2placeholder.part.base.name=[EC2 PLACEHOLDER] ME-Flüssigkeitsbus
|
||||
item.ec2placeholder.pattern.fluid.name=[EC2 PLACEHOLDER] ME-Flüssigkeitsschablone
|
||||
item.ec2placeholder.storage.casing.name=[EC2 PLACEHOLDER] Speichergehäuse
|
||||
item.ec2placeholder.storage.component.name=[EC2 PLACEHOLDER] ME-Speicherkomponente
|
||||
item.ec2placeholder.storage.fluid.name=[EC2 PLACEHOLDER] ME-Flüssigkeitsspeicher
|
||||
item.ec2placeholder.storage.physical.advanced.quantum.name=[EC2 PLACEHOLDER] ME-Quantenspeicher
|
||||
item.ec2placeholder.storage.physical.advanced.singularity.name=[EC2 PLACEHOLDER] ME-Digitale Singularität
|
||||
item.ec2placeholder.storage.physical.name=[EC2 PLACEHOLDER] ME-Speicher
|
||||
item.ec2placeholder.storage.physical.void.name=[EC2 PLACEHOLDER] Void-ME-Speicher
|
||||
item.ec2placeholder.terminal.fluid.wireless.name=[EC2 PLACEHOLDER] Flüssigkeits-Handkonsole
|
||||
item.ec2placeholder.terminal.universal.wireless.name=[EC2 PLACEHOLDER] Universelle Handkonsole
|
||||
itemGroup.ae2fc=Flüssigkeitsfertigung für AE2
|
||||
@@ -1,19 +1,12 @@
|
||||
item.fluid_drop.name=drop of %s
|
||||
item.fluid_encoded_pattern.name=Encoded Pattern
|
||||
item.part_fluid_terminal.name=ME Fluid Terminal
|
||||
item.part_fluid_pattern_terminal.name=ME Fluid Pattern Terminal
|
||||
item.part_fluid_pattern_terminal_ex.name=ME Fluid Processing Pattern Terminal
|
||||
item.part_fluid_interface.name=ME Dual Interface
|
||||
item.part_fluid_p2p_interface.name=P2P Tunnel - ME Dual Interface
|
||||
item.part_fluid_import.name=ME Fluid Import Bus
|
||||
item.part_fluid_export.name=ME Fluid Export Bus
|
||||
item.part_fluid_storage_bus.name=ME Fluid Storage Bus
|
||||
item.part_fluid_level_emitter.name=ME Fluid Level Emitter
|
||||
item.part_fluid_storage_monitor.name=ME Fluid Storage Monitor
|
||||
item.part_fluid_conversion_monitor.name=ME Fluid Conversion Monitor
|
||||
item.part_level_terminal.name=ME Level Terminal
|
||||
item.portable_fluid_cell.name=Portable Fluid Cell
|
||||
item.wireless_fluid_terminal.name=Wireless Fluid Terminal
|
||||
item.wireless_level_terminal.name=Wireless Level Terminal
|
||||
item.wireless_fluid_pattern_terminal.name=Wireless Pattern Terminal
|
||||
item.wireless_interface_terminal.name=Wireless Interface Terminal
|
||||
@@ -26,6 +19,9 @@ item.wireless_ultra_terminal.INTERFACE.name=Universal Wireless Terminal - Interf
|
||||
item.fluid_packet.name=Fluid Packet
|
||||
item.quantum_bridge_card.name=Quantum Bridge Card
|
||||
item.energy_card.name=Energy Card
|
||||
item.part_fluid_formation_plane.name=Fluid Formation Plane
|
||||
item.part_fluid_annihilation_plane.name=Fluid Annihilation Plane
|
||||
|
||||
item.creative_fluid_storage.name=Creative ME Fluid Storage Cell
|
||||
item.fluid_storage.1.name=%s1k%s ME Fluid Storage Cell
|
||||
item.fluid_storage.4.name=%s4k%s ME Fluid Storage Cell
|
||||
@@ -82,7 +78,7 @@ ae2fc.waila.disable=Disable
|
||||
|
||||
ae2fc.tooltip.shift_for_more=§r> Hold §3Shift§r for more information
|
||||
ae2fc.tooltip.ctrl_for_more=§r> Hold §3Ctrl§r for more information
|
||||
ae2fc.tooltip.fluid_packet_decoder.desc=The Fluid Decoder can decode Fluid packets. It has to be connected to a ME System and a place to store the liquid in, otherwise it won't work.
|
||||
ae2fc.tooltip.fluid_packet_decoder.desc=The Fluid Decoder can decode Fluid packets/drops. It has to be connected to a ME System and a place to store the liquid in, otherwise it won't work.
|
||||
ae2fc.tooltip.fluid_buffer.desc=This is a high speed fluid IO
|
||||
ae2fc.tooltip.walrus.desc=GTNH is like a job
|
||||
ae2fc.tooltip.fluid_auto_filler=Creates a fluid canning pattern with the given container automatically.
|
||||
@@ -103,6 +99,7 @@ ae2fc.tooltip.level_maintainer.not_found=§4Not Found§r
|
||||
ae2fc.tooltip.level_maintainer.not_found_desc=The Requester is trying to schedule a crafting job but can't find a crafting pattern.
|
||||
ae2fc.tooltip.level_maintainer.cant_craft=§4Can't Craft§r
|
||||
ae2fc.tooltip.level_maintainer.cant_craft_desc=The Requester is trying to schedule a crafting job but the crafting manager cannot process the job. (not enough ingredients, CPU doesn't have enough memory, recursion).
|
||||
ae2fc.tooltip.level_maintainer.lite_craft_desc=Toggle lite crafting mode. Shift-click to clear override and restore network defaults.
|
||||
ae2fc.tooltip.level_maintainer.batch_size=§6Crafting Batch Size§r
|
||||
ae2fc.tooltip.level_maintainer.batch_size.hint=When craft requests are emitted, the Requester will use the batch size for the request. Using larger batches will increase the speed of stocking up items but will require more crafting storage.
|
||||
ae2fc.tooltip.level_maintainer.request_size=§6Amount to Maintain§r
|
||||
@@ -128,8 +125,9 @@ ae2fc.tooltip.cell_portable=Right click to open its GUI. It works like a backpac
|
||||
ae2fc.tooltip.fluid_terminal=uh So we don't need EC2 anymore?
|
||||
ae2fc.tooltip.level_terminal=uh...
|
||||
ae2fc.tooltip.invalid_fluid=Invalid fluid!
|
||||
ae2fc.tooltip.item_fluid_packet=§cIf you didn't expect this, then you are using an §6Interface§c instead of a §6Dual Interface
|
||||
ae2fc.tooltip.encode_pattern=Encode Pattern
|
||||
ae2fc.tooltip.fluid_packet=Use a Fluid Packet Decoder to\nconvert this back into fluid.
|
||||
ae2fc.tooltip.fluid_packet=Use a Fluid Packet/Drops Decoder to\nconvert this back into fluid.
|
||||
ae2fc.tooltip.empty=Empty
|
||||
ae2fc.tooltip.dump_tank=Dump Tank Contents
|
||||
ae2fc.tooltip.switch_fluid_interface=Switch ME Dual Interface GUI
|
||||
@@ -177,6 +175,10 @@ ae2fc.tooltip.restock.on=Toggle Restock
|
||||
ae2fc.tooltip.restock.on.hint=Enable
|
||||
ae2fc.tooltip.restock.off=Toggle Restock
|
||||
ae2fc.tooltip.restock.off.hint=Disable
|
||||
ae2fc.tooltip.Full-stock.mode=Full-stock Mode
|
||||
ae2fc.tooltip.Full-stock.mode.hint=Stocked items and fluids always visible to storage busses and only after all are fully stocked following the replenisher being fully emptied, and always fully restocked
|
||||
ae2fc.tooltip.Normal.mode=Normal Mode
|
||||
ae2fc.tooltip.Normal.mode.hint=Stocked items and fluids always visible to storage busses, and only restocked when below 50%
|
||||
|
||||
ae2fc.gui.part_level_terminal=Level Terminal
|
||||
ae2fc.gui.fluid_pattern_encoder=Fluid Pattern Encoder
|
||||
@@ -202,12 +204,6 @@ ae2fc.gui.magnet.ore=Use Ore Dictionary
|
||||
ae2fc.gui.magnet.whitelist=Whitelisting
|
||||
ae2fc.gui.magnet.blacklist=Blacklisting
|
||||
|
||||
ae2fc.gui.color.StateNone=00000000
|
||||
ae2fc.gui.color.StateIdle=FF55FF55
|
||||
ae2fc.gui.color.StateCraft=FFFFFF55
|
||||
ae2fc.gui.color.StateExport=FFAA00AA
|
||||
ae2fc.gui.color.StateError=FFFF5555
|
||||
|
||||
error.unknown=Unknown
|
||||
|
||||
ae2fc.key.OpenTerminal=Open Wireless Universal Terminal
|
||||
@@ -219,16 +215,3 @@ ae2fc.key.OpenPatternExTerminal=Open Wireless Universal Processing Pattern Termi
|
||||
ae2fc.key.Restock=Toggle Restock
|
||||
|
||||
itemGroup.ae2fc=Fluid Craft For AE2
|
||||
|
||||
item.ec2placeholder.oc.upgrade.name=[EC2 PLACEHOLDER] ME Upgrade
|
||||
item.ec2placeholder.part.base.name=[EC2 PLACEHOLDER] ME Fluid Bus
|
||||
item.ec2placeholder.pattern.fluid.name=[EC2 PLACEHOLDER] ME Fluid Pattern
|
||||
item.ec2placeholder.storage.casing.name=[EC2 PLACEHOLDER] Storage Housing
|
||||
item.ec2placeholder.storage.component.name=[EC2 PLACEHOLDER] ME Storage Component
|
||||
item.ec2placeholder.storage.fluid.name=[EC2 PLACEHOLDER] ME Fluid Storage
|
||||
item.ec2placeholder.storage.physical.advanced.quantum.name=[EC2 PLACEHOLDER] ME Quantum Storage
|
||||
item.ec2placeholder.storage.physical.advanced.singularity.name=[EC2 PLACEHOLDER] ME Digital Singularity
|
||||
item.ec2placeholder.storage.physical.name=[EC2 PLACEHOLDER] ME Storage
|
||||
item.ec2placeholder.storage.physical.void.name=[EC2 PLACEHOLDER] ME Void Storage
|
||||
item.ec2placeholder.terminal.fluid.wireless.name=[EC2 PLACEHOLDER] Wireless Fluid Terminal
|
||||
item.ec2placeholder.terminal.universal.wireless.name=[EC2 PLACEHOLDER] Wireless Universal Terminal
|
||||
@@ -1,19 +1,12 @@
|
||||
item.fluid_drop.name=Капля (%s)
|
||||
item.fluid_encoded_pattern.name=Закодированный шаблон
|
||||
item.part_fluid_terminal.name=МЭ жидкостный терминал
|
||||
item.part_fluid_pattern_terminal.name=МЭ жидкостный терминал шаблонов
|
||||
item.part_fluid_pattern_terminal_ex.name=МЭ жидкостный терминал шаблонов обработки
|
||||
item.part_fluid_interface.name=МЭ двойной интерфейс
|
||||
item.part_fluid_p2p_interface.name=P2P туннель - МЭ двойной интерфейс
|
||||
item.part_fluid_import.name=МЭ жидкостная шина импорта
|
||||
item.part_fluid_export.name=МЭ жидкостная шина экспорта
|
||||
item.part_fluid_storage_bus.name=МЭ жидкостная шина хранения
|
||||
item.part_fluid_level_emitter.name=МЭ жидкостный излучатель уровня
|
||||
item.part_fluid_storage_monitor.name=МЭ жидкостный монитор хранения
|
||||
item.part_fluid_conversion_monitor.name=МЭ жидкостный монитор преобразования
|
||||
item.part_level_terminal.name=МЭ терминал регуляторов уровня
|
||||
item.portable_fluid_cell.name=Переносная жидкостная ячейка
|
||||
item.wireless_fluid_terminal.name=Беспроводной жидкостный терминал
|
||||
item.wireless_level_terminal.name=Беспроводной терминал уровня
|
||||
item.wireless_fluid_pattern_terminal.name=Беспроводной жидкостный терминал шаблонов
|
||||
item.wireless_interface_terminal.name=Беспроводной терминал интерфейсов
|
||||
@@ -197,12 +190,6 @@ ae2fc.gui.magnet.ore=Использовать словарь руд
|
||||
ae2fc.gui.magnet.whitelist=Белый список
|
||||
ae2fc.gui.magnet.blacklist=Чёрный список
|
||||
|
||||
ae2fc.gui.color.StateNone=00000000
|
||||
ae2fc.gui.color.StateIdle=FF55FF55
|
||||
ae2fc.gui.color.StateCraft=FFFFFF55
|
||||
ae2fc.gui.color.StateExport=FFAA00AA
|
||||
ae2fc.gui.color.StateError=FFFF5555
|
||||
|
||||
error.unknown=Неизвестно
|
||||
|
||||
ae2fc.key.OpenTerminal=Открыть беспроводной универсальный терминал
|
||||
@@ -213,17 +200,4 @@ ae2fc.key.OpenPatternTerminal=Открыть беспроводной униве
|
||||
ae2fc.key.OpenPatternExTerminal=Открыть беспроводной универсальный терминал шаблонов обработки
|
||||
ae2fc.key.Restock=Автопополнение запасов
|
||||
|
||||
itemGroup.ae2fc=Fluid Craft For AE2
|
||||
|
||||
item.ec2placeholder.oc.upgrade.name=[EC2 ЗАПОЛНИТЕЛЬ] МЭ улучшение
|
||||
item.ec2placeholder.part.base.name=[EC2 ЗАПОЛНИТЕЛЬ] МЭ жидкостная шина
|
||||
item.ec2placeholder.pattern.fluid.name=[EC2 ЗАПОЛНИТЕЛЬ] МЭ жидкостной шаблон
|
||||
item.ec2placeholder.storage.casing.name=[EC2 ЗАПОЛНИТЕЛЬ] Ячейка хранения
|
||||
item.ec2placeholder.storage.component.name=[EC2 ЗАПОЛНИТЕЛЬ] МЭ компонент хранения
|
||||
item.ec2placeholder.storage.fluid.name=[EC2 ЗАПОЛНИТЕЛЬ] МЭ жидкостная ячейка хранения
|
||||
item.ec2placeholder.storage.physical.advanced.quantum.name=[EC2 ЗАПОЛНИТЕЛЬ] МЭ квантовая ячейка хранения
|
||||
item.ec2placeholder.storage.physical.advanced.singularity.name=[EC2 ЗАПОЛНИТЕЛЬ] МЭ сингулярная ячейка хранения
|
||||
item.ec2placeholder.storage.physical.name=[EC2 ЗАПОЛНИТЕЛЬ] МЭ ячейка хранения
|
||||
item.ec2placeholder.storage.physical.void.name=[EC2 ЗАПОЛНИТЕЛЬ] МЭ пустотная ячейка хранения
|
||||
item.ec2placeholder.terminal.fluid.wireless.name=[EC2 ЗАПОЛНИТЕЛЬ] Беспроводной жидкостный терминал
|
||||
item.ec2placeholder.terminal.universal.wireless.name=[EC2 ЗАПОЛНИТЕЛЬ] Беспроводной универсальный терминал
|
||||
itemGroup.ae2fc=Fluid Craft For AE2
|
||||
@@ -1,19 +1,12 @@
|
||||
item.fluid_drop.name=%s液滴
|
||||
item.fluid_encoded_pattern.name=编码样板
|
||||
item.part_fluid_terminal.name=ME流体终端
|
||||
item.part_fluid_pattern_terminal.name=ME流体样板终端
|
||||
item.part_fluid_pattern_terminal_ex.name=ME增广流体样板终端
|
||||
item.part_fluid_interface.name=ME二合一接口
|
||||
item.part_fluid_p2p_interface.name=P2P通道 - ME二合一接口
|
||||
item.part_fluid_import.name=ME流体输入总线
|
||||
item.part_fluid_export.name=ME流体输出总线
|
||||
item.part_fluid_storage_bus.name=ME流体存储总线
|
||||
item.part_fluid_level_emitter.name=ME流体发信器
|
||||
item.part_fluid_storage_monitor.name=ME流体存储监控器
|
||||
item.part_fluid_conversion_monitor.name=ME流体交换监控器
|
||||
item.part_level_terminal.name=ME Level Terminal
|
||||
item.portable_fluid_cell.name=便携流体单元
|
||||
item.wireless_fluid_terminal.name=无线流体终端
|
||||
item.wireless_level_terminal.name=Wireless Level Terminal
|
||||
item.wireless_fluid_pattern_terminal.name=无线样板终端
|
||||
item.wireless_interface_terminal.name=无线接口终端
|
||||
@@ -166,6 +159,8 @@ ae2fc.tooltip.restock.on=Toggle Restock
|
||||
ae2fc.tooltip.restock.on.hint=Enable
|
||||
ae2fc.tooltip.restock.off=Toggle Restock
|
||||
ae2fc.tooltip.restock.off.hint=Disable
|
||||
ae2fc.tooltip.Full-stock.mode=Full-stock Mode
|
||||
ae2fc.tooltip.Normal.mode=Normal Mode
|
||||
|
||||
ae2fc.gui.part_level_terminal=Level Terminal
|
||||
ae2fc.gui.fluid_pattern_encoder=流体适配型样板编码台
|
||||
@@ -191,12 +186,6 @@ ae2fc.gui.magnet.ore=Use Ore Dictionary
|
||||
ae2fc.gui.magnet.whitelist=Whitelisting
|
||||
ae2fc.gui.magnet.blacklist=Blacklisting
|
||||
|
||||
ae2fc.gui.color.StateNone=00000000
|
||||
ae2fc.gui.color.StateIdle=FF55FF55
|
||||
ae2fc.gui.color.StateCraft=FFFFFF55
|
||||
ae2fc.gui.color.StateExport=FFAA00AA
|
||||
ae2fc.gui.color.StateError=FFFF5555
|
||||
|
||||
error.unknown=未知流体
|
||||
|
||||
ae2fc.key.OpenTerminal=Open Wireless Universal Terminal
|
||||
@@ -207,17 +196,4 @@ ae2fc.key.OpenPatternTerminal=Open Wireless Universal Pattern Terminal
|
||||
ae2fc.key.OpenPatternExTerminal=Open Wireless Universal Processing Pattern Terminal
|
||||
ae2fc.key.Restock=Toggle Restock
|
||||
|
||||
itemGroup.ae2fc=AE2流体合成套件重置
|
||||
|
||||
item.ec2placeholder.oc.upgrade.name=[EC2 PLACEHOLDER] ME Upgrade
|
||||
item.ec2placeholder.part.base.name=[EC2 PLACEHOLDER] ME Fluid Bus
|
||||
item.ec2placeholder.pattern.fluid.name=[EC2 PLACEHOLDER] ME Fluid Pattern
|
||||
item.ec2placeholder.storage.casing.name=[EC2 PLACEHOLDER] Storage Housing
|
||||
item.ec2placeholder.storage.component.name=[EC2 PLACEHOLDER] ME Storage Component
|
||||
item.ec2placeholder.storage.fluid.name=[EC2 PLACEHOLDER] ME Fluid Storage
|
||||
item.ec2placeholder.storage.physical.advanced.quantum.name=[EC2 PLACEHOLDER] ME Quantum Storage
|
||||
item.ec2placeholder.storage.physical.advanced.singularity.name=[EC2 PLACEHOLDER] ME Digital Singularity
|
||||
item.ec2placeholder.storage.physical.name=[EC2 PLACEHOLDER] ME Storage
|
||||
item.ec2placeholder.storage.physical.void.name=[EC2 PLACEHOLDER] ME Void Storage
|
||||
item.ec2placeholder.terminal.fluid.wireless.name=[EC2 PLACEHOLDER] Wireless Fluid Terminal
|
||||
item.ec2placeholder.terminal.universal.wireless.name=[EC2 PLACEHOLDER] Wireless Universal Terminal
|
||||
itemGroup.ae2fc=AE2流体合成套件重置
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 532 B |
Binary file not shown.
|
After Width: | Height: | Size: 445 B |
+23
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"animation": {
|
||||
"frametime": 2,
|
||||
"frames": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15
|
||||
]
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 532 B |
Loaded 100 of 113 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user