Skip to content

Commit

Permalink
Add mirrored interface as "P2P Tunnel - ME Interface" (#183)
Browse files Browse the repository at this point in the history
* Memory card saves the patterns

* Mirrored interface

* Fix crash in dev

* p2p

* Fix

* spotlessApply (#184)

Co-authored-by: Jakub <53441451+kuba6000@users.noreply.github.com>
Co-authored-by: GitHub GTNH Actions <>

* Make interface an attunemnt

* More

* I would like to avoid crashing

* Revert "Memory card saves the patterns"

This reverts commit 7e5d231.

* Leave that fix

* Revert "I would like to avoid crashing"

This reverts commit 069dd14.

* Avoid double call with parts (crash fix)

* Move fix

* Sync GUI

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
kuba6000 and github-actions[bot] authored Oct 2, 2022
1 parent 970620d commit ed4e806
Show file tree
Hide file tree
Showing 15 changed files with 457 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dependencies {
compile('com.github.GTNewHorizons:NotEnoughItems:2.2.33-GTNH:dev')
compile('curse.maven:cofh-core-69162:2388751')

compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.27:dev') {transitive = false}
compile('com.github.GTNewHorizons:BuildCraft:7.1.27:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.2.8:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.41.18:dev') {transitive = false}
compileOnly('com.github.GTNewHorizons:Jabba:1.2.21:dev') {transitive = false}
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/appeng/api/config/TunnelType.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ public enum TunnelType {
BUNDLED_REDSTONE, // Bundled Redstone Tunnel
COMPUTER_MESSAGE, // Computer Message Tunnel
PRESSURE, // PneumaticCraft Tunnel
GT_POWER // GregTech EU Tunnel
GT_POWER, // GregTech EU Tunnel
ME_INTERFACE
}
2 changes: 2 additions & 0 deletions src/main/java/appeng/api/definitions/IParts.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,6 @@ public interface IParts {
IItemDefinition patternTerminalEx();

IItemDefinition p2PTunnelGregtech();

IItemDefinition p2PTunnelMEInterface();
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ public void drawFG(final int offsetX, final int offsetY, final int mouseX, final
@Override
protected String getBackground() {
switch (((ContainerInterface) this.cvb).getPatternCapacityCardsInstalled()) {
case -1:
return "guis/interfacenone.png";
case 1:
return "guis/interface2.png";
case 2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ public class ContainerInterface extends ContainerUpgradeable implements IOptiona
@GuiSync(7)
public int patternRows;

@GuiSync(9)
public boolean isEmpty;

public ContainerInterface(final InventoryPlayer ip, final IInterfaceHost te) {
super(ip, te.getInterfaceDuality().getHost());

Expand Down Expand Up @@ -102,6 +105,7 @@ public void detectAndSendChanges() {
this.verifyPermissions(SecurityPermissions.BUILD, false);

if (patternRows != getPatternCapacityCardsInstalled()) patternRows = getPatternCapacityCardsInstalled();
isEmpty = patternRows == -1;

final ArrayList<ItemStack> drops = getRemovedPatterns();
if (!drops.isEmpty()) {
Expand Down Expand Up @@ -161,12 +165,14 @@ private void setInsertionMode(final InsertionMode insertionMode) {
}

public int getPatternCapacityCardsInstalled() {
if (Platform.isClient() && isEmpty) return -1;
if (myDuality == null) return 0;
return myDuality.getInstalledUpgrades(Upgrades.PATTERN_CAPACITY);
}

@Override
public boolean isSlotEnabled(final int idx) {
if (Platform.isClient() && isEmpty) return false;
return myDuality.getInstalledUpgrades(Upgrades.PATTERN_CAPACITY) >= idx;
}
}
7 changes: 7 additions & 0 deletions src/main/java/appeng/core/api/definitions/ApiParts.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public final class ApiParts implements IParts {
private final IItemDefinition p2PTunnelOpenComputers;
private final IItemDefinition p2PTunnelPneumaticCraft;
private final IItemDefinition p2PTunnelGregtech;
private final IItemDefinition p2PTunnelInterface;
private final IItemDefinition cableAnchor;
private final IItemDefinition monitor;
private final IItemDefinition semiDarkMonitor;
Expand Down Expand Up @@ -115,6 +116,7 @@ public ApiParts(final DefinitionConstructor constructor, final IPartHelper partH
new DamagedItemDefinition(itemMultiPart.createPart(PartType.P2PTunnelOpenComputers));
this.p2PTunnelPneumaticCraft = new DamagedItemDefinition(itemMultiPart.createPart(PartType.P2PTunnelPressure));
this.p2PTunnelGregtech = new DamagedItemDefinition(itemMultiPart.createPart(PartType.P2PTunnelGT));
this.p2PTunnelInterface = new DamagedItemDefinition(itemMultiPart.createPart(PartType.P2PTunnelInterface));
this.cableAnchor = new DamagedItemDefinition(itemMultiPart.createPart(PartType.CableAnchor));
this.monitor = new DamagedItemDefinition(itemMultiPart.createPart(PartType.Monitor));
this.semiDarkMonitor = new DamagedItemDefinition(itemMultiPart.createPart(PartType.SemiDarkMonitor));
Expand Down Expand Up @@ -292,6 +294,11 @@ public IItemDefinition p2PTunnelGregtech() {
return this.p2PTunnelGregtech;
}

@Override
public IItemDefinition p2PTunnelMEInterface() {
return this.p2PTunnelInterface;
}

@Override
public IItemDefinition cableAnchor() {
return this.cableAnchor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ public void configure() {
final IBlocks blocks = definitions.blocks();
final IParts parts = definitions.parts();

this.addNewAttunement(blocks.iface(), TunnelType.ITEM);
this.addNewAttunement(parts.iface(), TunnelType.ITEM);
this.addNewAttunement(parts.storageBus(), TunnelType.ITEM);
this.addNewAttunement(parts.importBus(), TunnelType.ITEM);
this.addNewAttunement(parts.exportBus(), TunnelType.ITEM);
Expand Down Expand Up @@ -113,6 +111,10 @@ public void configure() {
this.addNewAttunement(parts.cableUltraDenseCovered().stack(c, 1), TunnelType.ME);
this.addNewAttunement(parts.cableUltraDenseSmart().stack(c, 1), TunnelType.ME);
}

this.addNewAttunement(blocks.iface(), TunnelType.ME_INTERFACE);
this.addNewAttunement(parts.iface(), TunnelType.ME_INTERFACE);
this.addNewAttunement(definitions.items().encodedPattern(), TunnelType.ME_INTERFACE);
}

@Override
Expand Down
1 change: 1 addition & 0 deletions src/main/java/appeng/core/localization/GuiText.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public enum GuiText {
RFTunnel,
PressureTunnel,
GTTunnel,
IFACETunnel,

StoredSize,
CopyMode,
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/appeng/helpers/DualityInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public class DualityInterface
private final int[] sides = {0, 1, 2, 3, 4, 5, 6, 7, 8};
private final IAEItemStack[] requireWork = {null, null, null, null, null, null, null, null, null};
private final MultiCraftingTracker craftingTracker;
private final AENetworkProxy gridProxy;
protected final AENetworkProxy gridProxy;
private final IInterfaceHost iHost;
private final BaseActionSource mySource;
private final BaseActionSource interfaceRequestSource;
Expand All @@ -122,7 +122,7 @@ public class DualityInterface
private final UpgradeInventory upgrades;
private boolean hasConfig = false;
private int priority;
private List<ICraftingPatternDetails> craftingList = null;
public List<ICraftingPatternDetails> craftingList = null;
private List<ItemStack> waitingToSend = null;
private IMEInventory<IAEItemStack> destination;
private boolean isWorking = false;
Expand Down Expand Up @@ -289,7 +289,7 @@ private void readConfig() {
this.notifyNeighbors();
}

private void updateCraftingList() {
public void updateCraftingList() {

final boolean[] accountedFor = new boolean[patterns.getSizeInventory()];

Expand Down Expand Up @@ -398,7 +398,7 @@ public void notifyNeighbors() {
}
}

private void addToCraftingList(final ItemStack is) {
protected void addToCraftingList(final ItemStack is) {
if (is == null) {
return;
}
Expand Down
7 changes: 7 additions & 0 deletions src/main/java/appeng/items/parts/PartType.java
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,13 @@ public boolean isCable() {
PartP2PGT5Power.class,
GuiText.GTTunnel),

P2PTunnelInterface(
471,
EnumSet.of(AEFeature.P2PTunnel),
EnumSet.noneOf(IntegrationType.class),
PartP2PInterface.class,
GuiText.IFACETunnel),

InterfaceTerminal(
480,
EnumSet.of(AEFeature.InterfaceTerminal),
Expand Down
Loading

0 comments on commit ed4e806

Please sign in to comment.