Skip to content

Commit c3b7ee5

Browse files
committed
add trio interface
1 parent 4d7d92b commit c3b7ee5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1235
-76
lines changed

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ dependencies {
5353
deobfCompile 'curse.maven:ae2-extended-life-570458:5378163' //pae2
5454
deobfCompile 'curse.maven:dynamistics-383632:3056455' // dy
5555
deobfCompile 'curse.maven:baubles-227083:2518667' //baubles
56+
deobfCompile "curse.maven:mekanism-ce-399904:4804509" //mek-ce
57+
deobfCompile "curse.maven:mekanism-energistics-1027681:5389347" //mekeng
5658
compileOnly 'curse.maven:opencomputers-223008:4630537' //oc
57-
compileOnly "curse.maven:mekanism-ce-399904:4804509" //mek-ce
58-
compileOnly "curse.maven:mekanism-energistics-1027681:5389347" //mekeng
5959
}
6060

6161
minecraft {

src/main/java/com/glodblock/github/client/GuiFluidDualInterface.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
public class GuiFluidDualInterface extends GuiFluidInterface {
1717

18-
private GuiTabButton switchInterface;
18+
protected GuiTabButton switchInterface;
1919
private GuiTabButton priorityBtn;
2020

2121
public GuiFluidDualInterface(final InventoryPlayer ip, final IFluidInterfaceHost te) {
@@ -42,9 +42,4 @@ protected void actionPerformed(final GuiButton btn) throws IOException {
4242
}
4343
}
4444

45-
@Override
46-
protected boolean drawUpgrades() {
47-
return false;
48-
}
49-
5045
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.glodblock.github.client;
2+
3+
import appeng.client.gui.widgets.GuiTabButton;
4+
import appeng.fluids.helper.IFluidInterfaceHost;
5+
import com.glodblock.github.inventory.GuiType;
6+
import com.glodblock.github.inventory.InventoryHandler;
7+
import com.mekeng.github.common.ItemAndBlocks;
8+
import net.minecraft.client.gui.GuiButton;
9+
import net.minecraft.entity.player.InventoryPlayer;
10+
import net.minecraft.item.ItemStack;
11+
12+
import java.io.IOException;
13+
14+
public class GuiFluidTrioInterface extends GuiFluidDualInterface {
15+
16+
private GuiTabButton switchGasInterface;
17+
18+
public GuiFluidTrioInterface(InventoryPlayer ip, IFluidInterfaceHost te) {
19+
super(ip, te);
20+
}
21+
22+
@Override
23+
public void initGui() {
24+
super.initGui();
25+
ItemStack icon = new ItemStack(ItemAndBlocks.GAS_INTERFACE);
26+
this.switchGasInterface = new GuiTabButton(guiLeft + 112, guiTop, icon, icon.getDisplayName(), itemRender);
27+
this.buttonList.add(this.switchGasInterface);
28+
}
29+
30+
@Override
31+
protected void actionPerformed(final GuiButton btn) throws IOException {
32+
if (btn == this.switchGasInterface) {
33+
InventoryHandler.switchGui(GuiType.TRIO_GAS_INTERFACE);
34+
} else if (btn == this.switchInterface) {
35+
InventoryHandler.switchGui(GuiType.TRIO_ITEM_INTERFACE);
36+
} else {
37+
super.actionPerformed(btn);
38+
}
39+
}
40+
41+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
package com.glodblock.github.client;
2+
3+
import appeng.api.AEApi;
4+
import appeng.client.gui.widgets.GuiTabButton;
5+
import com.glodblock.github.inventory.GuiType;
6+
import com.glodblock.github.inventory.InventoryHandler;
7+
import com.glodblock.github.util.Ae2ReflectClient;
8+
import com.mekeng.github.client.gui.GuiGasInterface;
9+
import com.mekeng.github.common.me.duality.IGasInterfaceHost;
10+
import net.minecraft.client.gui.GuiButton;
11+
import net.minecraft.entity.player.InventoryPlayer;
12+
import net.minecraft.item.ItemStack;
13+
14+
import java.io.IOException;
15+
16+
public class GuiGasTrioInterface extends GuiGasInterface {
17+
18+
private GuiTabButton switchItemInterface;
19+
private GuiTabButton switchFluidInterface;
20+
private GuiTabButton priorityBtn;
21+
22+
public GuiGasTrioInterface(InventoryPlayer ip, IGasInterfaceHost te) {
23+
super(ip, te);
24+
}
25+
26+
@Override
27+
public void initGui() {
28+
super.initGui();
29+
ItemStack iconItem = AEApi.instance().definitions().blocks().iface().maybeStack(1).orElse(ItemStack.EMPTY);
30+
switchItemInterface = new GuiTabButton(guiLeft + 133, guiTop, iconItem, iconItem.getDisplayName(), itemRender);
31+
buttonList.add(switchItemInterface);
32+
ItemStack iconFluid = AEApi.instance().definitions().blocks().fluidIface().maybeStack(1).orElse(ItemStack.EMPTY);
33+
switchFluidInterface = new GuiTabButton(guiLeft + 112, guiTop, iconFluid, iconFluid.getDisplayName(), itemRender);
34+
buttonList.add(switchFluidInterface);
35+
priorityBtn = Ae2ReflectClient.getPriorityButtonGas(this);
36+
}
37+
38+
@Override
39+
protected void actionPerformed(final GuiButton btn) throws IOException {
40+
if (btn == switchItemInterface) {
41+
InventoryHandler.switchGui(GuiType.TRIO_ITEM_INTERFACE);
42+
} else if (btn == switchFluidInterface) {
43+
InventoryHandler.switchGui(GuiType.TRIO_FLUID_INTERFACE);
44+
} else if (btn == priorityBtn) {
45+
InventoryHandler.switchGui(GuiType.PRIORITY);
46+
} else {
47+
super.actionPerformed(btn);
48+
}
49+
}
50+
51+
}

src/main/java/com/glodblock/github/client/GuiItemDualInterface.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
public class GuiItemDualInterface extends GuiInterface {
2222

2323
private final ContainerItemDualInterface container;
24-
private GuiTabButton switchInterface;
24+
protected GuiTabButton switchInterface;
2525
private GuiTabButton priorityBtn;
2626
private GuiFCImgButton fluidPacketBtn;
2727
private GuiFCImgButton splittingBtn;
@@ -61,7 +61,7 @@ protected void actionPerformed(final GuiButton btn) throws IOException {
6161
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("DualInterface.AllowSplitting", this.splittingBtn.getCurrentValue().equals("ALLOW") ? "0" : "1"));
6262
} else if (btn == blockingBtn) {
6363
FluidCraft.proxy.netHandler.sendToServer(new CPacketFluidPatternTermBtns("DualInterface.ExtendedBlockMode", this.blockingBtn.getCurrentValue().equals("ALL") ? "1" : this.blockingBtn.getCurrentValue().equals("ITEM") ? "2" : "0"));
64-
} else {
64+
} else {
6565
super.actionPerformed(btn);
6666
}
6767
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.glodblock.github.client;
2+
3+
import appeng.client.gui.widgets.GuiTabButton;
4+
import appeng.helpers.IInterfaceHost;
5+
import com.glodblock.github.inventory.GuiType;
6+
import com.glodblock.github.inventory.InventoryHandler;
7+
import com.mekeng.github.common.ItemAndBlocks;
8+
import net.minecraft.client.gui.GuiButton;
9+
import net.minecraft.entity.player.InventoryPlayer;
10+
import net.minecraft.item.ItemStack;
11+
12+
import java.io.IOException;
13+
14+
public class GuiItemTrioInterface extends GuiItemDualInterface {
15+
16+
private GuiTabButton switchGasInterface;
17+
18+
public GuiItemTrioInterface(InventoryPlayer inventoryPlayer, IInterfaceHost te) {
19+
super(inventoryPlayer, te);
20+
}
21+
22+
@Override
23+
protected void addButtons() {
24+
super.addButtons();
25+
ItemStack icon = new ItemStack(ItemAndBlocks.GAS_INTERFACE);
26+
this.switchGasInterface = new GuiTabButton(guiLeft + 112, guiTop, icon, icon.getDisplayName(), itemRender);
27+
this.buttonList.add(this.switchGasInterface);
28+
}
29+
30+
@Override
31+
protected void actionPerformed(final GuiButton btn) throws IOException {
32+
if (btn == this.switchGasInterface) {
33+
InventoryHandler.switchGui(GuiType.TRIO_GAS_INTERFACE);
34+
} else if (btn == this.switchInterface) {
35+
InventoryHandler.switchGui(GuiType.TRIO_FLUID_INTERFACE);
36+
} else {
37+
super.actionPerformed(btn);
38+
}
39+
}
40+
41+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
package com.glodblock.github.client.container;
2+
3+
import appeng.api.config.Upgrades;
4+
import appeng.container.slot.SlotRestrictedInput;
5+
import appeng.util.Platform;
6+
import com.mekeng.github.common.container.ContainerGasInterface;
7+
import com.mekeng.github.common.me.duality.IGasInterfaceHost;
8+
import com.mekeng.github.common.me.duality.impl.DualityGasInterface;
9+
import net.minecraft.entity.player.InventoryPlayer;
10+
import net.minecraftforge.items.IItemHandler;
11+
12+
public class ContainerGasTrioInterface extends ContainerGasInterface {
13+
14+
private final DualityGasInterface dualityInterfaceCopy;
15+
16+
public ContainerGasTrioInterface(InventoryPlayer ip, IGasInterfaceHost te) {
17+
super(ip, te);
18+
this.dualityInterfaceCopy = te.getDualityGasInterface();
19+
}
20+
21+
@Override
22+
protected void setupUpgrades() {
23+
IItemHandler upgrades = this.getUpgradeable().getInventoryByName("gas_upgrades");
24+
if (this.availableUpgrades() > 0) {
25+
this.addSlotToContainer((new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer())).setNotDraggable());
26+
}
27+
28+
if (this.availableUpgrades() > 1) {
29+
this.addSlotToContainer((new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 26, this.getInventoryPlayer())).setNotDraggable());
30+
}
31+
32+
if (this.availableUpgrades() > 2) {
33+
this.addSlotToContainer((new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 44, this.getInventoryPlayer())).setNotDraggable());
34+
}
35+
36+
if (this.availableUpgrades() > 3) {
37+
this.addSlotToContainer((new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 62, this.getInventoryPlayer())).setNotDraggable());
38+
}
39+
}
40+
41+
@Override
42+
public void detectAndSendChanges() {
43+
super.detectAndSendChanges();
44+
if (Platform.isServer()) {
45+
if (this.capacityUpgrades != this.dualityInterfaceCopy.getInstalledUpgrades(Upgrades.CAPACITY)) {
46+
this.capacityUpgrades = this.dualityInterfaceCopy.getInstalledUpgrades(Upgrades.CAPACITY);
47+
}
48+
}
49+
standardDetectAndSendChanges();
50+
}
51+
52+
}

src/main/java/com/glodblock/github/common/block/BlockDualInterface.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import appeng.api.util.IOrientable;
44
import appeng.block.AEBaseTileBlock;
5-
import appeng.tile.misc.TileInterface;
65
import appeng.util.Platform;
76
import com.glodblock.github.common.tile.TileDualInterface;
87
import com.glodblock.github.inventory.GuiType;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package com.glodblock.github.common.block;
2+
3+
import appeng.util.Platform;
4+
import com.glodblock.github.common.tile.TileTrioInterface;
5+
import com.glodblock.github.inventory.GuiType;
6+
import com.glodblock.github.inventory.InventoryHandler;
7+
import net.minecraft.entity.player.EntityPlayer;
8+
import net.minecraft.item.ItemStack;
9+
import net.minecraft.util.EnumFacing;
10+
import net.minecraft.util.EnumHand;
11+
import net.minecraft.util.math.BlockPos;
12+
import net.minecraft.world.World;
13+
14+
import javax.annotation.Nullable;
15+
16+
public class BlockTrioInterface extends BlockDualInterface {
17+
18+
public BlockTrioInterface() {
19+
super();
20+
this.setTileEntity(TileTrioInterface.class);
21+
}
22+
23+
@Override
24+
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer p,
25+
final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side,
26+
final float hitX, final float hitY, final float hitZ) {
27+
if (p.isSneaking()) {
28+
return false;
29+
}
30+
final TileTrioInterface tg = this.getTileEntity(w, pos);
31+
if (tg != null) {
32+
if (Platform.isServer()) {
33+
InventoryHandler.openGui(p, w, pos, side, GuiType.TRIO_ITEM_INTERFACE);
34+
}
35+
return true;
36+
}
37+
return false;
38+
}
39+
40+
}

src/main/java/com/glodblock/github/common/component/DualityDualInterface.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import appeng.fluids.helper.DualityFluidInterface;
1919
import appeng.fluids.helper.IFluidInterfaceHost;
2020
import appeng.fluids.util.AEFluidInventory;
21-
import appeng.fluids.util.IAEFluidInventory;
2221
import appeng.helpers.DualityInterface;
2322
import appeng.helpers.IInterfaceHost;
2423
import appeng.items.misc.ItemEncodedPattern;
@@ -43,7 +42,7 @@
4342
import javax.annotation.Nullable;
4443
import java.util.List;
4544

46-
public class DualityDualInterface <H extends IInterfaceHost & IFluidInterfaceHost> implements ICapabilityProvider {
45+
public class DualityDualInterface<H extends IInterfaceHost & IFluidInterfaceHost> implements ICapabilityProvider {
4746

4847
private final DualityInterface itemDuality;
4948
private final DualityFluidInterface fluidDuality;
@@ -260,7 +259,7 @@ public void uploadSettings(NBTTagCompound compound, EntityPlayer player) {
260259
AEFluidInventory tmp = new AEFluidInventory(null, target.getSlots());
261260
tmp.readFromNBT(compound, "fluid_config");
262261

263-
for(int x = 0; x < tmp.getSlots(); x++) {
262+
for (int x = 0; x < tmp.getSlots(); x++) {
264263
target.setFluidInSlot(x, tmp.getFluidInSlot(x));
265264
}
266265
}

0 commit comments

Comments
 (0)