2014-11-14 12:02:52 +01:00
|
|
|
/*
|
|
|
|
* This file is part of Applied Energistics 2.
|
|
|
|
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
|
|
|
*
|
|
|
|
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
|
|
|
*/
|
|
|
|
|
2014-09-24 02:26:27 +02:00
|
|
|
package appeng.core.api;
|
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
|
2014-12-29 21:59:05 +01:00
|
|
|
import io.netty.buffer.ByteBuf;
|
|
|
|
|
2015-06-16 02:44:59 +02:00
|
|
|
import java.io.IOException;
|
|
|
|
|
2014-09-24 02:26:27 +02:00
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.nbt.NBTTagCompound;
|
|
|
|
import net.minecraftforge.fluids.FluidStack;
|
|
|
|
import appeng.api.networking.crafting.ICraftingLink;
|
|
|
|
import appeng.api.networking.crafting.ICraftingRequester;
|
|
|
|
import appeng.api.networking.energy.IEnergySource;
|
|
|
|
import appeng.api.networking.security.BaseActionSource;
|
|
|
|
import appeng.api.storage.IMEInventory;
|
|
|
|
import appeng.api.storage.IStorageHelper;
|
|
|
|
import appeng.api.storage.data.IAEFluidStack;
|
|
|
|
import appeng.api.storage.data.IAEItemStack;
|
|
|
|
import appeng.api.storage.data.IItemList;
|
|
|
|
import appeng.crafting.CraftingLink;
|
|
|
|
import appeng.util.Platform;
|
|
|
|
import appeng.util.item.AEFluidStack;
|
|
|
|
import appeng.util.item.AEItemStack;
|
|
|
|
import appeng.util.item.ItemList;
|
2015-09-15 16:12:16 +02:00
|
|
|
import appeng.util.item.FluidList;
|
2014-09-24 02:26:27 +02:00
|
|
|
|
2015-04-03 08:54:31 +02:00
|
|
|
|
2014-09-24 02:26:27 +02:00
|
|
|
public class ApiStorage implements IStorageHelper
|
|
|
|
{
|
|
|
|
|
|
|
|
@Override
|
2015-04-03 08:54:31 +02:00
|
|
|
public ICraftingLink loadCraftingLink( NBTTagCompound data, ICraftingRequester req )
|
|
|
|
{
|
|
|
|
return new CraftingLink( data, req );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public IAEItemStack createItemStack( ItemStack is )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
|
|
|
return AEItemStack.create( is );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-04-03 08:54:31 +02:00
|
|
|
public IAEFluidStack createFluidStack( FluidStack is )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
|
|
|
return AEFluidStack.create( is );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public IItemList<IAEItemStack> createItemList()
|
|
|
|
{
|
2015-09-15 16:12:16 +02:00
|
|
|
return new ItemList();
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public IItemList<IAEFluidStack> createFluidList()
|
|
|
|
{
|
2015-09-15 16:12:16 +02:00
|
|
|
return new FluidList();
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-04-03 08:54:31 +02:00
|
|
|
public IAEItemStack readItemFromPacket( ByteBuf input ) throws IOException
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
return AEItemStack.loadItemStackFromPacket( input );
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-04-03 08:54:31 +02:00
|
|
|
public IAEFluidStack readFluidFromPacket( ByteBuf input ) throws IOException
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
return AEFluidStack.loadFluidStackFromPacket( input );
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-04-03 08:54:31 +02:00
|
|
|
public IAEItemStack poweredExtraction( IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack request, BaseActionSource src )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
return Platform.poweredExtraction( energy, cell, request, src );
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2015-04-03 08:54:31 +02:00
|
|
|
public IAEItemStack poweredInsert( IEnergySource energy, IMEInventory<IAEItemStack> cell, IAEItemStack input, BaseActionSource src )
|
2014-09-24 02:26:27 +02:00
|
|
|
{
|
2015-04-03 08:54:31 +02:00
|
|
|
return Platform.poweredInsert( energy, cell, input, src );
|
2014-09-24 02:26:27 +02:00
|
|
|
}
|
|
|
|
}
|