linking kinda works

This commit is contained in:
PrototypeTrousers
2023-01-30 23:41:13 -03:00
parent d76eec2145
commit ae0d02e7d5
4 changed files with 48 additions and 5 deletions
@@ -23,16 +23,27 @@ import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotRestrictedInput;
import appeng.tile.qnb.TileQuantumBridge;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
public class ContainerQNB extends AEBaseContainer {
SlotRestrictedInput SINGULARITY;
SlotRestrictedInput QUANTUM_CARD;
public ContainerQNB(final InventoryPlayer ip, final TileQuantumBridge quantumBridge) {
super(ip, quantumBridge, null);
this.addSlotToContainer((new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.QE_SINGULARITY, quantumBridge
.getInternalInventory(), 0, 80, 37, this.getInventoryPlayer())).setStackLimit(1));
SINGULARITY = new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.QE_SINGULARITY, quantumBridge
.getInternalInventory(), 0, 80, 37, this.getInventoryPlayer());
this.addSlotToContainer(SINGULARITY.setStackLimit(1));
QUANTUM_CARD = new SlotRestrictedInput(SlotRestrictedInput.PlacableItemType.CARD_QUANTUM, quantumBridge
.getInternalInventory(), 1, 80, 55, this.getInventoryPlayer());
this.addSlotToContainer((QUANTUM_CARD).setStackLimit(1));
this.bindPlayerInventory(ip, 0, 166 - /* height of player inventory */82);
}
}
@@ -20,6 +20,7 @@ package appeng.container.slot;
import appeng.api.AEApi;
import appeng.api.config.Upgrades;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IItems;
import appeng.api.definitions.IMaterials;
@@ -200,6 +201,11 @@ public class SlotRestrictedInput extends AppEngSlot {
return i.getItem() instanceof IBiometricCard;
case UPGRADES:
return i.getItem() instanceof IUpgradeModule && ((IUpgradeModule) i.getItem()).getType(i) != null;
case CARD_QUANTUM:
if (AEApi.instance().definitions().materials().cardQuantumLink().maybeItem().isPresent()) {
return AEApi.instance().definitions().materials().cardQuantumLink().maybeItem().get() == i.getItem();
}
return false;
default:
break;
}
@@ -269,6 +275,8 @@ public class SlotRestrictedInput extends AppEngSlot {
RANGE_BOOSTER(6 * 16 + 15),
QE_SINGULARITY(10 * 16 + 15),
CARD_QUANTUM(0),
SPATIAL_STORAGE_CELLS(11 * 16 + 15),
FUEL(12 * 16 + 15),
@@ -45,10 +45,13 @@ import appeng.api.storage.data.IItemList;
import appeng.api.util.DimensionalCoord;
import appeng.api.util.IConfigManager;
import appeng.container.interfaces.IInventorySlotAware;
import appeng.me.cluster.IAECluster;
import appeng.me.cluster.implementations.QuantumCluster;
import appeng.parts.automation.StackUpgradeInventory;
import appeng.parts.automation.UpgradeInventory;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.networking.TileWireless;
import appeng.tile.qnb.TileQuantumBridge;
import appeng.util.inv.IAEAppEngInventory;
import appeng.util.inv.InvOperation;
import net.minecraft.entity.player.EntityPlayer;
@@ -74,6 +77,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
private final AppEngInternalInventory viewCell = new AppEngInternalInventory(this, 5);
private final UpgradeInventory upgrades;
private QuantumCluster myQC;
public WirelessTerminalGuiObject(final IWirelessTermHandler wh, final ItemStack is, final EntityPlayer ep, final World w, final int x, final int y, final int z) {
@@ -244,6 +248,8 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
this.rangeCheck();
if (this.myWap != null) {
return this.myWap.getActionableNode();
} else if (this.myQC != null && this.myQC.getCenter().isPowered()) {
return this.myQC.getCenter().getActionableNode();
}
return null;
}
@@ -259,9 +265,10 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
return false;
}
final IMachineSet tw = this.targetGrid.getMachines(TileWireless.class);
IMachineSet tw = this.targetGrid.getMachines(TileWireless.class);
this.myWap = null;
this.myQC = null;
for (final IGridNode n : tw) {
final IWirelessAccessPoint wap = (IWirelessAccessPoint) n.getMachine();
@@ -270,7 +277,24 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
}
}
return this.myWap != null;
if (myWap != null) return true;
tw = this.targetGrid.getMachines(TileQuantumBridge.class);
for (final IGridNode n : tw) {
TileQuantumBridge tqb = (TileQuantumBridge) n.getMachine();
if (tqb.getCluster() != null) {
TileQuantumBridge center = ((QuantumCluster) tqb.getCluster()).getCenter();
if (center != null) {
if (center.getInternalInventory().getStackInSlot(1).isItemEqual(AEApi.instance().definitions().materials().cardQuantumLink().maybeStack(1).get())) {
myQC = (QuantumCluster) tqb.getCluster();
myRange = 1;
return true;
}
}
}
}
return this.myWap != null || this.myQC != null;
}
return false;
}
@@ -53,7 +53,7 @@ import java.util.Optional;
public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock, ITickable {
private final byte corner = 16;
private final AppEngInternalInventory internalInventory = new AppEngInternalInventory(this, 1, 1);
private final AppEngInternalInventory internalInventory = new AppEngInternalInventory(this, 2, 1);
private final byte hasSingularity = 32;
private final byte powered = 64;