fix universal terminal infinity connect bug

This commit is contained in:
asdflj committed 2023-02-25 11:43:21 +08:00
1 parent acfb5b1d48
commit 2407653e96
2 files changed
+10 -3

No files matched your search

@@ -1,5 +1,7 @@
package com.glodblock.github.inventory.item;
import java.util.Objects;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@@ -10,6 +12,7 @@ import appeng.api.config.*;
import appeng.api.implementations.items.IAEItemPowerStorage;
import appeng.api.networking.IGridNode;
import appeng.api.storage.IMEMonitor;
import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.AECableType;
@@ -19,6 +22,8 @@ import appeng.tile.inventory.InvOperation;
import appeng.util.ConfigManager;
import appeng.util.Platform;
import com.glodblock.github.util.Util;
public class WirelessInterfaceTerminalInventory implements IWirelessInterfaceTerminal {
private final ItemStack target;
@@ -27,6 +32,7 @@ public class WirelessInterfaceTerminalInventory implements IWirelessInterfaceTer
private final IGridNode grid;
public WirelessInterfaceTerminalInventory(ItemStack is, int slot, IGridNode gridNode, EntityPlayer player) {
Objects.requireNonNull(Util.getWirelessInv(is, player, StorageChannel.ITEMS));
this.ips = (ToolWirelessTerminal) is.getItem();
this.grid = gridNode;
this.target = is;
@@ -110,10 +110,11 @@ public final class Util {
}
public static IMEInventoryHandler<?> getWirelessInv(ItemStack is, EntityPlayer player, StorageChannel channel) {
if (Platform.isClient()) return new NullInventory<>();
IGridNode gridNode = getWirelessGrid(is);
if (gridNode == null) return new NullInventory<>();
if (gridNode == null) return null;
IGrid grid = gridNode.getGrid();
if (grid == null) return new NullInventory<>();
if (grid == null) return null;
boolean canConnect = false;
if (hasInfinityBoosterCard(is)) {
canConnect = true;
@@ -141,7 +142,7 @@ public final class Util {
}
}
}
return new NullInventory<>();
return null;
}
public static ItemStack getWirelessTerminal(EntityPlayer player, int x) {