mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-02-24 15:00:48 +00:00
Add files via upload
This commit is contained in:
parent
52149b098e
commit
0a99397f30
@ -0,0 +1,34 @@
|
|||||||
|
package com.hbm.handler.ae2;
|
||||||
|
|
||||||
|
import com.hbm.tileentity.machine.TileEntityMachineArcFurnaceLarge;
|
||||||
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
|
import cpw.mods.fml.common.Optional;
|
||||||
|
|
||||||
|
import appeng.api.networking.security.BaseActionSource;
|
||||||
|
import appeng.api.storage.IExternalStorageHandler;
|
||||||
|
import appeng.api.storage.IMEInventory;
|
||||||
|
import appeng.api.storage.StorageChannel;
|
||||||
|
import appeng.me.storage.MEMonitorIInventory;
|
||||||
|
import appeng.util.inv.IMEAdaptor;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
@Optional.InterfaceList({@Optional.Interface(iface = "appeng.api.storage.IExternalStorageHandler", modid = "appliedenergistics2")})
|
||||||
|
public class AFLExternalStorageHandler implements IExternalStorageHandler {
|
||||||
|
|
||||||
|
public AFLExternalStorageHandler() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc) {
|
||||||
|
boolean coreProxy = te instanceof TileEntityProxyCombo && ((TileEntityProxyCombo) te).getTile() instanceof TileEntityMachineArcFurnaceLarge;
|
||||||
|
return channel == StorageChannel.ITEMS && (te instanceof TileEntityMachineArcFurnaceLarge || coreProxy);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src) {
|
||||||
|
if (!canHandle(te, d, channel, src)) return null;
|
||||||
|
if (te instanceof TileEntityProxyCombo) return new MEMonitorIInventory(new IMEAdaptor(new ArcFurnaceLargeMEInventory((TileEntityMachineArcFurnaceLarge) ((TileEntityProxyCombo)te).getTile()), src)) {};
|
||||||
|
return new MEMonitorIInventory(new IMEAdaptor(new ArcFurnaceLargeMEInventory((TileEntityMachineArcFurnaceLarge) te), src)) {};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,60 @@
|
|||||||
|
package com.hbm.handler.ae2;
|
||||||
|
|
||||||
|
import com.hbm.tileentity.machine.TileEntityMachineArcFurnaceLarge;
|
||||||
|
import com.hbm.tileentity.TileEntityProxyCombo;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.Optional;
|
||||||
|
|
||||||
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
|
import appeng.api.networking.security.BaseActionSource;
|
||||||
|
import appeng.api.storage.IMEInventory;
|
||||||
|
import appeng.api.storage.StorageChannel;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.api.storage.data.IItemList;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
@Optional.InterfaceList({@Optional.Interface(iface = "appeng.api.storage.IMEInventory", modid = "appliedenergistics2")})
|
||||||
|
public class ArcFurnaceLargeMEInventory implements IMEInventory<IAEItemStack> {
|
||||||
|
|
||||||
|
private TileEntityMachineArcFurnaceLarge afl;
|
||||||
|
|
||||||
|
public ArcFurnaceLargeMEInventory(TileEntityMachineArcFurnaceLarge afl) {
|
||||||
|
this.afl = afl;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IAEItemStack injectItems(IAEItemStack input, Actionable type, BaseActionSource src) {
|
||||||
|
ItemStack is = input.getItemStack();
|
||||||
|
is = afl.distributeInput(is, type == Actionable.MODULATE);
|
||||||
|
|
||||||
|
if(is == null) return null;
|
||||||
|
return AEApi.instance().storage().createItemStack(is);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActionSource src) {
|
||||||
|
ItemStack is = request.getItemStack();
|
||||||
|
is = afl.collectRequested(is, mode == Actionable.MODULATE);
|
||||||
|
|
||||||
|
if(is == null) return null;
|
||||||
|
return AEApi.instance().storage().createItemStack(is);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IItemList<IAEItemStack> getAvailableItems(IItemList<IAEItemStack> out) {
|
||||||
|
ItemStack is;
|
||||||
|
for(int i = 0; i < 25; i++) {
|
||||||
|
is = afl.getAvailableItemFromSlot(i);
|
||||||
|
if(is != null) out.add(AEApi.instance().storage().createItemStack(is));
|
||||||
|
}
|
||||||
|
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StorageChannel getChannel() {
|
||||||
|
return StorageChannel.ITEMS;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user