use of me.desht.pneumaticcraft.client.gui.semiblock.GuiLogisticsLiquidFilter in project pnc-repressurized by TeamPneumatic.
the class GuiAmadronAddTrade method actionPerformed.
@Override
public void actionPerformed(GuiButton button) {
EntityPlayer player = FMLClientHandler.instance().getClient().player;
ContainerAmadronAddTrade container = (ContainerAmadronAddTrade) inventorySlots;
if (button.id < 6 && button.id >= 0) {
isSettingInput = button.id < 3;
if (button.id % 3 == 0) {
searchGui = new GuiSearcher(player);
searchGui.setSearchStack(container.getStack(isSettingInput ? 0 : 1));
FMLClientHandler.instance().showGuiScreen(searchGui);
} else if (button.id % 3 == 1) {
invSearchGui = new GuiInventorySearcher(player);
invSearchGui.setSearchStack(container.getStack(isSettingInput ? 0 : 1));
FMLClientHandler.instance().showGuiScreen(invSearchGui);
} else if (button.id % 3 == 2) {
fluidGui = new GuiLogisticsLiquidFilter(this);
fluidGui.setFilter(isSettingInput ? inputFluid.getFluid() : outputFluid.getFluid());
FMLClientHandler.instance().showGuiScreen(fluidGui);
}
} else if (button.id == 8) {
Object input;
if (!container.getStack(0).isEmpty()) {
input = container.getStack(0).copy();
((ItemStack) input).setCount(inputNumber.getValue());
} else {
input = new FluidStack(inputFluid.getFluid(), inputNumber.getValue());
}
Object output;
if (!container.getStack(1).isEmpty()) {
output = container.getStack(1).copy();
((ItemStack) output).setCount(outputNumber.getValue());
} else {
output = new FluidStack(outputFluid.getFluid(), outputNumber.getValue());
}
AmadronOfferCustom trade = new AmadronOfferCustom(input, output, player);
BlockPos pos = getInputPosition();
int dimensionId = getInputDimension();
trade.setProvidingPosition(pos, dimensionId);
pos = getOutputPosition();
dimensionId = getOutputDimension();
trade.setReturningPosition(pos, dimensionId);
NetworkHandler.sendToServer(new PacketAmadronTradeAdd(trade.invert()));
player.closeScreen();
}
super.actionPerformed(button);
}
Aggregations