mirror of
https://github.com/GTNewHorizons/Applied-Energistics-2-Unofficial.git
synced 2026-10-25 20:22:23 +00:00
Fix alt type storage bus not able read subnet (#1154)
This commit is contained in:
1 parent
a109900b6e
commit
52fbed36ad
4 files changed
+36
-30
No files matched your search
@@ -10,6 +10,9 @@
|
||||
|
||||
package appeng.me.storage;
|
||||
|
||||
import static appeng.util.item.AEFluidStackType.FLUID_STACK_TYPE;
|
||||
import static appeng.util.item.AEItemStackType.ITEM_STACK_TYPE;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
@@ -17,51 +20,29 @@ import appeng.api.implementations.tiles.ITileStorageMonitorable;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.storage.IExternalStorageHandler;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.tile.misc.TileCondenser;
|
||||
|
||||
public class AEExternalHandler implements IExternalStorageHandler {
|
||||
|
||||
@Override
|
||||
public boolean canHandle(final TileEntity te, final ForgeDirection d, final StorageChannel channel,
|
||||
final BaseActionSource mySrc) {
|
||||
if (channel == StorageChannel.ITEMS && te instanceof ITileStorageMonitorable) {
|
||||
public boolean canHandle(TileEntity te, ForgeDirection d, IAEStackType<?> type, BaseActionSource mySrc) {
|
||||
if (te instanceof ITileStorageMonitorable)
|
||||
return ((ITileStorageMonitorable) te).getMonitorable(d, mySrc) != null;
|
||||
}
|
||||
|
||||
return te instanceof TileCondenser;
|
||||
else return te instanceof TileCondenser && (type == ITEM_STACK_TYPE || type == FLUID_STACK_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMEInventory getInventory(final TileEntity te, final ForgeDirection d, final StorageChannel channel,
|
||||
final BaseActionSource src) {
|
||||
public IMEInventory getInventory(TileEntity te, ForgeDirection d, IAEStackType<?> type, BaseActionSource src) {
|
||||
if (te instanceof TileCondenser) {
|
||||
if (channel == StorageChannel.ITEMS) {
|
||||
if (type == ITEM_STACK_TYPE) {
|
||||
return new VoidItemInventory((TileCondenser) te);
|
||||
} else {
|
||||
} else if (type == FLUID_STACK_TYPE) {
|
||||
return new VoidFluidInventory((TileCondenser) te);
|
||||
}
|
||||
}
|
||||
|
||||
if (te instanceof ITileStorageMonitorable iface) {
|
||||
final IStorageMonitorable sm = iface.getMonitorable(d, src);
|
||||
|
||||
if (channel == StorageChannel.ITEMS && sm != null) {
|
||||
final IMEInventory<IAEItemStack> ii = sm.getItemInventory();
|
||||
if (ii != null) {
|
||||
return ii;
|
||||
}
|
||||
}
|
||||
|
||||
if (channel == StorageChannel.FLUIDS && sm != null) {
|
||||
final IMEInventory<IAEFluidStack> fi = sm.getFluidInventory();
|
||||
if (fi != null) {
|
||||
return fi;
|
||||
}
|
||||
}
|
||||
return iface.getMonitorable(d, src).getMEMonitor(type);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -28,6 +28,8 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.gtnewhorizon.gtnhlib.capability.item.ItemIO;
|
||||
import com.gtnewhorizon.gtnhlib.capability.item.ItemSink;
|
||||
@@ -56,6 +58,7 @@ import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.capabilities.MEItemIO;
|
||||
import appeng.client.texture.CableBusTextures;
|
||||
@@ -254,6 +257,11 @@ public class PartInterface extends PartBasicState
|
||||
return this.duality.getFluidInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable IMEMonitor<?> getMEMonitor(@NotNull IAEStackType<?> type) {
|
||||
return this.duality.getMEMonitor(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(final IGridNode node) {
|
||||
return this.duality.getTickingRequest(node);
|
||||
|
||||
@@ -18,6 +18,9 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -42,6 +45,7 @@ import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.helpers.DualityInterface;
|
||||
@@ -388,6 +392,11 @@ public class PartP2PInterface extends PartP2PTunnelStatic<PartP2PInterface>
|
||||
return this.duality.getFluidInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable IMEMonitor<?> getMEMonitor(@NotNull IAEStackType<?> type) {
|
||||
return this.duality.getMEMonitor(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(final IGridNode node) {
|
||||
return this.duality.getTickingRequest(node);
|
||||
|
||||
@@ -27,6 +27,8 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.gtnewhorizon.gtnhlib.capability.item.ItemIO;
|
||||
import com.gtnewhorizon.gtnhlib.capability.item.ItemSink;
|
||||
@@ -53,6 +55,7 @@ import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.api.storage.data.IAEFluidStack;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IAEStackType;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.IConfigManager;
|
||||
@@ -195,6 +198,11 @@ public class TileInterface extends AENetworkInvTile
|
||||
return this.duality.getFluidInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable IMEMonitor<?> getMEMonitor(@NotNull IAEStackType<?> type) {
|
||||
return this.duality.getMEMonitor(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName(final String name) {
|
||||
return this.duality.getInventoryByName(name);
|
||||
|
||||
Reference in new issue
Block a user