[ci skip] spotlessApply with the new settings

This commit is contained in:
Jason Mitchell committed 2023-01-28 17:43:10 -08:00
1 parent ab0b8f11d4
commit 69a5c0e6ee
221 files changed
+3125 -2632

No files matched your search

@@ -3,6 +3,7 @@ package com.glodblock.github.client.gui;
import net.minecraft.client.gui.FontRenderer;
public class FCGuiLineField extends FCGuiTextField {
private final int _xPos;
private final int _yPos;
private final int _width;
@@ -1,11 +1,13 @@
package com.glodblock.github.client.gui;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.ITooltip;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiTextField;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.ITooltip;
public class FCGuiTextField extends GuiTextField {
private static final int PADDING = 2;
private final FontRenderer _fontRender;
private String tooltip;
@@ -18,8 +20,7 @@ public class FCGuiTextField extends GuiTextField {
private int _color;
/**
* Uses the values to instantiate a padded version of a text field.
* Pays attention to the '_' caret.
* Uses the values to instantiate a padded version of a text field. Pays attention to the '_' caret.
*
* @param fontRenderer renderer for the strings
* @param xPos absolute left position
@@ -27,8 +28,8 @@ public class FCGuiTextField extends GuiTextField {
* @param width absolute width
* @param height absolute height
*/
public FCGuiTextField(
final FontRenderer fontRenderer, final int xPos, final int yPos, final int width, final int height) {
public FCGuiTextField(final FontRenderer fontRenderer, final int xPos, final int yPos, final int width,
final int height) {
super(
fontRenderer,
xPos + PADDING,
@@ -136,6 +137,7 @@ public class FCGuiTextField extends GuiTextField {
}
public class TooltipProvider implements ITooltip {
@Override
public String getMessage() {
return tooltip;
@@ -1,5 +1,11 @@
package com.glodblock.github.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.StatCollector;
import org.lwjgl.input.Mouse;
import appeng.api.config.InsertionMode;
import appeng.api.config.Settings;
import appeng.api.config.SidelessMode;
@@ -13,6 +19,7 @@ import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketConfigButton;
import appeng.helpers.IInterfaceHost;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerDualInterface;
import com.glodblock.github.common.parts.PartFluidInterface;
@@ -22,10 +29,6 @@ import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.network.CPacketSwitchGuis;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.NameConst;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.StatCollector;
import org.lwjgl.input.Mouse;
public class GuiDualInterface extends GuiUpgradeable {
@@ -46,15 +49,18 @@ public class GuiDualInterface extends GuiUpgradeable {
@Override
@SuppressWarnings("unchecked")
protected void addButtons() {
this.priority =
new GuiTabButton(this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), itemRender);
this.priority = new GuiTabButton(
this.guiLeft + 154,
this.guiTop,
2 + 4 * 16,
GuiText.Priority.getLocal(),
itemRender);
this.buttonList.add(this.priority);
this.switcher = new GuiTabButton(
this.guiLeft + 132,
this.guiTop,
host instanceof PartFluidInterface
? ItemAndBlockHolder.FLUID_INTERFACE.stack()
host instanceof PartFluidInterface ? ItemAndBlockHolder.FLUID_INTERFACE.stack()
: ItemAndBlockHolder.INTERFACE.stack(),
StatCollector.translateToLocal("ae2fc.tooltip.switch_fluid_interface"),
itemRender);
@@ -72,13 +78,19 @@ public class GuiDualInterface extends GuiUpgradeable {
GuiText.InterfaceTerminalHint.getLocal());
this.buttonList.add(this.interfaceMode);
this.insertionMode =
new GuiImgButton(this.guiLeft - 18, this.guiTop + 44, Settings.INSERTION_MODE, InsertionMode.DEFAULT);
this.insertionMode = new GuiImgButton(
this.guiLeft - 18,
this.guiTop + 44,
Settings.INSERTION_MODE,
InsertionMode.DEFAULT);
this.buttonList.add(this.insertionMode);
if (isTile()) {
this.sidelessMode = new GuiImgButton(
this.guiLeft - 18, this.guiTop + 62, Settings.SIDELESS_MODE, SidelessMode.SIDELESS);
this.guiLeft - 18,
this.guiTop + 62,
Settings.SIDELESS_MODE,
SidelessMode.SIDELESS);
this.buttonList.add(this.sidelessMode);
}
}
@@ -100,7 +112,10 @@ public class GuiDualInterface extends GuiUpgradeable {
}
this.fontRendererObj.drawString(
getGuiDisplayName(StatCollector.translateToLocal(NameConst.GUI_FLUID_INTERFACE)), 8, 6, 4210752);
getGuiDisplayName(StatCollector.translateToLocal(NameConst.GUI_FLUID_INTERFACE)),
8,
6,
4210752);
}
@Override
@@ -1,16 +1,20 @@
package com.glodblock.github.client.gui;
import appeng.client.gui.widgets.ITooltip;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.util.NameConst;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import appeng.client.gui.widgets.ITooltip;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.util.NameConst;
public class GuiFCImgButton extends GuiButton implements ITooltip {
private static final Pattern COMPILE = Pattern.compile("%s");
@@ -138,8 +142,8 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
String displayValue = null;
if (this.buttonSetting != null && this.currentValue != null) {
final ButtonAppearance buttonAppearance =
appearances.get(new EnumPair(this.buttonSetting, this.currentValue));
final ButtonAppearance buttonAppearance = appearances
.get(new EnumPair(this.buttonSetting, this.currentValue));
if (buttonAppearance == null) {
return "No Such Message";
}
@@ -196,8 +200,7 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
}
par1Minecraft.renderEngine.bindTexture(FluidCraft.resource("textures/gui/states.png"));
this.field_146123_n = par2 >= this.xPosition
&& par3 >= this.yPosition
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition
&& par2 < this.xPosition + this.width
&& par3 < this.yPosition + this.height;
@@ -233,8 +236,7 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
}
par1Minecraft.renderEngine.bindTexture(FluidCraft.resource("textures/gui/states.png"));
this.field_146123_n = par2 >= this.xPosition
&& par3 >= this.yPosition
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition
&& par2 < this.xPosition + this.width
&& par3 < this.yPosition + this.height;
@@ -292,6 +294,7 @@ public class GuiFCImgButton extends GuiButton implements ITooltip {
}
private static class ButtonAppearance {
public int index;
public String displayName;
public String displayValue;
@@ -1,5 +1,9 @@
package com.glodblock.github.client.gui;
import java.io.IOException;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.container.implementations.ContainerPriority;
import appeng.core.AELog;
import appeng.core.localization.GuiText;
@@ -8,13 +12,12 @@ import appeng.core.sync.packets.PacketValueConfig;
import appeng.helpers.IPriorityHost;
import appeng.util.calculators.ArithHelper;
import appeng.util.calculators.Calculator;
import com.glodblock.github.client.gui.base.FCGuiAmount;
import com.glodblock.github.common.parts.PartFluidStorageBus;
import com.glodblock.github.inventory.IDualHost;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.loader.ItemAndBlockHolder;
import java.io.IOException;
import net.minecraft.entity.player.InventoryPlayer;
public class GuiFCPriority extends FCGuiAmount {
@@ -46,11 +49,10 @@ public class GuiFCPriority extends FCGuiAmount {
protected void addQty(final int i) {
try {
this.amountBox.setText(Long.toString(getAmount() + i));
} catch (final NumberFormatException ignore) {
}
} catch (final NumberFormatException ignore) {}
try {
NetworkHandler.instance.sendToServer(
new PacketValueConfig("PriorityHost.Priority", String.valueOf(getAmount())));
NetworkHandler.instance
.sendToServer(new PacketValueConfig("PriorityHost.Priority", String.valueOf(getAmount())));
} catch (IOException e) {
AELog.debug(e);
}
@@ -71,8 +73,8 @@ public class GuiFCPriority extends FCGuiAmount {
protected void keyTyped(final char character, final int key) {
super.keyTyped(character, key);
try {
NetworkHandler.instance.sendToServer(
new PacketValueConfig("PriorityHost.Priority", String.valueOf(getAmount())));
NetworkHandler.instance
.sendToServer(new PacketValueConfig("PriorityHost.Priority", String.valueOf(getAmount())));
} catch (IOException e) {
AELog.debug(e);
}
@@ -1,8 +1,13 @@
package com.glodblock.github.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.storage.ITerminalHost;
import appeng.container.implementations.ContainerCraftAmount;
import appeng.core.localization.GuiText;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.base.FCGuiAmount;
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
@@ -11,9 +16,6 @@ import com.glodblock.github.common.parts.PartFluidTerminal;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.network.CPacketCraftRequest;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
public class GuiFluidCraftAmount extends FCGuiAmount {
@@ -1,5 +1,15 @@
package com.glodblock.github.client.gui;
import java.text.NumberFormat;
import java.util.*;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import appeng.api.AEApi;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEItemStack;
@@ -10,6 +20,7 @@ import appeng.core.AELog;
import appeng.core.localization.GuiText;
import appeng.integration.modules.NEI;
import appeng.util.Platform;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerFluidCraftConfirm;
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
@@ -20,13 +31,6 @@ import com.glodblock.github.network.CPacketFluidPatternTermBtns;
import com.glodblock.github.network.CPacketSwitchGuis;
import com.glodblock.github.util.ModAndClassUtil;
import com.google.common.base.Joiner;
import java.text.NumberFormat;
import java.util.*;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
public class GuiFluidCraftConfirm extends AEBaseGui {
@@ -72,8 +76,13 @@ public class GuiFluidCraftConfirm extends AEBaseGui {
public void initGui() {
super.initGui();
this.start =
new GuiButton(0, this.guiLeft + 162, this.guiTop + this.ySize - 25, 50, 20, GuiText.Start.getLocal());
this.start = new GuiButton(
0,
this.guiLeft + 162,
this.guiTop + this.ySize - 25,
50,
20,
GuiText.Start.getLocal());
this.start.enabled = false;
this.buttonList.add(this.start);
@@ -89,7 +98,12 @@ public class GuiFluidCraftConfirm extends AEBaseGui {
if (this.OriginalGui != null) {
this.cancel = new GuiButton(
0, this.guiLeft + 6, this.guiTop + this.ySize - 25, 50, 20, GuiText.Cancel.getLocal());
0,
this.guiLeft + 6,
this.guiTop + this.ySize - 25,
50,
20,
GuiText.Cancel.getLocal());
}
this.buttonList.add(this.cancel);
@@ -137,9 +151,7 @@ public class GuiFluidCraftConfirm extends AEBaseGui {
if (this.ccc.getSelectedCpu() >= 0) // && status.selectedCpu < status.cpus.size() )
{
if (this.ccc.getName().length() > 0) {
final String name = this.ccc
.getName()
.substring(0, Math.min(20, this.ccc.getName().length()));
final String name = this.ccc.getName().substring(0, Math.min(20, this.ccc.getName().length()));
btnTextText = GuiText.CraftingCPU.getLocal() + ": " + name;
} else {
btnTextText = GuiText.CraftingCPU.getLocal() + ": #" + this.ccc.getSelectedCpu();
@@ -161,8 +173,8 @@ public class GuiFluidCraftConfirm extends AEBaseGui {
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
final long BytesUsed = this.ccc.getUsedBytes();
final String byteUsed = NumberFormat.getInstance().format(BytesUsed);
final String Add =
BytesUsed > 0 ? (byteUsed + ' ' + GuiText.BytesUsed.getLocal()) : GuiText.CalculatingWait.getLocal();
final String Add = BytesUsed > 0 ? (byteUsed + ' ' + GuiText.BytesUsed.getLocal())
: GuiText.CalculatingWait.getLocal();
this.fontRendererObj.drawString(GuiText.CraftingPlan.getLocal() + " - " + Add, 8, 7, 4210752);
String dsp = null;
@@ -171,8 +183,12 @@ public class GuiFluidCraftConfirm extends AEBaseGui {
dsp = GuiText.Simulation.getLocal();
} else {
dsp = this.ccc.getCpuAvailableBytes() > 0
? (GuiText.Bytes.getLocal() + ": " + this.ccc.getCpuAvailableBytes() + " : "
+ GuiText.CoProcessors.getLocal() + ": " + this.ccc.getCpuCoProcessors())
? (GuiText.Bytes.getLocal() + ": "
+ this.ccc.getCpuAvailableBytes()
+ " : "
+ GuiText.CoProcessors.getLocal()
+ ": "
+ this.ccc.getCpuCoProcessors())
: GuiText.Bytes.getLocal() + ": N/A : " + GuiText.CoProcessors.getLocal() + ": N/A";
}
@@ -479,8 +495,8 @@ public class GuiFluidCraftConfirm extends AEBaseGui {
final boolean backwards = Mouse.isButtonDown(1);
if (btn == this.selectCPU) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidPatternTermBtns("Terminal.Cpu", backwards ? "Prev" : "Next"));
FluidCraft.proxy.netHandler
.sendToServer(new CPacketFluidPatternTermBtns("Terminal.Cpu", backwards ? "Prev" : "Next"));
}
if (btn == this.cancel) {
@@ -497,7 +513,7 @@ public class GuiFluidCraftConfirm extends AEBaseGui {
}
}
@SuppressWarnings({"rawtypes", "unchecked"})
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void addItemTooltip(ItemStack is, List<String> lineList) {
if (isShiftKeyDown()) {
List l = is.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
@@ -1,16 +1,19 @@
package com.glodblock.github.client.gui;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.gui.implementations.GuiUpgradeable;
import appeng.core.localization.GuiText;
import com.glodblock.github.client.gui.container.ContainerFluidIO;
import com.glodblock.github.common.parts.PartFluidImportBus;
import com.glodblock.github.common.parts.base.FCSharedFluidBus;
import com.glodblock.github.util.NameConst;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
public class GuiFluidIO extends GuiUpgradeable {
private final FCSharedFluidBus bus;
public GuiFluidIO(InventoryPlayer inventoryPlayer, FCSharedFluidBus te) {
@@ -30,10 +33,10 @@ public class GuiFluidIO extends GuiUpgradeable {
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.fontRendererObj.drawString(
this.getGuiDisplayName(I18n.format(
this.bus instanceof PartFluidImportBus
? NameConst.GUI_FLUID_IMPORT
: NameConst.GUI_FLUID_EXPORT)),
this.getGuiDisplayName(
I18n.format(
this.bus instanceof PartFluidImportBus ? NameConst.GUI_FLUID_IMPORT
: NameConst.GUI_FLUID_EXPORT)),
8,
6,
4210752);
@@ -1,9 +1,22 @@
package com.glodblock.github.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.core.localization.GuiText;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerFluidInterface;
import com.glodblock.github.common.parts.PartFluidInterface;
@@ -16,16 +29,6 @@ import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.network.CPacketSwitchGuis;
import com.glodblock.github.util.NameConst;
import com.glodblock.github.util.RenderUtil;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
public class GuiFluidInterface extends AEBaseGui {
@@ -58,11 +61,8 @@ public class GuiFluidInterface extends AEBaseGui {
@Override
public void func_146977_a(final Slot s) {
try {
GuiContainer.class
.getDeclaredMethod("func_146977_a_original", Slot.class)
.invoke(this, s);
} catch (final Exception ignore) {
}
GuiContainer.class.getDeclaredMethod("func_146977_a_original", Slot.class).invoke(this, s);
} catch (final Exception ignore) {}
}
@Override
@@ -1,5 +1,8 @@
package com.glodblock.github.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.config.*;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.gui.implementations.GuiUpgradeable;
@@ -10,16 +13,16 @@ import appeng.core.AEConfig;
import appeng.core.AELog;
import appeng.core.localization.GuiColors;
import appeng.core.localization.GuiText;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerFluidLevelEmitter;
import com.glodblock.github.common.parts.PartFluidLevelEmitter;
import com.glodblock.github.network.CPacketValueConfig;
import com.glodblock.github.util.Ae2ReflectClient;
import com.glodblock.github.util.NameConst;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
public class GuiFluidLevelEmitter extends GuiUpgradeable {
private GuiNumberBox level;
private final AppEngRenderItem stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
private GuiButton plus1;
@@ -52,7 +55,10 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
@Override
protected void addButtons() {
this.redstoneMode = new GuiImgButton(
this.guiLeft - 18, this.guiTop + 8, Settings.REDSTONE_EMITTER, RedstoneMode.LOW_SIGNAL);
this.guiLeft - 18,
this.guiTop + 8,
Settings.REDSTONE_EMITTER,
RedstoneMode.LOW_SIGNAL);
final int a = AEConfig.instance.levelByStackAmounts(0);
final int b = AEConfig.instance.levelByStackAmounts(1);
@@ -75,9 +81,15 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
@Override
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.fontRendererObj.drawString(
NameConst.i18n(NameConst.GUI_FLUID_LEVEL_EMITTER), 8, 6, GuiColors.UpgradableTitle.getColor());
NameConst.i18n(NameConst.GUI_FLUID_LEVEL_EMITTER),
8,
6,
GuiColors.UpgradableTitle.getColor());
this.fontRendererObj.drawString(
GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, GuiColors.UpgradableInventory.getColor());
GuiText.inventory.getLocal(),
8,
this.ySize - 96 + 3,
GuiColors.UpgradableInventory.getColor());
this.redstoneMode.set(this.cvb.getRedStoneMode());
this.level.drawTextBox();
if (isShiftKeyDown() && !isMul) {
@@ -90,8 +102,8 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
} else if (!isShiftKeyDown() && isMul) {
for (Object btn : this.buttonList) {
if (btn instanceof GuiButton) {
((GuiButton) btn).displayString = ((GuiButton) btn)
.displayString.substring(0, ((GuiButton) btn).displayString.lastIndexOf("000"));
((GuiButton) btn).displayString = ((GuiButton) btn).displayString
.substring(0, ((GuiButton) btn).displayString.lastIndexOf("000"));
}
}
isMul = false;
@@ -115,8 +127,9 @@ public class GuiFluidLevelEmitter extends GuiUpgradeable {
protected void actionPerformed(final GuiButton btn) {
super.actionPerformed(btn);
final boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
final boolean isMinus =
btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
final boolean isMinus = btn == this.minus1 || btn == this.minus10
|| btn == this.minus100
|| btn == this.minus1000;
if (isPlus || isMinus) {
this.addQty(this.getQty(btn));
@@ -1,23 +1,26 @@
package com.glodblock.github.client.gui;
import java.util.List;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.core.localization.GuiText;
import appeng.util.item.AEItemStack;
import com.glodblock.github.client.gui.base.FCGuiMonitor;
import com.glodblock.github.client.gui.container.ContainerFluidMonitor;
import com.glodblock.github.client.me.FluidRepo;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.util.Util;
import java.util.List;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
public class GuiFluidMonitor extends FCGuiMonitor<IAEFluidStack> {
public GuiFluidMonitor(
final InventoryPlayer inventoryPlayer, final ITerminalHost te, final ContainerFluidMonitor c) {
public GuiFluidMonitor(final InventoryPlayer inventoryPlayer, final ITerminalHost te,
final ContainerFluidMonitor c) {
super(inventoryPlayer, te, c);
this.repo = new FluidRepo(getScrollBar(), this);
}
@@ -1,14 +1,16 @@
package com.glodblock.github.client.gui;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import appeng.client.gui.AEBaseGui;
import appeng.core.localization.GuiText;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerFluidPacketDecoder;
import com.glodblock.github.common.tile.TileFluidPacketDecoder;
import com.glodblock.github.util.NameConst;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GuiFluidPacketDecoder extends AEBaseGui {
@@ -1,9 +1,23 @@
package com.glodblock.github.client.gui;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.AEBaseGui;
import appeng.client.render.AppEngRenderItem;
import appeng.core.localization.GuiText;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerFluidPatternEncoder;
import com.glodblock.github.common.item.ItemFluidPacket;
@@ -14,17 +28,6 @@ import com.glodblock.github.inventory.slot.SlotSingleItem;
import com.glodblock.github.network.CPacketEncodePattern;
import com.glodblock.github.util.Ae2ReflectClient;
import com.glodblock.github.util.NameConst;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
public class GuiFluidPatternEncoder extends AEBaseGui {
@@ -38,6 +41,7 @@ public class GuiFluidPatternEncoder extends AEBaseGui {
super(new ContainerFluidPatternEncoder(ipl, tile));
this.cont = (ContainerFluidPatternEncoder) inventorySlots;
mouseRegions.addRegion(141, 38, 10, 10, new MouseRegionManager.Handler() {
@Override
public List<String> getTooltip() {
return Collections.singletonList(I18n.format(NameConst.TT_ENCODE_PATTERN));
@@ -104,14 +108,15 @@ public class GuiFluidPatternEncoder extends AEBaseGui {
}
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings({ "unchecked", "rawtypes" })
protected void renderToolTip(ItemStack stack, int x, int y) {
List list;
if (stack.getItem() instanceof ItemFluidPacket) {
FluidStack fluid = ItemFluidPacket.getFluidStack(stack);
if (fluid != null) {
list = Arrays.asList(
fluid.getLocalizedName(), String.format(EnumChatFormatting.GRAY + "%,d mB", fluid.amount));
fluid.getLocalizedName(),
String.format(EnumChatFormatting.GRAY + "%,d mB", fluid.amount));
} else {
list = stack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
}
@@ -1,5 +1,11 @@
package com.glodblock.github.client.gui;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import appeng.api.config.ActionItems;
import appeng.api.config.ItemSubstitution;
import appeng.api.config.PatternBeSubstitution;
@@ -11,15 +17,11 @@ import appeng.container.slot.OptionalSlotFake;
import appeng.container.slot.SlotFakeCraftingMatrix;
import appeng.container.slot.SlotPatternTerm;
import appeng.core.localization.GuiText;
import com.glodblock.github.client.gui.base.FCGuiEncodeTerminal;
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminal;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.NameConst;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
public class GuiFluidPatternTerminal extends FCGuiEncodeTerminal {
@@ -48,29 +50,44 @@ public class GuiFluidPatternTerminal extends FCGuiEncodeTerminal {
this.buttonList.add(this.tabProcessButton);
this.substitutionsEnabledBtn = new GuiImgButton(
this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.ENABLED);
this.guiLeft + 84,
this.guiTop + this.ySize - 163,
Settings.ACTIONS,
ItemSubstitution.ENABLED);
this.substitutionsEnabledBtn.setHalfSize(true);
this.buttonList.add(this.substitutionsEnabledBtn);
this.substitutionsDisabledBtn = new GuiImgButton(
this.guiLeft + 84, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.DISABLED);
this.guiLeft + 84,
this.guiTop + this.ySize - 163,
Settings.ACTIONS,
ItemSubstitution.DISABLED);
this.substitutionsDisabledBtn.setHalfSize(true);
this.buttonList.add(this.substitutionsDisabledBtn);
this.clearBtn = new GuiImgButton(
this.guiLeft + 74, this.guiTop + this.ySize - 163, Settings.ACTIONS, ActionItems.CLOSE);
this.guiLeft + 74,
this.guiTop + this.ySize - 163,
Settings.ACTIONS,
ActionItems.CLOSE);
this.clearBtn.setHalfSize(true);
this.buttonList.add(this.clearBtn);
this.encodeBtn = new GuiImgButton(
this.guiLeft + 147, this.guiTop + this.ySize - 142, Settings.ACTIONS, ActionItems.ENCODE);
this.guiLeft + 147,
this.guiTop + this.ySize - 142,
Settings.ACTIONS,
ActionItems.ENCODE);
this.buttonList.add(this.encodeBtn);
int combineLeft = 74;
int combineTop = 153;
if (ModAndClassUtil.isDoubleButton) {
this.doubleBtn = new GuiImgButton(
this.guiLeft + 74, this.guiTop + this.ySize - 153, Settings.ACTIONS, ActionItems.DOUBLE);
this.guiLeft + 74,
this.guiTop + this.ySize - 153,
Settings.ACTIONS,
ActionItems.DOUBLE);
this.doubleBtn.setHalfSize(true);
this.buttonList.add(this.doubleBtn);
combineLeft = 84;
@@ -79,7 +96,10 @@ public class GuiFluidPatternTerminal extends FCGuiEncodeTerminal {
combineLeft = 74;
combineTop -= 11;
this.beSubstitutionsEnabledBtn = new GuiImgButton(
this.guiLeft + 84, this.guiTop + this.ySize - 153, Settings.ACTIONS, PatternBeSubstitution.ENABLED);
this.guiLeft + 84,
this.guiTop + this.ySize - 153,
Settings.ACTIONS,
PatternBeSubstitution.ENABLED);
this.beSubstitutionsEnabledBtn.setHalfSize(true);
this.buttonList.add(this.beSubstitutionsEnabledBtn);
@@ -92,12 +112,18 @@ public class GuiFluidPatternTerminal extends FCGuiEncodeTerminal {
this.buttonList.add(this.beSubstitutionsDisabledBtn);
}
this.combineEnableBtn = new GuiFCImgButton(
this.guiLeft + combineLeft, this.guiTop + this.ySize - combineTop, "FORCE_COMBINE", "DO_COMBINE");
this.guiLeft + combineLeft,
this.guiTop + this.ySize - combineTop,
"FORCE_COMBINE",
"DO_COMBINE");
this.combineEnableBtn.setHalfSize(true);
this.buttonList.add(this.combineEnableBtn);
this.combineDisableBtn = new GuiFCImgButton(
this.guiLeft + combineLeft, this.guiTop + this.ySize - combineTop, "NOT_COMBINE", "DONT_COMBINE");
this.guiLeft + combineLeft,
this.guiTop + this.ySize - combineTop,
"NOT_COMBINE",
"DONT_COMBINE");
this.combineDisableBtn.setHalfSize(true);
this.buttonList.add(this.combineDisableBtn);
}
@@ -116,8 +142,7 @@ public class GuiFluidPatternTerminal extends FCGuiEncodeTerminal {
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
if (mouseButton == 3) {
if (this.container.isCraftingMode()
&& (slot instanceof OptionalSlotFake
|| slot instanceof SlotFakeCraftingMatrix
&& (slot instanceof OptionalSlotFake || slot instanceof SlotFakeCraftingMatrix
|| slot instanceof SlotPatternTerm)) {
return;
}
@@ -1,8 +1,13 @@
package com.glodblock.github.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.implementations.GuiCraftingStatus;
import appeng.client.gui.widgets.GuiTabButton;
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
import com.glodblock.github.common.parts.PartFluidTerminal;
@@ -10,9 +15,6 @@ import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.Ae2ReflectClient;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
public class GuiFluidPatternTerminalCraftingStatus extends GuiCraftingStatus {
@@ -1,17 +1,20 @@
package com.glodblock.github.client.gui;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.StatCollector;
import org.lwjgl.input.Mouse;
import appeng.api.config.*;
import appeng.api.storage.ITerminalHost;
import appeng.client.gui.widgets.GuiImgButton;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.base.FCGuiEncodeTerminal;
import com.glodblock.github.client.gui.container.ContainerFluidPatternTerminalEx;
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
import com.glodblock.github.util.ModAndClassUtil;
import com.glodblock.github.util.NameConst;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.StatCollector;
import org.lwjgl.input.Mouse;
public class GuiFluidPatternTerminalEx extends FCGuiEncodeTerminal {
@@ -27,22 +30,34 @@ public class GuiFluidPatternTerminalEx extends FCGuiEncodeTerminal {
super.initGui();
this.substitutionsEnabledBtn = new GuiImgButton(
this.guiLeft + 97, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.ENABLED);
this.guiLeft + 97,
this.guiTop + this.ySize - 163,
Settings.ACTIONS,
ItemSubstitution.ENABLED);
this.substitutionsEnabledBtn.setHalfSize(true);
this.buttonList.add(this.substitutionsEnabledBtn);
this.substitutionsDisabledBtn = new GuiImgButton(
this.guiLeft + 97, this.guiTop + this.ySize - 163, Settings.ACTIONS, ItemSubstitution.DISABLED);
this.guiLeft + 97,
this.guiTop + this.ySize - 163,
Settings.ACTIONS,
ItemSubstitution.DISABLED);
this.substitutionsDisabledBtn.setHalfSize(true);
this.buttonList.add(this.substitutionsDisabledBtn);
this.fluidPrioritizedEnabledBtn =
new GuiFCImgButton(this.guiLeft + 97, this.guiTop + this.ySize - 114, "FORCE_PRIO", "DO_PRIO");
this.fluidPrioritizedEnabledBtn = new GuiFCImgButton(
this.guiLeft + 97,
this.guiTop + this.ySize - 114,
"FORCE_PRIO",
"DO_PRIO");
this.fluidPrioritizedEnabledBtn.setHalfSize(true);
this.buttonList.add(this.fluidPrioritizedEnabledBtn);
this.fluidPrioritizedDisabledBtn =
new GuiFCImgButton(this.guiLeft + 97, this.guiTop + this.ySize - 114, "NOT_PRIO", "DONT_PRIO");
this.fluidPrioritizedDisabledBtn = new GuiFCImgButton(
this.guiLeft + 97,
this.guiTop + this.ySize - 114,
"NOT_PRIO",
"DONT_PRIO");
this.fluidPrioritizedDisabledBtn.setHalfSize(true);
this.buttonList.add(this.fluidPrioritizedDisabledBtn);
@@ -55,33 +70,51 @@ public class GuiFluidPatternTerminalEx extends FCGuiEncodeTerminal {
this.buttonList.add(this.invertBtn);
this.clearBtn = new GuiImgButton(
this.guiLeft + 87, this.guiTop + this.ySize - 163, Settings.ACTIONS, ActionItems.CLOSE);
this.guiLeft + 87,
this.guiTop + this.ySize - 163,
Settings.ACTIONS,
ActionItems.CLOSE);
this.clearBtn.setHalfSize(true);
this.buttonList.add(this.clearBtn);
this.encodeBtn = new GuiImgButton(
this.guiLeft + 147, this.guiTop + this.ySize - 142, Settings.ACTIONS, ActionItems.ENCODE);
this.guiLeft + 147,
this.guiTop + this.ySize - 142,
Settings.ACTIONS,
ActionItems.ENCODE);
this.buttonList.add(this.encodeBtn);
if (ModAndClassUtil.isDoubleButton) {
this.doubleBtn = new GuiImgButton(
this.guiLeft + 97, this.guiTop + this.ySize - 153, Settings.ACTIONS, ActionItems.DOUBLE);
this.guiLeft + 97,
this.guiTop + this.ySize - 153,
Settings.ACTIONS,
ActionItems.DOUBLE);
this.doubleBtn.setHalfSize(true);
this.buttonList.add(this.doubleBtn);
}
this.combineEnableBtn =
new GuiFCImgButton(this.guiLeft + 87, this.guiTop + this.ySize - 114, "FORCE_COMBINE", "DO_COMBINE");
this.combineEnableBtn = new GuiFCImgButton(
this.guiLeft + 87,
this.guiTop + this.ySize - 114,
"FORCE_COMBINE",
"DO_COMBINE");
this.combineEnableBtn.setHalfSize(true);
this.buttonList.add(this.combineEnableBtn);
this.combineDisableBtn =
new GuiFCImgButton(this.guiLeft + 87, this.guiTop + this.ySize - 114, "NOT_COMBINE", "DONT_COMBINE");
this.combineDisableBtn = new GuiFCImgButton(
this.guiLeft + 87,
this.guiTop + this.ySize - 114,
"NOT_COMBINE",
"DONT_COMBINE");
this.combineDisableBtn.setHalfSize(true);
this.buttonList.add(this.combineDisableBtn);
if (ModAndClassUtil.isBeSubstitutionsButton) {
this.beSubstitutionsEnabledBtn = new GuiImgButton(
this.guiLeft + 87, this.guiTop + this.ySize - 103, Settings.ACTIONS, PatternBeSubstitution.ENABLED);
this.guiLeft + 87,
this.guiTop + this.ySize - 103,
Settings.ACTIONS,
PatternBeSubstitution.ENABLED);
this.beSubstitutionsEnabledBtn.setHalfSize(true);
this.buttonList.add(this.beSubstitutionsEnabledBtn);
@@ -173,7 +206,9 @@ public class GuiFluidPatternTerminalEx extends FCGuiEncodeTerminal {
}
private void changeActivePage() {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns(
"PatternTerminal.ActivePage", String.valueOf(this.processingScrollBar.getCurrentScroll())));
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidPatternTermBtns(
"PatternTerminal.ActivePage",
String.valueOf(this.processingScrollBar.getCurrentScroll())));
}
}
@@ -1,9 +1,11 @@
package com.glodblock.github.client.gui;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.container.slot.AppEngSlot;
import com.glodblock.github.client.gui.container.ContainerFluidPortableCell;
import com.glodblock.github.inventory.item.IFluidPortableCell;
import net.minecraft.entity.player.InventoryPlayer;
public class GuiFluidPortableCell extends GuiFluidTerminal {
@@ -1,5 +1,11 @@
package com.glodblock.github.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import org.lwjgl.input.Mouse;
import appeng.api.config.AccessRestriction;
import appeng.api.config.ActionItems;
import appeng.api.config.Settings;
@@ -11,6 +17,7 @@ import appeng.core.localization.GuiColors;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketConfigButton;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerFluidStorageBus;
import com.glodblock.github.common.parts.PartFluidStorageBus;
@@ -18,10 +25,6 @@ import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
import com.glodblock.github.network.CPacketSwitchGuis;
import com.glodblock.github.util.NameConst;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import org.lwjgl.input.Mouse;
public class GuiFluidStorageBus extends GuiUpgradeable {
@@ -40,10 +43,17 @@ public class GuiFluidStorageBus extends GuiUpgradeable {
protected void addButtons() {
this.clear = new GuiImgButton(this.guiLeft - 18, this.guiTop + 8, Settings.ACTIONS, ActionItems.CLOSE);
this.partition = new GuiImgButton(this.guiLeft - 18, this.guiTop + 28, Settings.ACTIONS, ActionItems.WRENCH);
this.rwMode =
new GuiImgButton(this.guiLeft - 18, this.guiTop + 48, Settings.ACCESS, AccessRestriction.READ_WRITE);
this.priority =
new GuiTabButton(this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), itemRender);
this.rwMode = new GuiImgButton(
this.guiLeft - 18,
this.guiTop + 48,
Settings.ACCESS,
AccessRestriction.READ_WRITE);
this.priority = new GuiTabButton(
this.guiLeft + 154,
this.guiTop,
2 + 4 * 16,
GuiText.Priority.getLocal(),
itemRender);
this.buttonList.add(this.priority);
this.buttonList.add(this.rwMode);
@@ -59,7 +69,10 @@ public class GuiFluidStorageBus extends GuiUpgradeable {
6,
GuiColors.StorageBusTitle.getColor());
this.fontRendererObj.drawString(
GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, GuiColors.StorageBusInventory.getColor());
GuiText.inventory.getLocal(),
8,
this.ySize - 96 + 3,
GuiColors.StorageBusInventory.getColor());
if (this.rwMode != null) {
this.rwMode.set(((ContainerFluidStorageBus) this.cvb).getReadWriteMode());
@@ -1,21 +1,8 @@
package com.glodblock.github.client.gui;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.me.SlotME;
import appeng.client.render.AppEngRenderItem;
import appeng.container.slot.AppEngSlot;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerFluidMonitor;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.network.CPacketFluidUpdate;
import com.glodblock.github.util.Ae2ReflectClient;
import com.glodblock.github.util.Util;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.texture.TextureMap;
@@ -25,9 +12,27 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.me.SlotME;
import appeng.client.render.AppEngRenderItem;
import appeng.container.slot.AppEngSlot;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerFluidMonitor;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.network.CPacketFluidUpdate;
import com.glodblock.github.util.Ae2ReflectClient;
import com.glodblock.github.util.Util;
public class GuiFluidTerminal extends GuiFluidMonitor {
private final AppEngRenderItem stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
protected EntityPlayer player;
public ContainerFluidMonitor container;
@@ -39,8 +44,8 @@ public class GuiFluidTerminal extends GuiFluidMonitor {
this.showViewBtn = false;
}
public GuiFluidTerminal(
final InventoryPlayer inventoryPlayer, final ITerminalHost te, final ContainerFluidMonitor c) {
public GuiFluidTerminal(final InventoryPlayer inventoryPlayer, final ITerminalHost te,
final ContainerFluidMonitor c) {
super(inventoryPlayer, te, c);
this.container = c;
this.player = inventoryPlayer.player;
@@ -1,8 +1,17 @@
package com.glodblock.github.client.gui;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.gui.AEBaseGui;
import appeng.core.localization.GuiText;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerIngredientBuffer;
import com.glodblock.github.common.tile.TileIngredientBuffer;
@@ -12,12 +21,6 @@ import com.glodblock.github.inventory.gui.MouseRegionManager;
import com.glodblock.github.inventory.gui.TankMouseHandler;
import com.glodblock.github.util.NameConst;
import com.glodblock.github.util.RenderUtil;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
public class GuiIngredientBuffer extends AEBaseGui {
@@ -40,7 +43,11 @@ public class GuiIngredientBuffer extends AEBaseGui {
TANK_HEIGHT,
new TankMouseHandler(cont.getTile().getInternalFluid(), i));
mouseRegions.addRegion(
TANK_X + 10 + 22 * i, TANK_Y + TANK_HEIGHT + 2, 7, 7, ButtonMouseHandler.dumpTank(cont, i));
TANK_X + 10 + 22 * i,
TANK_Y + TANK_HEIGHT + 2,
7,
7,
ButtonMouseHandler.dumpTank(cont, i));
}
}
@@ -1,16 +1,19 @@
package com.glodblock.github.client.gui;
import java.util.List;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.me.ItemRepo;
import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import com.glodblock.github.client.gui.base.FCGuiMonitor;
import com.glodblock.github.client.gui.container.ContainerItemMonitor;
import com.glodblock.github.util.ModAndClassUtil;
import java.util.List;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
public class GuiItemMonitor extends FCGuiMonitor<IAEItemStack> {
@@ -1,8 +1,17 @@
package com.glodblock.github.client.gui;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.gui.AEBaseGui;
import appeng.core.localization.GuiText;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerLargeIngredientBuffer;
import com.glodblock.github.common.tile.TileLargeIngredientBuffer;
@@ -12,12 +21,6 @@ import com.glodblock.github.inventory.gui.MouseRegionManager;
import com.glodblock.github.inventory.gui.TankMouseHandler;
import com.glodblock.github.util.NameConst;
import com.glodblock.github.util.RenderUtil;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
public class GuiLargeIngredientBuffer extends AEBaseGui {
@@ -40,7 +43,11 @@ public class GuiLargeIngredientBuffer extends AEBaseGui {
TANK_HEIGHT,
new TankMouseHandler(cont.getTile().getInternalFluid(), i));
mouseRegions.addRegion(
TANK_X + 10 + 22 * i, TANK_Y + TANK_HEIGHT + 2, 7, 7, ButtonMouseHandler.dumpTank(cont, i));
TANK_X + 10 + 22 * i,
TANK_Y + TANK_HEIGHT + 2,
7,
7,
ButtonMouseHandler.dumpTank(cont, i));
}
}
@@ -59,8 +66,8 @@ public class GuiLargeIngredientBuffer extends AEBaseGui {
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
fontRendererObj.drawString(
getGuiDisplayName(I18n.format(NameConst.GUI_LARGE_INGREDIENT_BUFFER)), 8, 6, 0x404040);
fontRendererObj
.drawString(getGuiDisplayName(I18n.format(NameConst.GUI_LARGE_INGREDIENT_BUFFER)), 8, 6, 0x404040);
fontRendererObj.drawString(GuiText.inventory.getLocal(), 8, ySize - 94, 0x404040);
GL11.glColor4f(1F, 1F, 1F, 1F);
@@ -1,5 +1,21 @@
package com.glodblock.github.client.gui;
import java.awt.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Keyboard;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.AEBaseGui;
import appeng.client.render.AppEngRenderItem;
@@ -10,6 +26,7 @@ import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cofh.core.render.CoFHFontRenderer;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerLevelMaintainer;
import com.glodblock.github.common.tile.TileLevelMaintainer;
@@ -20,19 +37,6 @@ import com.glodblock.github.network.CPacketLevelMaintainer;
import com.glodblock.github.util.Ae2ReflectClient;
import com.glodblock.github.util.NameConst;
import cpw.mods.fml.common.Optional;
import java.awt.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Keyboard;
@Optional.Interface(modid = "NotEnoughItems", iface = "codechicken.nei.api.INEIGuiHandler")
public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
@@ -146,8 +150,7 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
if (stack == null) return true;
IAEItemStack fake = stack.copy();
if (this.component[slot.getSlotIndex()].getQty().textField.getText().matches("[0-9]+")) {
fake.setStackSize(Long.parseLong(
this.component[slot.getSlotIndex()].getQty().textField.getText()));
fake.setStackSize(Long.parseLong(this.component[slot.getSlotIndex()].getQty().textField.getText()));
} else {
fake.setStackSize(0);
}
@@ -209,9 +212,7 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
@Override
protected void handleMouseClick(final Slot slot, final int slotIdx, final int ctrlDown, final int mouseButton) {
if (slot instanceof SlotFluidConvertingFake && this.cont.getPlayerInv().getItemStack() != null) {
this.component[slot.getSlotIndex()]
.getQty()
.textField
this.component[slot.getSlotIndex()].getQty().textField
.setText(String.valueOf(this.cont.getPlayerInv().getItemStack().stackSize));
return;
}
@@ -276,6 +277,7 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
}
private class Component {
public boolean isEnable = true;
private final Widget qty;
private final Widget batch;
@@ -285,14 +287,8 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
private final FCGuiLineField line;
private TileLevelMaintainer.State state;
public Component(
Widget qtyInput,
Widget batchInput,
GuiFCImgButton submitBtn,
GuiFCImgButton enableBtn,
GuiFCImgButton disableBtn,
FCGuiLineField line,
List buttonList) {
public Component(Widget qtyInput, Widget batchInput, GuiFCImgButton submitBtn, GuiFCImgButton enableBtn,
GuiFCImgButton disableBtn, FCGuiLineField line, List buttonList) {
this.qty = qtyInput;
this.batch = batchInput;
this.enable = enableBtn;
@@ -315,8 +311,7 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
private boolean send(Widget widget) {
if (((SlotFluidConvertingFake) cont.inventorySlots.get(widget.idx)).getHasStack()) {
if (!widget.textField.getText().isEmpty()
&& widget.textField.getText().matches("^[0-9]+")) {
if (!widget.textField.getText().isEmpty() && widget.textField.getText().matches("^[0-9]+")) {
String str = widget.textField.getText().replaceAll("^(0+)", "");
widget.textField.setText(str.isEmpty() ? "0" : str);
FluidCraft.proxy.netHandler.sendToServer(
@@ -337,12 +332,12 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
if (this.send(this.getQty())) this.send(this.getBatch());
didSomething = true;
} else if (this.enable == btn) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketLevelMaintainer("TileLevelMaintainer.Enable", this.getIndex()));
FluidCraft.proxy.netHandler
.sendToServer(new CPacketLevelMaintainer("TileLevelMaintainer.Enable", this.getIndex()));
didSomething = true;
} else if (this.disable == btn) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketLevelMaintainer("TileLevelMaintainer.Disable", this.getIndex()));
FluidCraft.proxy.netHandler
.sendToServer(new CPacketLevelMaintainer("TileLevelMaintainer.Disable", this.getIndex()));
didSomething = true;
}
return didSomething;
@@ -374,23 +369,27 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
switch (this.state) {
case Idling:
this.line.setColor(0xFF55FF55);
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT)
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_IDLE));
message.add(
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT)
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_IDLE));
break;
case Crafting:
this.line.setColor(0xFFFFFF55);
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT)
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_LINK));
message.add(
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT)
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_LINK));
break;
case Exporting:
this.line.setColor(0xFFAA00AA);
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT)
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_EXPORT));
message.add(
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT)
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_EXPORT));
break;
default:
this.line.setColor(0);
message.add(NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT)
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_NONE));
message.add(
NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_CURRENT)
+ NameConst.i18n(NameConst.TT_LEVEL_MAINTAINER_NONE));
}
message.add("");
if (isShiftKeyDown()) {
@@ -421,6 +420,7 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
}
private class Widget {
public final int idx;
public final String action;
private final FCGuiTextField textField;
@@ -440,9 +440,11 @@ public class GuiLevelMaintainer extends AEBaseGui implements INEIGuiHandler {
if (isShiftKeyDown()) {
this.setTooltip(render.wrapFormattedStringToWidth(NameConst.i18n(this.tooltip), xSize / 2));
} else {
this.setTooltip(render.wrapFormattedStringToWidth(
NameConst.i18n(this.tooltip, "\n", false) + "\n" + NameConst.i18n(NameConst.TT_SHIFT_FOR_MORE),
(int) Math.floor(xSize * 0.8)));
this.setTooltip(
render.wrapFormattedStringToWidth(
NameConst.i18n(this.tooltip, "\n", false) + "\n"
+ NameConst.i18n(NameConst.TT_SHIFT_FOR_MORE),
(int) Math.floor(xSize * 0.8)));
}
this.textField.drawTextBox();
}
@@ -1,14 +1,16 @@
package com.glodblock.github.client.gui;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import appeng.client.gui.AEBaseGui;
import appeng.core.localization.GuiText;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.ContainerOCPatternEditor;
import com.glodblock.github.common.tile.TileOCPatternEditor;
import com.glodblock.github.util.NameConst;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GuiOCPatternEditor extends AEBaseGui {
@@ -1,7 +1,12 @@
package com.glodblock.github.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.storage.ITerminalHost;
import appeng.core.localization.GuiText;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.base.FCGuiAmount;
import com.glodblock.github.client.gui.container.ContainerPatternValueAmount;
@@ -10,9 +15,6 @@ import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.network.CPacketPatternValueSet;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
public class GuiPatternValueAmount extends FCGuiAmount {
@@ -48,10 +50,11 @@ public class GuiPatternValueAmount extends FCGuiAmount {
super.actionPerformed(btn);
try {
if (btn == this.submit && btn.enabled) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketPatternValueSet(
originalGui.ordinal(),
getAmount(),
((ContainerPatternValueAmount) this.inventorySlots).getValueIndex()));
FluidCraft.proxy.netHandler.sendToServer(
new CPacketPatternValueSet(
originalGui.ordinal(),
getAmount(),
((ContainerPatternValueAmount) this.inventorySlots).getValueIndex()));
}
} catch (final NumberFormatException e) {
this.amountBox.setText("1");
@@ -1,5 +1,10 @@
package com.glodblock.github.client.gui.base;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import appeng.client.gui.AEBaseGui;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.AEBaseContainer;
@@ -7,13 +12,10 @@ import appeng.core.AEConfig;
import appeng.core.localization.GuiText;
import appeng.util.calculators.ArithHelper;
import appeng.util.calculators.Calculator;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.network.CPacketSwitchGuis;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
public abstract class FCGuiAmount extends AEBaseGui {
@@ -61,11 +63,19 @@ public abstract class FCGuiAmount extends AEBaseGui {
if (this.originalGui != null && this.myIcon != null) {
this.buttonList.add(
this.originalGuiBtn = new GuiTabButton(
this.guiLeft + 154, this.guiTop, this.myIcon, this.myIcon.getDisplayName(), itemRender));
this.guiLeft + 154,
this.guiTop,
this.myIcon,
this.myIcon.getDisplayName(),
itemRender));
}
this.amountBox = new GuiTextField(
this.fontRendererObj, this.guiLeft + 62, this.guiTop + 57, 59, this.fontRendererObj.FONT_HEIGHT);
this.fontRendererObj,
this.guiLeft + 62,
this.guiTop + 57,
59,
this.fontRendererObj.FONT_HEIGHT);
this.amountBox.setEnableBackgroundDrawing(false);
this.amountBox.setMaxStringLength(16);
this.amountBox.setTextColor(0xFFFFFF);
@@ -97,8 +107,9 @@ public abstract class FCGuiAmount extends AEBaseGui {
FluidCraft.proxy.netHandler.sendToServer(new CPacketSwitchGuis(this.originalGui));
}
final boolean isPlus = btn == this.plus1 || btn == this.plus10 || btn == this.plus100 || btn == this.plus1000;
final boolean isMinus =
btn == this.minus1 || btn == this.minus10 || btn == this.minus100 || btn == this.minus1000;
final boolean isMinus = btn == this.minus1 || btn == this.minus10
|| btn == this.minus100
|| btn == this.minus1000;
if (isPlus || isMinus) {
this.addQty(this.getQty(btn));
@@ -117,8 +128,7 @@ public abstract class FCGuiAmount extends AEBaseGui {
}
String out = Long.toString(resultI);
this.amountBox.setText(out);
} catch (final NumberFormatException ignore) {
}
} catch (final NumberFormatException ignore) {}
}
protected abstract void setOriginGUI(Object target);
@@ -1,5 +1,11 @@
package com.glodblock.github.client.gui.base;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import org.lwjgl.input.Keyboard;
import appeng.api.storage.ITerminalHost;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.widgets.GuiImgButton;
@@ -9,6 +15,7 @@ import appeng.client.render.AppEngRenderItem;
import appeng.container.slot.AppEngSlot;
import appeng.container.slot.SlotFake;
import appeng.util.item.AEItemStack;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.GuiFCImgButton;
import com.glodblock.github.client.gui.GuiItemMonitor;
@@ -20,10 +27,6 @@ import com.glodblock.github.inventory.slot.SlotSingleItem;
import com.glodblock.github.network.CPacketFluidPatternTermBtns;
import com.glodblock.github.util.Ae2ReflectClient;
import com.glodblock.github.util.ModAndClassUtil;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import org.lwjgl.input.Keyboard;
public abstract class FCGuiEncodeTerminal extends GuiItemMonitor {
@@ -51,8 +54,8 @@ public abstract class FCGuiEncodeTerminal extends GuiItemMonitor {
protected final GuiScrollbar processingScrollBar = new GuiScrollbar();
protected final AppEngRenderItem stackSizeRenderer = Ae2ReflectClient.getStackSizeRenderer(this);
public FCGuiEncodeTerminal(
final InventoryPlayer inventoryPlayer, final ITerminalHost te, final FCContainerEncodeTerminal c) {
public FCGuiEncodeTerminal(final InventoryPlayer inventoryPlayer, final ITerminalHost te,
final FCContainerEncodeTerminal c) {
super(inventoryPlayer, te, c);
this.container = (FCContainerEncodeTerminal) this.inventorySlots;
c.setGui(this);
@@ -65,35 +68,46 @@ public abstract class FCGuiEncodeTerminal extends GuiItemMonitor {
if (btn == craftingStatusBtn) {
InventoryHandler.switchGui(GuiType.CRAFTING_STATUS);
} else if (this.tabCraftButton == btn || this.tabProcessButton == btn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns(
"PatternTerminal.CraftMode", this.tabProcessButton == btn ? MODE_CRAFTING : MODE_PROCESSING));
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidPatternTermBtns(
"PatternTerminal.CraftMode",
this.tabProcessButton == btn ? MODE_CRAFTING : MODE_PROCESSING));
} else if (this.encodeBtn == btn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns(
"PatternTerminal.Encode", (isCtrlKeyDown() ? 1 : 0) << 1 | (isShiftKeyDown() ? 1 : 0)));
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidPatternTermBtns(
"PatternTerminal.Encode",
(isCtrlKeyDown() ? 1 : 0) << 1 | (isShiftKeyDown() ? 1 : 0)));
} else if (this.clearBtn == btn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.Clear", "1"));
} else if (this.substitutionsEnabledBtn == btn || this.substitutionsDisabledBtn == btn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns(
"PatternTerminal.Substitute",
this.substitutionsEnabledBtn == btn ? SUBSTITUTION_DISABLE : SUBSTITUTION_ENABLE));
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidPatternTermBtns(
"PatternTerminal.Substitute",
this.substitutionsEnabledBtn == btn ? SUBSTITUTION_DISABLE : SUBSTITUTION_ENABLE));
} else if (this.fluidPrioritizedEnabledBtn == btn || this.fluidPrioritizedDisabledBtn == btn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns(
"PatternTerminal.Prioritize", container.prioritize ? PRIORITY_DISABLE : PRIORITY_ENABLE));
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidPatternTermBtns(
"PatternTerminal.Prioritize",
container.prioritize ? PRIORITY_DISABLE : PRIORITY_ENABLE));
} else if (this.invertBtn == btn) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidPatternTermBtns("PatternTerminal.Invert", container.inverted ? "0" : "1"));
} else if (this.combineDisableBtn == btn || this.combineEnableBtn == btn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns(
"PatternTerminal.Combine", this.combineDisableBtn == btn ? "1" : "0"));
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidPatternTermBtns(
"PatternTerminal.Combine",
this.combineDisableBtn == btn ? "1" : "0"));
} else if (ModAndClassUtil.isDoubleButton && doubleBtn == btn) {
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns(
"PatternTerminal.Double", Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? "1" : "0"));
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidPatternTermBtns(
"PatternTerminal.Double",
Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) ? "1" : "0"));
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsDisabledBtn == btn) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "1"));
FluidCraft.proxy.netHandler
.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "1"));
} else if (ModAndClassUtil.isBeSubstitutionsButton && beSubstitutionsEnabledBtn == btn) {
FluidCraft.proxy.netHandler.sendToServer(
new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "0"));
FluidCraft.proxy.netHandler
.sendToServer(new CPacketFluidPatternTermBtns("PatternTerminal.beSubstitute", "0"));
}
}
@@ -1,5 +1,20 @@
package com.glodblock.github.client.gui.base;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import appeng.api.config.*;
import appeng.api.implementations.tiles.IViewCellStorage;
import appeng.api.storage.ITerminalHost;
@@ -32,24 +47,13 @@ import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import codechicken.nei.LayoutManager;
import codechicken.nei.util.TextHistory;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.FCGuiTextField;
import com.glodblock.github.client.gui.container.base.FCContainerMonitor;
import com.glodblock.github.network.CPacketInventoryAction;
import com.glodblock.github.util.Ae2ReflectClient;
import com.glodblock.github.util.ModAndClassUtil;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
public abstract class FCGuiMonitor<T extends IAEStack<T>> extends AEBaseMEGui
implements ISortSource, IConfigManagerHost, IDropToFillTextField {
@@ -98,9 +102,10 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends AEBaseMEGui
protected void setScrollBar() {
this.getScrollBar().setTop(18).setLeft(175).setHeight(this.rows * 18 - 2);
this.getScrollBar()
.setRange(
0, (this.repo.size() + this.perRow - 1) / this.perRow - this.rows, Math.max(1, this.rows / 6));
this.getScrollBar().setRange(
0,
(this.repo.size() + this.perRow - 1) / this.perRow - this.rows,
Math.max(1, this.rows / 6));
}
@Override
@@ -114,8 +119,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends AEBaseMEGui
final GuiImgButton iBtn = (GuiImgButton) btn;
if (iBtn.getSetting() != Settings.ACTIONS) {
final Enum<?> cv = iBtn.getCurrentValue();
final Enum<?> next =
Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
final Enum<?> next = Platform.rotateEnum(cv, backwards, iBtn.getSetting().getPossibleValues());
if (btn == this.terminalStyleBox) {
AEConfig.instance.settings.putSetting(iBtn.getSetting(), next);
} else if (btn == this.searchBoxSettings) {
@@ -124,8 +128,8 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends AEBaseMEGui
AEConfig.instance.preserveSearchBar = next == YesNo.YES;
} else {
try {
NetworkHandler.instance.sendToServer(
new PacketValueConfig(iBtn.getSetting().name(), next.name()));
NetworkHandler.instance
.sendToServer(new PacketValueConfig(iBtn.getSetting().name(), next.name()));
} catch (final IOException e) {
AELog.debug(e);
}
@@ -149,8 +153,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends AEBaseMEGui
Keyboard.enableRepeatEvents(true);
this.maxRows = this.getMaxRows();
this.perRow = AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) != TerminalStyle.FULL
? 9
this.perRow = AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) != TerminalStyle.FULL ? 9
: 9 + ((this.width - this.standardSize) / 18);
final boolean hasNEI = IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.NEI);
@@ -202,7 +205,10 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends AEBaseMEGui
if (this.customSortOrder) {
this.buttonList.add(
this.SortByBox = new GuiImgButton(
this.guiLeft - 18, offset, Settings.SORT_BY, this.configSrc.getSetting(Settings.SORT_BY)));
this.guiLeft - 18,
offset,
Settings.SORT_BY,
this.configSrc.getSetting(Settings.SORT_BY)));
offset += 20;
}
if (this.showViewBtn) {
@@ -250,7 +256,11 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends AEBaseMEGui
offset += 20;
this.searchField = new FCGuiTextField(
this.fontRendererObj, this.guiLeft + Math.max(80, this.offsetX), this.guiTop + 4, 90, 12);
this.fontRendererObj,
this.guiLeft + Math.max(80, this.offsetX),
this.guiTop + 4,
90,
12);
this.searchField.setEnableBackgroundDrawing(false);
this.searchField.setMaxStringLength(25);
this.searchField.setTextColor(0xFFFFFF);
@@ -259,11 +269,8 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends AEBaseMEGui
searchField.setMessage(ButtonToolTips.SearchStringTooltip.getLocal());
if (this.viewCell) {
if (ModAndClassUtil.isCraftStatus
&& AEConfig.instance
.getConfigManager()
.getSetting(Settings.CRAFTING_STATUS)
.equals(CraftingStatus.BUTTON)) {
if (ModAndClassUtil.isCraftStatus && AEConfig.instance.getConfigManager()
.getSetting(Settings.CRAFTING_STATUS).equals(CraftingStatus.BUTTON)) {
this.buttonList.add(
this.craftingStatusImgBtn = new GuiImgButton(
this.guiLeft - 18,
@@ -356,15 +363,12 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends AEBaseMEGui
} else {
direction = TextHistory.Direction.NEXT;
}
history.get(direction, this.searchField.getText())
.map(newText -> {
setSearchString(newText, true);
return true;
})
.orElse(false);
history.get(direction, this.searchField.getText()).map(newText -> {
setSearchString(newText, true);
return true;
}).orElse(false);
return;
} catch (NoSuchFieldException | IllegalAccessException ignore) {
}
} catch (NoSuchFieldException | IllegalAccessException ignore) {}
}
}
super.handleMouseInput();
@@ -391,8 +395,8 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends AEBaseMEGui
}
if (slot instanceof SlotFake) {
InventoryAction action =
ctrlDown == 1 ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
InventoryAction action = ctrlDown == 1 ? InventoryAction.SPLIT_OR_PLACE_SINGLE
: InventoryAction.PICKUP_OR_SET_DOWN;
if (Keyboard.isKeyDown(Keyboard.KEY_LMENU) || Keyboard.isKeyDown(Keyboard.KEY_RMENU)) {
if (action == InventoryAction.SPLIT_OR_PLACE_SINGLE) {
action = InventoryAction.MOVE_REGION;
@@ -457,13 +461,12 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends AEBaseMEGui
InventoryAction action = null;
switch (mouseButton) {
case 0: // pickup / set-down.
{
ItemStack heldStack = player.inventory.getItemStack();
if (slot.getStack() == null && heldStack != null)
action = InventoryAction.SPLIT_OR_PLACE_SINGLE;
else if (slot.getStack() != null && (heldStack == null || heldStack.stackSize <= 1))
action = InventoryAction.PICKUP_OR_SET_DOWN;
}
{
ItemStack heldStack = player.inventory.getItemStack();
if (slot.getStack() == null && heldStack != null) action = InventoryAction.SPLIT_OR_PLACE_SINGLE;
else if (slot.getStack() != null && (heldStack == null || heldStack.stackSize <= 1))
action = InventoryAction.PICKUP_OR_SET_DOWN;
}
break;
case 1:
action = ctrlDown == 1 ? InventoryAction.PICKUP_SINGLE : InventoryAction.SHIFT_CLICK;
@@ -494,8 +497,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends AEBaseMEGui
case 0: // pickup / set-down.
action = ctrlDown == 1 ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
stack = ((SlotME) slot).getAEStack();
if (stack != null
&& action == InventoryAction.PICKUP_OR_SET_DOWN
if (stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN
&& stack.getStackSize() == 0
&& player.inventory.getItemStack() == null) {
action = InventoryAction.AUTO_CRAFT;
@@ -523,12 +525,14 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends AEBaseMEGui
}
if (action == InventoryAction.AUTO_CRAFT) {
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
FluidCraft.proxy.netHandler.sendToServer(new CPacketInventoryAction(
action, Ae2ReflectClient.getInventorySlots(this).size(), 0, stack));
FluidCraft.proxy.netHandler.sendToServer(
new CPacketInventoryAction(action, Ae2ReflectClient.getInventorySlots(this).size(), 0, stack));
} else if (action != null) {
((AEBaseContainer) this.inventorySlots).setTargetStack(stack);
final PacketInventoryAction p = new PacketInventoryAction(
action, Ae2ReflectClient.getInventorySlots(this).size(), 0);
action,
Ae2ReflectClient.getInventorySlots(this).size(),
0);
NetworkHandler.instance.sendToServer(p);
}
@@ -575,11 +579,9 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends AEBaseMEGui
if (this.viewCell) {
boolean update = false;
for (int i = 0; i < 5; i++) {
if (this.myCurrentViewCells[i]
!= this.monitorableContainer.getCellViewSlot(i).getStack()) {
if (this.myCurrentViewCells[i] != this.monitorableContainer.getCellViewSlot(i).getStack()) {
update = true;
this.myCurrentViewCells[i] =
this.monitorableContainer.getCellViewSlot(i).getStack();
this.myCurrentViewCells[i] = this.monitorableContainer.getCellViewSlot(i).getStack();
}
}
if (update) {
@@ -601,8 +603,7 @@ public abstract class FCGuiMonitor<T extends IAEStack<T>> extends AEBaseMEGui
}
protected int getMaxRows() {
return AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) == TerminalStyle.SMALL
? 6
return AEConfig.instance.getConfigManager().getSetting(Settings.TERMINAL_STYLE) == TerminalStyle.SMALL ? 6
: Integer.MAX_VALUE;
}
@@ -1,13 +1,15 @@
package com.glodblock.github.client.gui.container;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.config.Settings;
import appeng.api.config.SidelessMode;
import appeng.api.util.IConfigManager;
import appeng.container.guisync.GuiSync;
import appeng.container.implementations.ContainerInterface;
import appeng.helpers.IInterfaceHost;
import com.glodblock.github.common.tile.TileFluidInterface;
import net.minecraft.entity.player.InventoryPlayer;
public class ContainerDualInterface extends ContainerInterface {
@@ -1,5 +1,19 @@
package com.glodblock.github.client.gui.container;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Objects;
import java.util.concurrent.Future;
import javax.annotation.Nonnull;
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.util.ChatComponentText;
import net.minecraft.world.World;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.SecurityPermissions;
@@ -21,6 +35,7 @@ import appeng.container.guisync.GuiSync;
import appeng.container.implementations.CraftingCPURecord;
import appeng.core.AELog;
import appeng.util.Platform;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.parts.PartFluidPatternTerminal;
import com.glodblock.github.common.parts.PartFluidPatternTerminalEx;
@@ -30,17 +45,6 @@ import com.glodblock.github.network.SPacketMEInventoryUpdate;
import com.glodblock.github.util.Ae2Reflect;
import com.glodblock.github.util.BlockPos;
import com.google.common.collect.ImmutableSet;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Objects;
import java.util.concurrent.Future;
import javax.annotation.Nonnull;
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.util.ChatComponentText;
import net.minecraft.world.World;
public class ContainerFluidCraftConfirm extends AEBaseContainer {
@@ -162,8 +166,8 @@ public class ContainerFluidCraftConfirm extends AEBaseContainer {
final SPacketMEInventoryUpdate a = new SPacketMEInventoryUpdate((byte) 0);
final SPacketMEInventoryUpdate b = new SPacketMEInventoryUpdate((byte) 1);
final SPacketMEInventoryUpdate c =
this.result.isSimulation() ? new SPacketMEInventoryUpdate((byte) 2) : null;
final SPacketMEInventoryUpdate c = this.result.isSimulation() ? new SPacketMEInventoryUpdate((byte) 2)
: null;
final IItemList<IAEItemStack> plan = AEApi.instance().storage().createItemList();
this.result.populatePlan(plan);
@@ -1,16 +1,19 @@
package com.glodblock.github.client.gui.container;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.config.Settings;
import appeng.api.config.YesNo;
import appeng.api.util.IConfigManager;
import appeng.tile.inventory.AppEngInternalAEInventory;
import com.glodblock.github.client.gui.container.base.FCContainerFluidConfigurable;
import com.glodblock.github.common.parts.PartFluidExportBus;
import com.glodblock.github.common.parts.base.FCSharedFluidBus;
import com.glodblock.github.util.Ae2Reflect;
import net.minecraft.entity.player.InventoryPlayer;
public class ContainerFluidIO extends FCContainerFluidConfigurable {
private final FCSharedFluidBus bus;
public ContainerFluidIO(InventoryPlayer ip, FCSharedFluidBus te) {
@@ -1,20 +1,23 @@
package com.glodblock.github.client.gui.container;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import appeng.api.storage.data.IAEFluidStack;
import appeng.container.AEBaseContainer;
import appeng.container.slot.IOptionalSlotHost;
import appeng.util.item.AEFluidStack;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.inventory.IDualHost;
import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
import com.glodblock.github.network.SPacketFluidUpdate;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
public class ContainerFluidInterface extends AEBaseContainer implements IOptionalSlotHost {
@@ -27,8 +30,8 @@ public class ContainerFluidInterface extends AEBaseContainer implements IOptiona
final int y = 35;
final int x = 35;
for (int i = 0; i < 6; i++) {
addSlotToContainer(new OptionalFluidSlotFakeTypeOnly(
inv, tile.getDualityFluid().getConfig(), this, i, x, y, i, 0, 0));
addSlotToContainer(
new OptionalFluidSlotFakeTypeOnly(inv, tile.getDualityFluid().getConfig(), this, i, x, y, i, 0, 0));
}
bindPlayerInventory(ipl, 0, 149);
}
@@ -50,10 +53,7 @@ public class ContainerFluidInterface extends AEBaseContainer implements IOptiona
tmp.put(i, tile.getInternalFluid().getFluidInSlot(i));
}
for (int i = 0; i < tile.getConfig().getSizeInventory(); i++) {
tmp.put(
i + 100,
AEFluidStack.create(
ItemFluidPacket.getFluidStack(tile.getConfig().getStackInSlot(i))));
tmp.put(i + 100, AEFluidStack.create(ItemFluidPacket.getFluidStack(tile.getConfig().getStackInSlot(i))));
}
for (final Object g : this.crafters) {
if (g instanceof EntityPlayer) {
@@ -1,22 +1,26 @@
package com.glodblock.github.client.gui.container;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import appeng.api.config.*;
import appeng.api.implementations.IUpgradeableHost;
import appeng.container.guisync.GuiSync;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.util.Platform;
import com.glodblock.github.client.gui.container.base.FCContainerFluidConfigurable;
import com.glodblock.github.common.parts.PartFluidLevelEmitter;
import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
import com.glodblock.github.util.Ae2Reflect;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
public class ContainerFluidLevelEmitter extends FCContainerFluidConfigurable {
private final PartFluidLevelEmitter lvlEmitter;
@SideOnly(Side.CLIENT)
@@ -81,8 +85,9 @@ public class ContainerFluidLevelEmitter extends FCContainerFluidConfigurable {
if (Platform.isServer()) {
this.EmitterValue = this.lvlEmitter.getReportingValue();
this.setRedStoneMode((RedstoneMode)
Ae2Reflect.getUpgradeableHost(this).getConfigManager().getSetting(Settings.REDSTONE_EMITTER));
this.setRedStoneMode(
(RedstoneMode) Ae2Reflect.getUpgradeableHost(this).getConfigManager()
.getSetting(Settings.REDSTONE_EMITTER));
}
this.standardDetectAndSendChanges();
@@ -1,5 +1,21 @@
package com.glodblock.github.client.gui.container;
import java.nio.BufferOverflowException;
import java.util.HashMap;
import java.util.Map;
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.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.IFluidContainerItem;
import org.apache.commons.lang3.tuple.MutablePair;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.implementations.guiobjects.IPortableCell;
@@ -22,6 +38,7 @@ import appeng.me.helpers.ChannelPowerSrc;
import appeng.util.Platform;
import appeng.util.item.AEFluidStack;
import appeng.util.item.AEItemStack;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.base.FCContainerMonitor;
import com.glodblock.github.common.item.ItemFluidDrop;
@@ -30,29 +47,17 @@ import com.glodblock.github.network.CPacketFluidUpdate;
import com.glodblock.github.network.SPacketFluidUpdate;
import com.glodblock.github.network.SPacketMEInventoryUpdate;
import com.glodblock.github.util.Util;
import java.nio.BufferOverflowException;
import java.util.HashMap;
import java.util.Map;
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.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.IFluidContainerItem;
import org.apache.commons.lang3.tuple.MutablePair;
public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
private final IItemList<IAEFluidStack> fluids = AEApi.instance().storage().createFluidList();
public ContainerFluidMonitor(final InventoryPlayer ip, final ITerminalHost monitorable) {
this(ip, monitorable, true);
}
protected ContainerFluidMonitor(
final InventoryPlayer ip, final ITerminalHost monitorable, final boolean bindInventory) {
protected ContainerFluidMonitor(final InventoryPlayer ip, final ITerminalHost monitorable,
final boolean bindInventory) {
super(ip, monitorable, bindInventory);
if (Platform.isServer()) {
this.serverCM = monitorable.getConfigManager();
@@ -106,8 +111,7 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
public ItemStack transferStackInSlot(final EntityPlayer p, final int idx) {
if (Platform.isClient()) {
Slot clickSlot = (Slot) this.inventorySlots.get(idx);
if ((clickSlot instanceof SlotPlayerInv || clickSlot instanceof SlotPlayerHotBar)
&& clickSlot.getHasStack()
if ((clickSlot instanceof SlotPlayerInv || clickSlot instanceof SlotPlayerHotBar) && clickSlot.getHasStack()
&& Util.FluidUtil.isFluidContainer(clickSlot.getStack())) {
ItemStack tis = clickSlot.getStack();
Map<Integer, IAEFluidStack> tmp = new HashMap<>();
@@ -172,8 +176,8 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
}
@Override
public void postChange(
IBaseMonitor<IAEFluidStack> monitor, Iterable<IAEFluidStack> change, BaseActionSource actionSource) {
public void postChange(IBaseMonitor<IAEFluidStack> monitor, Iterable<IAEFluidStack> change,
BaseActionSource actionSource) {
for (final IAEFluidStack is : change) {
this.fluids.add(is);
}
@@ -207,8 +211,8 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
this.dropItem(is);
}
public void postChange(
Iterable<IAEFluidStack> change, ItemStack fluidContainer, EntityPlayer player, int slotIndex) {
public void postChange(Iterable<IAEFluidStack> change, ItemStack fluidContainer, EntityPlayer player,
int slotIndex) {
for (IAEFluidStack fluid : change) {
IAEFluidStack nfluid = this.monitor.getStorageList().findPrecise(fluid);
ItemStack out = fluidContainer.copy();
@@ -220,8 +224,7 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
MutablePair<Integer, ItemStack> fillStack = Util.FluidUtil.fillStack(out, toExtract.getFluidStack());
if (fillStack.right == null || fillStack.left <= 0) continue;
toExtract.setStackSize((long) fillStack.left * fluidContainer.stackSize);
IAEFluidStack tmp = this.host
.getFluidInventory()
IAEFluidStack tmp = this.host.getFluidInventory()
.extractItems(toExtract, Actionable.SIMULATE, this.getActionSource());
if (tmp == null) continue;
fillStack.right.stackSize = (int) (tmp.getStackSize() / fillStack.left);
@@ -232,7 +235,8 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
if ((int) (tmp.getStackSize() % fillStack.left) > 0) {
this.dropItem(
Util.FluidUtil.setFluidContainerAmount(
fillStack.right, (int) (tmp.getStackSize() % fillStack.left)),
fillStack.right,
(int) (tmp.getStackSize() % fillStack.left)),
1);
out.stackSize++;
}
@@ -245,11 +249,10 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
AEFluidStack fluidStack = Util.getAEFluidFromItem(fluidContainer);
final IAEFluidStack aeFluidStack = fluidStack.copy();
// simulate result is incorrect. so I'm using other solution and ec2 both mod have same issues
final IAEFluidStack notInserted = this.host
.getFluidInventory()
final IAEFluidStack notInserted = this.host.getFluidInventory()
.injectItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
MutablePair<Integer, ItemStack> drainStack =
Util.FluidUtil.drainStack(out.copy(), aeFluidStack.getFluidStack());
MutablePair<Integer, ItemStack> drainStack = Util.FluidUtil
.drainStack(out.copy(), aeFluidStack.getFluidStack());
if (notInserted != null && notInserted.getStackSize() > 0) {
if (fluidStack.getStackSize() == notInserted.getStackSize()) continue;
aeFluidStack.decStackSize(notInserted.getStackSize());
@@ -257,14 +260,14 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
if (drainStack.left > aeFluidStack.getStackSize()
&& FluidContainerRegistry.isContainer(drainStack.right)) {
aeFluidStack.setStackSize(drainStack.left - aeFluidStack.getStackSize());
this.host
.getFluidInventory()
this.host.getFluidInventory()
.extractItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
continue;
}
this.dropItem(
drainStack.right, (int) (aeFluidStack.getStackSize() / drainStack.left)); // drop empty item
this.dropItem(drainStack.right, (int) (aeFluidStack.getStackSize() / drainStack.left)); // drop
// empty
// item
out.stackSize = (int) (notInserted.getStackSize() / drainStack.left);
if (drainStack.right.getItem() instanceof IFluidContainerItem) {
if (notInserted.getStackSize() % drainStack.left > 0) {
@@ -276,8 +279,7 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
} else if (FluidContainerRegistry.isContainer(drainStack.right)) {
if (notInserted.getStackSize() % drainStack.left > 0) {
aeFluidStack.setStackSize(aeFluidStack.getStackSize() % drainStack.left);
this.host
.getFluidInventory()
this.host.getFluidInventory()
.extractItems(aeFluidStack, Actionable.MODULATE, this.getActionSource());
out.stackSize++;
}
@@ -287,8 +289,8 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
if (slotIndex == -1) {
out.stackSize = fluidContainer.stackSize;
} else {
out.stackSize =
(int) (fluidContainer.stackSize - (aeFluidStack.getStackSize() / drainStack.left));
out.stackSize = (int) (fluidContainer.stackSize
- (aeFluidStack.getStackSize() / drainStack.left));
}
this.dropItem(drainStack.right, fluidContainer.stackSize); // drop empty item
}
@@ -303,8 +305,8 @@ public class ContainerFluidMonitor extends FCContainerMonitor<IAEFluidStack> {
(EntityPlayerMP) player);
} else {
player.inventory.setItemStack(null);
FluidCraft.proxy.netHandler.sendTo(
new SPacketFluidUpdate(new HashMap<>()), (EntityPlayerMP) player);
FluidCraft.proxy.netHandler
.sendTo(new SPacketFluidUpdate(new HashMap<>()), (EntityPlayerMP) player);
}
} else {
player.inventory.setInventorySlotContents(slotIndex, out.stackSize > 0 ? out : null);
@@ -2,10 +2,12 @@ package com.glodblock.github.client.gui.container;
import static com.glodblock.github.loader.ItemAndBlockHolder.PACKET;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.container.AEBaseContainer;
import com.glodblock.github.common.tile.TileFluidPacketDecoder;
import com.glodblock.github.inventory.slot.FCSlotRestrictedInput;
import net.minecraft.entity.player.InventoryPlayer;
public class ContainerFluidPacketDecoder extends AEBaseContainer {
@@ -1,10 +1,20 @@
package com.glodblock.github.client.gui.container;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
import appeng.api.storage.data.IAEItemStack;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotRestrictedInput;
import appeng.helpers.InventoryAction;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.item.ItemFluidEncodedPattern;
import com.glodblock.github.common.item.ItemFluidPacket;
@@ -16,13 +26,6 @@ import com.glodblock.github.inventory.slot.SlotFluidConvertingFake;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.FluidPatternDetails;
import com.glodblock.github.util.Util;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPatternConsumer {
@@ -39,10 +42,22 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPa
}
addSlotToContainer(new SlotFluidConvertingFake(output, y, 113, 17 + y * 18));
}
addSlotToContainer(new SlotRestrictedInput(
SlotRestrictedInput.PlacableItemType.BLANK_PATTERN, tile.getInventory(), 0, 138, 20, ipl));
addSlotToContainer(new SlotRestrictedInput(
SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, tile.getInventory(), 1, 138, 50, ipl));
addSlotToContainer(
new SlotRestrictedInput(
SlotRestrictedInput.PlacableItemType.BLANK_PATTERN,
tile.getInventory(),
0,
138,
20,
ipl));
addSlotToContainer(
new SlotRestrictedInput(
SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN,
tile.getInventory(),
1,
138,
50,
ipl));
bindPlayerInventory(ipl, 0, 84);
}
@@ -51,9 +66,8 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPa
}
private static boolean isNotPattern(ItemStack stack) {
return stack == null
|| !(AEApi.instance().definitions().materials().blankPattern().isSameAs(stack)
|| (stack.getItem() instanceof ItemFluidEncodedPattern));
return stack == null || !(AEApi.instance().definitions().materials().blankPattern().isSameAs(stack)
|| (stack.getItem() instanceof ItemFluidEncodedPattern));
}
public boolean canEncodePattern() {
@@ -61,8 +75,7 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPa
&& isNotPattern(tile.getInventory().getStackInSlot(1))) {
return false;
}
find_input:
{
find_input: {
for (IAEItemStack stack : tile.getCraftingSlots()) {
if (stack != null && stack.getStackSize() > 0) {
break find_input;
@@ -136,8 +149,10 @@ public class ContainerFluidPatternEncoder extends AEBaseContainer implements IPa
if (stack == null) {
slot.putStack(Util.copyStackWithSize(inSlot, Math.max(1, inSlot.stackSize - 1)));
} else if (stack.isItemEqual(inSlot)) {
slot.putStack(Util.copyStackWithSize(
inSlot, Math.min(inSlot.getMaxStackSize(), inSlot.stackSize + 1)));
slot.putStack(
Util.copyStackWithSize(
inSlot,
Math.min(inSlot.getMaxStackSize(), inSlot.stackSize + 1)));
} else {
((SlotFluidConvertingFake) slot)
.putConvertedStack(Objects.requireNonNull(Util.copyStackWithSize(stack, 1)));
@@ -1,18 +1,20 @@
package com.glodblock.github.client.gui.container;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import appeng.api.storage.ITerminalHost;
import appeng.container.slot.OptionalSlotFake;
import appeng.container.slot.SlotFakeCraftingMatrix;
import appeng.container.slot.SlotPatternOutputs;
import appeng.container.slot.SlotPatternTerm;
import appeng.util.Platform;
import com.glodblock.github.client.gui.container.base.FCContainerEncodeTerminal;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
public class ContainerFluidPatternTerminal extends FCContainerEncodeTerminal {
@@ -25,8 +27,11 @@ public class ContainerFluidPatternTerminal extends FCContainerEncodeTerminal {
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 3; x++) {
this.addSlotToContainer(
this.craftingSlots[x + y * 3] =
new SlotFakeCraftingMatrix(this.crafting, x + y * 3, 18 + x * 18, -76 + y * 18));
this.craftingSlots[x + y * 3] = new SlotFakeCraftingMatrix(
this.crafting,
x + y * 3,
18 + x * 18,
-76 + y * 18));
}
}
@@ -101,7 +106,7 @@ public class ContainerFluidPatternTerminal extends FCContainerEncodeTerminal {
if (this.isCraftingMode()) {
final ItemStack out = this.getAndUpdateOutput();
if (out != null && out.stackSize > 0) {
return new ItemStack[] {out};
return new ItemStack[] { out };
}
}
return super.getOutputs();
@@ -1,15 +1,17 @@
package com.glodblock.github.client.gui.container;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import appeng.api.storage.ITerminalHost;
import appeng.container.slot.IOptionalSlotHost;
import appeng.container.slot.OptionalSlotFake;
import appeng.helpers.InventoryAction;
import appeng.util.Platform;
import com.glodblock.github.client.gui.container.base.FCContainerEncodeTerminal;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
public class ContainerFluidPatternTerminalEx extends FCContainerEncodeTerminal {
@@ -27,8 +29,8 @@ public class ContainerFluidPatternTerminalEx extends FCContainerEncodeTerminal {
for (int y = 0; y < CRAFTING_GRID_HEIGHT; y++) {
for (int x = 0; x < CRAFTING_GRID_WIDTH; x++) {
this.addSlotToContainer(
this.craftingSlots[x + y * CRAFTING_GRID_WIDTH + page * CRAFTING_GRID_SLOTS] =
new ProcessingSlotFake(
this.craftingSlots[x + y * CRAFTING_GRID_WIDTH
+ page * CRAFTING_GRID_SLOTS] = new ProcessingSlotFake(
crafting,
this,
x + y * CRAFTING_GRID_WIDTH + page * CRAFTING_GRID_SLOTS,
@@ -42,8 +44,8 @@ public class ContainerFluidPatternTerminalEx extends FCContainerEncodeTerminal {
for (int x = 0; x < CRAFTING_GRID_WIDTH; x++) {
for (int y = 0; y < CRAFTING_GRID_HEIGHT; y++) {
this.addSlotToContainer(
this.outputSlots[x * CRAFTING_GRID_HEIGHT + y + page * CRAFTING_GRID_SLOTS] =
new ProcessingSlotFake(
this.outputSlots[x * CRAFTING_GRID_HEIGHT + y
+ page * CRAFTING_GRID_SLOTS] = new ProcessingSlotFake(
output,
this,
x * CRAFTING_GRID_HEIGHT + y + page * CRAFTING_GRID_SLOTS,
@@ -135,15 +137,8 @@ public class ContainerFluidPatternTerminalEx extends FCContainerEncodeTerminal {
private static final int POSITION_SHIFT = 9000;
private boolean hidden = false;
public ProcessingSlotFake(
IInventory inv,
IOptionalSlotHost containerBus,
int idx,
int x,
int y,
int offX,
int offY,
int groupNum) {
public ProcessingSlotFake(IInventory inv, IOptionalSlotHost containerBus, int idx, int x, int y, int offX,
int offY, int groupNum) {
super(inv, containerBus, idx, x, y, offX, offY, groupNum);
this.setRenderDisabled(false);
}
@@ -1,11 +1,13 @@
package com.glodblock.github.client.gui.container;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
import appeng.util.Platform;
import com.glodblock.github.inventory.item.IFluidPortableCell;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
public class ContainerFluidPortableCell extends ContainerFluidMonitor {
@@ -30,8 +32,7 @@ public class ContainerFluidPortableCell extends ContainerFluidMonitor {
@Override
public void detectAndSendChanges() {
final ItemStack currentItem = this.slot < 0
? this.getPlayerInv().getCurrentItem()
final ItemStack currentItem = this.slot < 0 ? this.getPlayerInv().getCurrentItem()
: this.getPlayerInv().getStackInSlot(this.slot);
if (this.civ != null) {
if (currentItem != this.civ.getItemStack()) {
@@ -52,7 +53,9 @@ public class ContainerFluidPortableCell extends ContainerFluidMonitor {
this.ticks++;
if (this.ticks > 10 && this.civ != null) {
this.civ.extractAEPower(
this.getPowerMultiplier() * this.ticks, Actionable.MODULATE, PowerMultiplier.CONFIG);
this.getPowerMultiplier() * this.ticks,
Actionable.MODULATE,
PowerMultiplier.CONFIG);
this.ticks = 0;
}
super.detectAndSendChanges();
@@ -1,5 +1,10 @@
package com.glodblock.github.client.gui.container;
import java.util.Iterator;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import appeng.api.AEApi;
import appeng.api.config.*;
import appeng.api.storage.IMEInventory;
@@ -10,14 +15,12 @@ import appeng.container.slot.SlotRestrictedInput;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.util.Platform;
import appeng.util.iterators.NullIterator;
import com.glodblock.github.client.gui.container.base.FCContainerFluidConfigurable;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.common.parts.PartFluidStorageBus;
import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
import com.glodblock.github.util.Ae2Reflect;
import java.util.Iterator;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
public class ContainerFluidStorageBus extends FCContainerFluidConfigurable {
@@ -51,41 +54,46 @@ public class ContainerFluidStorageBus extends FCContainerFluidConfigurable {
new OptionalFluidSlotFakeTypeOnly(config, null, this, y * 9 + x, xo, yo, x, y, y));
}
}
this.addSlotToContainer((new SlotRestrictedInput(
SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer()))
.setNotDraggable());
this.addSlotToContainer((new SlotRestrictedInput(
this.addSlotToContainer(
(new SlotRestrictedInput(
SlotRestrictedInput.PlacableItemType.UPGRADES,
upgrades,
0,
187,
8,
this.getInventoryPlayer())).setNotDraggable());
this.addSlotToContainer(
(new SlotRestrictedInput(
SlotRestrictedInput.PlacableItemType.UPGRADES,
upgrades,
1,
187,
8 + 18,
this.getInventoryPlayer()))
.setNotDraggable());
this.addSlotToContainer((new SlotRestrictedInput(
this.getInventoryPlayer())).setNotDraggable());
this.addSlotToContainer(
(new SlotRestrictedInput(
SlotRestrictedInput.PlacableItemType.UPGRADES,
upgrades,
2,
187,
8 + 18 * 2,
this.getInventoryPlayer()))
.setNotDraggable());
this.addSlotToContainer((new SlotRestrictedInput(
this.getInventoryPlayer())).setNotDraggable());
this.addSlotToContainer(
(new SlotRestrictedInput(
SlotRestrictedInput.PlacableItemType.UPGRADES,
upgrades,
3,
187,
8 + 18 * 3,
this.getInventoryPlayer()))
.setNotDraggable());
this.addSlotToContainer((new SlotRestrictedInput(
this.getInventoryPlayer())).setNotDraggable());
this.addSlotToContainer(
(new SlotRestrictedInput(
SlotRestrictedInput.PlacableItemType.UPGRADES,
upgrades,
4,
187,
8 + 18 * 4,
this.getInventoryPlayer()))
.setNotDraggable());
this.getInventoryPlayer())).setNotDraggable());
}
@Override
@@ -113,10 +121,11 @@ public class ContainerFluidStorageBus extends FCContainerFluidConfigurable {
this.verifyPermissions(SecurityPermissions.BUILD, false);
if (Platform.isServer()) {
this.setReadWriteMode((AccessRestriction)
Ae2Reflect.getUpgradeList(this).getConfigManager().getSetting(Settings.ACCESS));
this.setStorageFilter((StorageFilter)
Ae2Reflect.getUpgradeList(this).getConfigManager().getSetting(Settings.STORAGE_FILTER));
this.setReadWriteMode(
(AccessRestriction) Ae2Reflect.getUpgradeList(this).getConfigManager().getSetting(Settings.ACCESS));
this.setStorageFilter(
(StorageFilter) Ae2Reflect.getUpgradeList(this).getConfigManager()
.getSetting(Settings.STORAGE_FILTER));
}
this.standardDetectAndSendChanges();
@@ -142,8 +151,8 @@ public class ContainerFluidStorageBus extends FCContainerFluidConfigurable {
final IMEInventory<IAEFluidStack> cellInv = this.bus.getInternalHandler();
Iterator<IAEFluidStack> i = new NullIterator<>();
if (cellInv != null) {
final IItemList<IAEFluidStack> list =
cellInv.getAvailableItems(AEApi.instance().storage().createFluidList());
final IItemList<IAEFluidStack> list = cellInv
.getAvailableItems(AEApi.instance().storage().createFluidList());
i = list.iterator();
}
@@ -1,19 +1,22 @@
package com.glodblock.github.client.gui.container;
import appeng.api.storage.data.IAEFluidStack;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotNormal;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.ITankDump;
import com.glodblock.github.common.tile.TileIngredientBuffer;
import com.glodblock.github.network.SPacketFluidUpdate;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import appeng.api.storage.data.IAEFluidStack;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotNormal;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.ITankDump;
import com.glodblock.github.common.tile.TileIngredientBuffer;
import com.glodblock.github.network.SPacketFluidUpdate;
public class ContainerIngredientBuffer extends AEBaseContainer implements ITankDump {
private final TileIngredientBuffer tile;
@@ -1,5 +1,13 @@
package com.glodblock.github.client.gui.container;
import java.nio.BufferOverflowException;
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.minecraftforge.common.util.ForgeDirection;
import appeng.api.AEApi;
import appeng.api.implementations.guiobjects.IPortableCell;
import appeng.api.implementations.tiles.IMEChest;
@@ -17,25 +25,21 @@ import appeng.api.storage.data.IItemList;
import appeng.container.slot.SlotRestrictedInput;
import appeng.me.helpers.ChannelPowerSrc;
import appeng.util.Platform;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.client.gui.container.base.FCContainerMonitor;
import com.glodblock.github.network.SPacketMEInventoryUpdate;
import java.nio.BufferOverflowException;
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.minecraftforge.common.util.ForgeDirection;
public class ContainerItemMonitor extends FCContainerMonitor<IAEItemStack> {
private final IItemList<IAEItemStack> items = AEApi.instance().storage().createItemList();
public ContainerItemMonitor(final InventoryPlayer ip, final ITerminalHost monitorable) {
this(ip, monitorable, true);
}
protected ContainerItemMonitor(
final InventoryPlayer ip, final ITerminalHost monitorable, final boolean bindInventory) {
protected ContainerItemMonitor(final InventoryPlayer ip, final ITerminalHost monitorable,
final boolean bindInventory) {
super(ip, monitorable, bindInventory);
if (Platform.isServer()) {
this.serverCM = monitorable.getConfigManager();
@@ -140,9 +144,7 @@ public class ContainerItemMonitor extends FCContainerMonitor<IAEItemStack> {
}
@Override
public void postChange(
final IBaseMonitor<IAEItemStack> monitor,
final Iterable<IAEItemStack> change,
public void postChange(final IBaseMonitor<IAEItemStack> monitor, final Iterable<IAEItemStack> change,
final BaseActionSource source) {
for (final IAEItemStack is : change) {
this.items.add(is);
@@ -1,10 +1,12 @@
package com.glodblock.github.client.gui.container;
import appeng.container.slot.SlotNormal;
import com.glodblock.github.common.tile.TileLargeIngredientBuffer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import appeng.container.slot.SlotNormal;
import com.glodblock.github.common.tile.TileLargeIngredientBuffer;
public class ContainerLargeIngredientBuffer extends ContainerIngredientBuffer {
public ContainerLargeIngredientBuffer(InventoryPlayer ipl, TileLargeIngredientBuffer tile) {
@@ -1,16 +1,19 @@
package com.glodblock.github.client.gui.container;
import appeng.container.AEBaseContainer;
import appeng.util.item.AEItemStack;
import com.glodblock.github.common.tile.TileLevelMaintainer;
import com.glodblock.github.inventory.AeItemStackHandler;
import com.glodblock.github.inventory.slot.SlotFluidConvertingFake;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import appeng.container.AEBaseContainer;
import appeng.util.item.AEItemStack;
import com.glodblock.github.common.tile.TileLevelMaintainer;
import com.glodblock.github.inventory.AeItemStackHandler;
import com.glodblock.github.inventory.slot.SlotFluidConvertingFake;
public class ContainerLevelMaintainer extends AEBaseContainer {
private final TileLevelMaintainer tile;
private final SlotFluidConvertingFake[] requestSlots = new SlotFluidConvertingFake[TileLevelMaintainer.REQ_COUNT];
@@ -1,9 +1,11 @@
package com.glodblock.github.client.gui.container;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotRestrictedInput;
import com.glodblock.github.common.tile.TileOCPatternEditor;
import net.minecraft.entity.player.InventoryPlayer;
public class ContainerOCPatternEditor extends AEBaseContainer {
@@ -11,13 +13,14 @@ public class ContainerOCPatternEditor extends AEBaseContainer {
super(ipl, tile);
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
addSlotToContainer(new SlotRestrictedInput(
SlotRestrictedInput.PlacableItemType.PATTERN,
tile.getInternalInventory(),
j * 4 + i,
55 + i * 18,
17 + j * 18,
ipl));
addSlotToContainer(
new SlotRestrictedInput(
SlotRestrictedInput.PlacableItemType.PATTERN,
tile.getInternalInventory(),
j * 4 + i,
55 + i * 18,
17 + j * 18,
ipl));
}
}
bindPlayerInventory(ipl, 0, 104);
@@ -1,13 +1,14 @@
package com.glodblock.github.client.gui.container;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import appeng.api.config.SecurityPermissions;
import appeng.api.storage.ITerminalHost;
import appeng.container.AEBaseContainer;
import appeng.container.guisync.GuiSync;
import appeng.container.slot.SlotInaccessible;
import appeng.tile.inventory.AppEngInternalInventory;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
public class ContainerPatternValueAmount extends AEBaseContainer {
@@ -1,5 +1,22 @@
package com.glodblock.github.client.gui.container.base;
import java.util.*;
import java.util.stream.Collectors;
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 net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
import appeng.api.AEApi;
import appeng.api.definitions.IDefinitions;
import appeng.api.storage.ITerminalHost;
@@ -14,6 +31,7 @@ import appeng.tile.inventory.IAEAppEngInventory;
import appeng.tile.inventory.InvOperation;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import com.glodblock.github.client.gui.container.ContainerItemMonitor;
import com.glodblock.github.common.item.ItemFluidDrop;
import com.glodblock.github.common.item.ItemFluidEncodedPattern;
@@ -23,21 +41,6 @@ import com.glodblock.github.inventory.IPatternConsumer;
import com.glodblock.github.loader.ItemAndBlockHolder;
import com.glodblock.github.util.FluidPatternDetails;
import com.glodblock.github.util.Util;
import java.util.*;
import java.util.stream.Collectors;
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 net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
implements IAEAppEngInventory, IOptionalSlotHost, IContainerCraftingPacket, IPatternConsumer {
@@ -154,8 +157,7 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
public ItemStack transferStackInSlot(EntityPlayer p, int idx) {
Slot clickSlot = (Slot) this.inventorySlots.get(idx);
ItemStack is = clickSlot.getStack();
if (is != null
&& !patternSlotOUT.getHasStack()
if (is != null && !patternSlotOUT.getHasStack()
&& is.stackSize == 1
&& (is.getItem() instanceof ItemFluidEncodedPattern || is.getItem() instanceof ItemEncodedPattern)) {
ItemStack output = is.copy();
@@ -173,20 +175,16 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
}
protected static boolean canDoubleStacks(SlotFake[] slots) {
List<SlotFake> enabledSlots =
Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
long emptySlots =
enabledSlots.stream().filter(s -> s.getStack() == null).count();
long fullSlots = enabledSlots.stream()
.filter(s -> s.getStack() != null && s.getStack().stackSize * 2 > 127)
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
long emptySlots = enabledSlots.stream().filter(s -> s.getStack() == null).count();
long fullSlots = enabledSlots.stream().filter(s -> s.getStack() != null && s.getStack().stackSize * 2 > 127)
.count();
return fullSlots <= emptySlots;
}
protected static void doubleStacksInternal(SlotFake[] slots) {
List<ItemStack> overFlowStacks = new ArrayList<>();
List<SlotFake> enabledSlots =
Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
for (final Slot s : enabledSlots) {
ItemStack st = s.getStack();
if (st == null) continue;
@@ -214,26 +212,20 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
}
protected static boolean containsItem(SlotFake[] slots) {
List<SlotFake> enabledSlots =
Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
long item = enabledSlots.stream()
.filter(s -> s.getStack() != null && !Util.isFluidPacket(s.getStack()))
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
long item = enabledSlots.stream().filter(s -> s.getStack() != null && !Util.isFluidPacket(s.getStack()))
.count();
return item > 0;
}
protected static boolean containsFluid(SlotFake[] slots) {
List<SlotFake> enabledSlots =
Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
long fluid = enabledSlots.stream()
.filter(s -> Util.isFluidPacket(s.getStack()))
.count();
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
long fluid = enabledSlots.stream().filter(s -> Util.isFluidPacket(s.getStack())).count();
return fluid > 0;
}
protected static boolean nonNullSlot(SlotFake[] slots) {
List<SlotFake> enabledSlots =
Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
List<SlotFake> enabledSlots = Arrays.stream(slots).filter(SlotFake::isEnabled).collect(Collectors.toList());
long object = enabledSlots.stream().filter(s -> s.getStack() != null).count();
return object > 0;
}
@@ -296,12 +288,8 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
}
@Override
public void onChangeInventory(
final IInventory inv,
final int slot,
final InvOperation mc,
final ItemStack removedStack,
final ItemStack newStack) {
public void onChangeInventory(final IInventory inv, final int slot, final InvOperation mc,
final ItemStack removedStack, final ItemStack newStack) {
// NO-OP
}
@@ -377,22 +365,14 @@ public abstract class FCContainerEncodeTerminal extends ContainerItemMonitor
}
// add a new encoded pattern.
for (final ItemStack encodedPatternStack : AEApi.instance()
.definitions()
.items()
.encodedPattern()
.maybeStack(1)
.asSet()) {
for (final ItemStack encodedPatternStack : AEApi.instance().definitions().items().encodedPattern()
.maybeStack(1).asSet()) {
output = encodedPatternStack;
this.patternSlotOUT.putStack(output);
}
} else if (output.getItem() instanceof ItemFluidEncodedPattern) {
for (final ItemStack encodedPatternStack : AEApi.instance()
.definitions()
.items()
.encodedPattern()
.maybeStack(1)
.asSet()) {
for (final ItemStack encodedPatternStack : AEApi.instance().definitions().items().encodedPattern()
.maybeStack(1).asSet()) {
output = encodedPatternStack;
this.patternSlotOUT.putStack(output);
}
@@ -1,5 +1,15 @@
package com.glodblock.github.client.gui.container.base;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import appeng.api.config.Upgrades;
import appeng.api.implementations.IUpgradeableHost;
import appeng.api.storage.data.IAEFluidStack;
@@ -8,20 +18,13 @@ import appeng.container.slot.AppEngSlot;
import appeng.tile.inventory.AppEngInternalAEInventory;
import appeng.util.Platform;
import appeng.util.item.AEFluidStack;
import com.glodblock.github.FluidCraft;
import com.glodblock.github.common.item.ItemFluidPacket;
import com.glodblock.github.inventory.slot.OptionalFluidSlotFakeTypeOnly;
import com.glodblock.github.network.SPacketFluidUpdate;
import com.glodblock.github.util.Ae2Reflect;
import com.glodblock.github.util.Util;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
public abstract class FCContainerFluidConfigurable extends ContainerUpgradeable {
@@ -99,9 +102,9 @@ public abstract class FCContainerFluidConfigurable extends ContainerUpgradeable
final AppEngInternalAEInventory inv = this.getFakeFluidInv();
final Map<Integer, IAEFluidStack> tmp = new HashMap<>();
for (int i = 0; i < inv.getSizeInventory(); ++i) {
if (inv.getStackInSlot(i) != null
&& !this.isValidForConfig(
i, AEFluidStack.create(ItemFluidPacket.getFluidStack(inv.getStackInSlot(i))))) {
if (inv.getStackInSlot(i) != null && !this.isValidForConfig(
i,
AEFluidStack.create(ItemFluidPacket.getFluidStack(inv.getStackInSlot(i))))) {
inv.setInventorySlotContents(i, null);
}
tmp.put(i, AEFluidStack.create(ItemFluidPacket.getFluidStack(inv.getStackInSlot(i))));
@@ -1,5 +1,16 @@
package com.glodblock.github.client.gui.container.base;
import java.io.IOException;
import javax.annotation.Nonnull;
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.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import appeng.api.config.*;
import appeng.api.networking.IGridNode;
import appeng.api.networking.energy.IEnergyGrid;
@@ -20,14 +31,6 @@ import appeng.helpers.WirelessTerminalGuiObject;
import appeng.util.ConfigManager;
import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
import java.io.IOException;
import javax.annotation.Nonnull;
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.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
public abstract class FCContainerMonitor<T extends IAEStack<T>> extends AEBaseContainer
implements IConfigManagerHost, IConfigurableObject, IMEMonitorHandlerReceiver<T> {
@@ -51,8 +54,8 @@ public abstract class FCContainerMonitor<T extends IAEStack<T>> extends AEBaseCo
this(ip, monitorable, true);
}
protected FCContainerMonitor(
final InventoryPlayer ip, final ITerminalHost monitorable, final boolean bindInventory) {
protected FCContainerMonitor(final InventoryPlayer ip, final ITerminalHost monitorable,
final boolean bindInventory) {
super(
ip,
monitorable instanceof TileEntity ? (TileEntity) monitorable : null,
@@ -83,7 +86,8 @@ public abstract class FCContainerMonitor<T extends IAEStack<T>> extends AEBaseCo
for (final Object crafter : this.crafters) {
try {
NetworkHandler.instance.sendTo(
new PacketValueConfig(set.name(), sideLocal.name()), (EntityPlayerMP) crafter);
new PacketValueConfig(set.name(), sideLocal.name()),
(EntityPlayerMP) crafter);
} catch (final IOException e) {
AELog.debug(e);
}
@@ -93,8 +97,8 @@ public abstract class FCContainerMonitor<T extends IAEStack<T>> extends AEBaseCo
processItemList();
this.updatePowerStatus();
final boolean oldAccessible = this.canAccessViewCells;
this.canAccessViewCells =
this.host instanceof WirelessTerminalGuiObject || this.hasAccess(SecurityPermissions.BUILD, false);
this.canAccessViewCells = this.host instanceof WirelessTerminalGuiObject
|| this.hasAccess(SecurityPermissions.BUILD, false);
if (this.canAccessViewCells != oldAccessible) {
for (int y = 0; y < 5; y++) {
if (this.cellView[y] != null) {
@@ -122,8 +126,7 @@ public abstract class FCContainerMonitor<T extends IAEStack<T>> extends AEBaseCo
this.setPowered(
this.getPowerSource().extractAEPower(1, Actionable.SIMULATE, PowerMultiplier.CONFIG) > 0.8);
}
} catch (final Throwable ignore) {
}
} catch (final Throwable ignore) {}
}
@Override