use of pneumaticCraft.client.gui.semiblock.GuiLogisticsLiquidFilter in project PneumaticCraft by MineMaarten.
the class GuiAmadronAddTrade method actionPerformed.
@Override
public void actionPerformed(GuiButton button) {
EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer;
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) != null) {
input = container.getStack(0).copy();
((ItemStack) input).stackSize = inputNumber.getValue();
} else {
input = new FluidStack(inputFluid.getFluid(), inputNumber.getValue());
}
Object output;
if (container.getStack(1) != null) {
output = container.getStack(1).copy();
((ItemStack) output).stackSize = outputNumber.getValue();
} else {
output = new FluidStack(outputFluid.getFluid(), outputNumber.getValue());
}
AmadronOfferCustom trade = new AmadronOfferCustom(input, output, player);
ChunkPosition 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