Added routing filters as well as recipes and temp textures.
This commit is contained in:
parent
76dceb3534
commit
815faa2ced
13 changed files with 187 additions and 70 deletions
|
@ -1,17 +1,12 @@
|
|||
package WayofTime.bloodmagic.tile.routing;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import WayofTime.bloodmagic.item.inventory.ItemInventory;
|
||||
import WayofTime.bloodmagic.item.routing.IItemFilterProvider;
|
||||
import WayofTime.bloodmagic.routing.IItemFilter;
|
||||
import WayofTime.bloodmagic.routing.IOutputItemRoutingNode;
|
||||
import WayofTime.bloodmagic.routing.TestItemFilter;
|
||||
import WayofTime.bloodmagic.util.GhostItemHelper;
|
||||
|
||||
public class TileOutputRoutingNode extends TileFilteredRoutingNode implements IOutputItemRoutingNode
|
||||
{
|
||||
|
@ -31,37 +26,17 @@ public class TileOutputRoutingNode extends TileFilteredRoutingNode implements IO
|
|||
{
|
||||
ItemStack filterStack = this.getFilterStack(side);
|
||||
|
||||
if (filterStack == null)
|
||||
if (filterStack == null || !(filterStack.getItem() instanceof IItemFilterProvider))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
IItemFilterProvider filter = (IItemFilterProvider) filterStack.getItem();
|
||||
|
||||
TileEntity tile = worldObj.getTileEntity(pos.offset(side));
|
||||
if (tile instanceof IInventory)
|
||||
{
|
||||
IItemFilter testFilter = new TestItemFilter();
|
||||
List<ItemStack> filteredList = new LinkedList<ItemStack>();
|
||||
ItemInventory inv = new ItemInventory(filterStack, 9, ""); //TODO: Change to grab the filter from the Item later.
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++)
|
||||
{
|
||||
ItemStack stack = inv.getStackInSlot(i);
|
||||
if (stack == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStack ghostStack = GhostItemHelper.getStackFromGhost(stack);
|
||||
if (ghostStack.stackSize == 0)
|
||||
{
|
||||
ghostStack.stackSize = Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
filteredList.add(ghostStack);
|
||||
}
|
||||
|
||||
testFilter.initializeFilter(filteredList, (IInventory) tile, side.getOpposite(), true);
|
||||
|
||||
return testFilter;
|
||||
return filter.getOutputItemFilter(filterStack, (IInventory) tile, side.getOpposite());
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue