// Path: src/java/cd4017be/indlog/util/IItemPipeCon.java
// public interface IItemPipeCon {
// 
// 	/**
// 	 * @param s side to connect from
// 	 * @return preferred transfer direction: 0 = none, 1 = in, 2 = out, 3 = both
// 	 */
// 	public byte getItemConnectDir(EnumFacing s);
// 
// }
// 
// Path: src/java/cd4017be/indlog/util/filter/DummyFilter.java
// @SideOnly(Side.CLIENT)
// public class DummyFilter<Obj, Inv> extends FilterBase<Obj, Inv> {
// 
// 	public DummyFilter(byte mode) {
// 		this.mode = mode;
// 	}
// 
// 	@Override
// 	public boolean matches(Obj obj) {
// 		return true;
// 	}
// 
// 	@Override
// 	public boolean noEffect() {
// 		return true;
// 	}
// 
// 	@Override
// 	public Item item() {
// 		return ItemStack.EMPTY.getItem();
// 	}
// 
// 	@Override
// 	public int insertAmount(Obj obj, Inv inv) {
// 		return 0;
// 	}
// 
// 	@Override
// 	public Obj getExtract(Obj obj, Inv inv) {
// 		return null;
// 	}
// 
// 	@Override
// 	public boolean transfer(Obj obj) {
// 		return true;
// 	}
// 
// }
// 
// Path: src/java/cd4017be/indlog/util/filter/ItemFilterProvider.java
// public interface ItemFilterProvider {
// 
// 	/**
// 	 * @param stack the actual stack representing the filter or null if created directly from NBT
// 	 * @return a new filter instance provided by this item
// 	 */
// 	PipeFilter<ItemStack, IItemHandler> getItemFilter(@Nullable ItemStack stack);
// 
// 	public static PipeFilter<ItemStack, IItemHandler> load(NBTTagCompound nbt) {
// 		Item item;
// 		if (nbt.hasKey("id", NBT.TAG_STRING)) item = Item.getByNameOrId(nbt.getString("id"));
// 		else item = Item.getByNameOrId("indlog:item_filter"); //backward compatibility
// 		if (item instanceof ItemFilterProvider) {
// 			PipeFilter<ItemStack, IItemHandler> filter = ((ItemFilterProvider)item).getItemFilter(null);
// 			if (filter != null) filter.deserializeNBT(nbt);
// 			return filter;
// 		} else return null;
// 	}
// 
// }


import java.util.List;
import cd4017be.indlog.util.IItemPipeCon;
import cd4017be.indlog.util.filter.DummyFilter;
import cd4017be.indlog.util.filter.ItemFilterProvider;
import cd4017be.lib.capability.AbstractInventory;
import cd4017be.lib.capability.LinkedInventory;
import cd4017be.lib.util.ItemFluidUtil;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemHandlerHelper;
package cd4017be.indlog.tileentity;



/**
 *
 * @author CD4017BE
 */
public class ItemPipe extends Pipe<ItemPipe, ItemStack, IItemHandler> {

	public static int TICKS;

	protected final IItemHandler access = new LinkedInventory(1, 64, this::getItem, this::setItem);
	protected final IItemHandler accessF = new Inventory();

	public ItemPipe() {}
	public ItemPipe(IBlockState state) {super(state);}

	@Override
	protected Class<ItemPipe> pipeClass() {return ItemPipe.class;}
	@Override
	protected Capability<IItemHandler> capability() {return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY;}
	@Override
	protected int resetTimer() {return TICKS;}
	@Override
	protected IItemHandler getInv(boolean filtered) {return filtered ? accessF : access;}

	private ItemStack getItem(int i) {
		return content == null ? ItemStack.EMPTY : content;
	}

	private void setItem(ItemStack item, int i) {
		content = item.isEmpty() ? null : item;
		markDirty();
	}

	@Override
	protected byte conDir(TileEntity te, EnumFacing side) {
// Path: src/java/cd4017be/indlog/util/IItemPipeCon.java
// public interface IItemPipeCon {
// 
// 	/**
// 	 * @param s side to connect from
// 	 * @return preferred transfer direction: 0 = none, 1 = in, 2 = out, 3 = both
// 	 */
// 	public byte getItemConnectDir(EnumFacing s);
// 
// }
// 
// Path: src/java/cd4017be/indlog/util/filter/DummyFilter.java
// @SideOnly(Side.CLIENT)
// public class DummyFilter<Obj, Inv> extends FilterBase<Obj, Inv> {
// 
// 	public DummyFilter(byte mode) {
// 		this.mode = mode;
// 	}
// 
// 	@Override
// 	public boolean matches(Obj obj) {
// 		return true;
// 	}
// 
// 	@Override
// 	public boolean noEffect() {
// 		return true;
// 	}
// 
// 	@Override
// 	public Item item() {
// 		return ItemStack.EMPTY.getItem();
// 	}
// 
// 	@Override
// 	public int insertAmount(Obj obj, Inv inv) {
// 		return 0;
// 	}
// 
// 	@Override
// 	public Obj getExtract(Obj obj, Inv inv) {
// 		return null;
// 	}
// 
// 	@Override
// 	public boolean transfer(Obj obj) {
// 		return true;
// 	}
// 
// }
// 
// Path: src/java/cd4017be/indlog/util/filter/ItemFilterProvider.java
// public interface ItemFilterProvider {
// 
// 	/**
// 	 * @param stack the actual stack representing the filter or null if created directly from NBT
// 	 * @return a new filter instance provided by this item
// 	 */
// 	PipeFilter<ItemStack, IItemHandler> getItemFilter(@Nullable ItemStack stack);
// 
// 	public static PipeFilter<ItemStack, IItemHandler> load(NBTTagCompound nbt) {
// 		Item item;
// 		if (nbt.hasKey("id", NBT.TAG_STRING)) item = Item.getByNameOrId(nbt.getString("id"));
// 		else item = Item.getByNameOrId("indlog:item_filter"); //backward compatibility
// 		if (item instanceof ItemFilterProvider) {
// 			PipeFilter<ItemStack, IItemHandler> filter = ((ItemFilterProvider)item).getItemFilter(null);
// 			if (filter != null) filter.deserializeNBT(nbt);
// 			return filter;
// 		} else return null;
// 	}
// 
// }


// Path: src/java/cd4017be/indlog/tileentity/ItemPipe.java
import java.util.List;
import cd4017be.indlog.util.IItemPipeCon;
import cd4017be.indlog.util.filter.DummyFilter;
import cd4017be.indlog.util.filter.ItemFilterProvider;
import cd4017be.lib.capability.AbstractInventory;
import cd4017be.lib.capability.LinkedInventory;
import cd4017be.lib.util.ItemFluidUtil;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemHandlerHelper;

package cd4017be.indlog.tileentity;



/**
 *
 * @author CD4017BE
 */
public class ItemPipe extends Pipe<ItemPipe, ItemStack, IItemHandler> {

	public static int TICKS;

	protected final IItemHandler access = new LinkedInventory(1, 64, this::getItem, this::setItem);
	protected final IItemHandler accessF = new Inventory();

	public ItemPipe() {}
	public ItemPipe(IBlockState state) {super(state);}

	@Override
	protected Class<ItemPipe> pipeClass() {return ItemPipe.class;}
	@Override
	protected Capability<IItemHandler> capability() {return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY;}
	@Override
	protected int resetTimer() {return TICKS;}
	@Override
	protected IItemHandler getInv(boolean filtered) {return filtered ? accessF : access;}

	private ItemStack getItem(int i) {
		return content == null ? ItemStack.EMPTY : content;
	}

	private void setItem(ItemStack item, int i) {
		content = item.isEmpty() ? null : item;
		markDirty();
	}

	@Override
	protected byte conDir(TileEntity te, EnumFacing side) {
		return te instanceof IItemPipeCon ? ((IItemPipeCon)te).getItemConnectDir(side) : 0;