mirror of
https://github.com/GTNewHorizons/AE2FluidCraft-Rework.git
synced 2026-11-10 23:43:51 +00:00
fix fluid export bus gui
This commit is contained in:
1 parent
ff92f7168f
commit
475c910fa2
4 files changed
+87
-4
No files matched your search
@@ -0,0 +1,40 @@
|
||||
package com.glodblock.github.client;
|
||||
|
||||
import appeng.client.gui.implementations.GuiUpgradeable;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.fluids.client.gui.widgets.GuiFluidSlot;
|
||||
import appeng.fluids.client.gui.widgets.GuiOptionalFluidSlot;
|
||||
import appeng.fluids.container.ContainerFluidIO;
|
||||
import appeng.fluids.parts.PartSharedFluidBus;
|
||||
import appeng.fluids.util.IAEFluidTank;
|
||||
import com.glodblock.github.client.container.ContainerFluidExportBus;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class GuiFluidExportBus extends GuiUpgradeable {
|
||||
|
||||
private final PartSharedFluidBus bus;
|
||||
|
||||
public GuiFluidExportBus(InventoryPlayer inventoryPlayer, PartSharedFluidBus te) {
|
||||
super(new ContainerFluidExportBus(inventoryPlayer, te));
|
||||
this.bus = te;
|
||||
}
|
||||
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
ContainerFluidIO container = (ContainerFluidIO)this.inventorySlots;
|
||||
IAEFluidTank inv = this.bus.getConfig();
|
||||
this.guiSlots.add(new GuiFluidSlot(inv, 0, 0, 80, 40));
|
||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 1, 1, 1, 80, 40, -1, 0));
|
||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 2, 2, 1, 80, 40, 1, 0));
|
||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 3, 3, 1, 80, 40, 0, -1));
|
||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 4, 4, 1, 80, 40, 0, 1));
|
||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 5, 5, 2, 80, 40, -1, -1));
|
||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 6, 6, 2, 80, 40, 1, -1));
|
||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 7, 7, 2, 80, 40, -1, 1));
|
||||
this.guiSlots.add(new GuiOptionalFluidSlot(inv, container, 8, 8, 2, 80, 40, 1, 1));
|
||||
}
|
||||
|
||||
protected GuiText getName() {
|
||||
return GuiText.ExportBusFluids;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.glodblock.github.client.container;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.fluids.container.ContainerFluidIO;
|
||||
import appeng.fluids.parts.PartSharedFluidBus;
|
||||
import com.glodblock.github.common.part.PartFluidExportBus;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
public class ContainerFluidExportBus extends ContainerFluidIO {
|
||||
|
||||
public ContainerFluidExportBus(InventoryPlayer ip, PartSharedFluidBus te) {
|
||||
super(ip, te);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettingsFromHost(IConfigManager cm) {
|
||||
super.loadSettingsFromHost(cm);
|
||||
if (this.getUpgradeable() instanceof PartFluidExportBus) {
|
||||
this.setCraftingMode((YesNo)cm.getSetting(Settings.CRAFT_ONLY));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -29,6 +29,8 @@ import appeng.util.Platform;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.inventory.FluidConvertingInventoryAdaptor;
|
||||
import com.glodblock.github.inventory.GuiType;
|
||||
import com.glodblock.github.inventory.InventoryHandler;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -83,8 +85,10 @@ public class PartFluidExportBus extends PartSharedFluidBus implements ICraftingR
|
||||
|
||||
@Override
|
||||
public boolean onPartActivate(EntityPlayer player, EnumHand hand, Vec3d pos) {
|
||||
TileEntity te = this.getTile();
|
||||
BlockPos tePos = te.getPos();
|
||||
if (Platform.isServer()) {
|
||||
Platform.openGUI(player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_BUS_FLUID);
|
||||
InventoryHandler.openGui(player, te.getWorld(), tePos, this.getSide().getFacing(), GuiType.FLUID_EXPORT_BUS);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -141,18 +145,20 @@ public class PartFluidExportBus extends PartSharedFluidBus implements ICraftingR
|
||||
if( fluid != null )
|
||||
{
|
||||
|
||||
boolean isAllowed = true;
|
||||
|
||||
final IAEFluidStack toExtract = fluid.copy();
|
||||
|
||||
toExtract.setStackSize( this.calculateAmountToSend() );
|
||||
|
||||
if( this.craftOnly() )
|
||||
{
|
||||
this.craftingTracker.handleCrafting( i, toExtract.getStackSize(), ItemFluidDrop.newAeStack(toExtract), destination, this.getTile().getWorld(), this.getProxy().getGrid(), cg, this.source );
|
||||
isAllowed = this.craftingTracker.handleCrafting( i, toExtract.getStackSize(), ItemFluidDrop.newAeStack(toExtract), destination, this.getTile().getWorld(), this.getProxy().getGrid(), cg, this.source );
|
||||
}
|
||||
|
||||
final IAEFluidStack out = inv.extractItems( toExtract, Actionable.SIMULATE, this.source );
|
||||
|
||||
if( out != null )
|
||||
if( out != null && isAllowed )
|
||||
{
|
||||
int wasInserted = fh.fill( out.getFluidStack(), true );
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import appeng.helpers.IInterfaceHost;
|
||||
import appeng.parts.reporting.AbstractPartTerminal;
|
||||
import com.glodblock.github.client.*;
|
||||
import com.glodblock.github.client.container.*;
|
||||
import com.glodblock.github.common.part.PartFluidPatternTerminal;
|
||||
import com.glodblock.github.common.part.PartFluidExportBus;
|
||||
import com.glodblock.github.common.tile.TileBurette;
|
||||
import com.glodblock.github.common.tile.TileFluidPacketDecoder;
|
||||
import com.glodblock.github.common.tile.TileFluidPatternEncoder;
|
||||
@@ -35,6 +35,18 @@ import java.util.List;
|
||||
|
||||
public enum GuiType {
|
||||
|
||||
FLUID_EXPORT_BUS(new PartOrTileGuiFactory<PartFluidExportBus>(PartFluidExportBus.class) {
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, PartFluidExportBus inv) {
|
||||
return new ContainerFluidExportBus(player.inventory, inv);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object createClientGui(EntityPlayer player, PartFluidExportBus inv) {
|
||||
return new GuiFluidExportBus(player.inventory, inv);
|
||||
}
|
||||
}),
|
||||
|
||||
INGREDIENT_BUFFER(new TileGuiFactory<TileIngredientBuffer>(TileIngredientBuffer.class) {
|
||||
@Override
|
||||
protected Object createServerGui(EntityPlayer player, TileIngredientBuffer inv) {
|
||||
|
||||
Reference in new issue
Block a user