Added packet handlers, guis, etc required to handle the routing nodes. Added the ability to have a different filter for each direction.

This commit is contained in:
WayofTime 2016-01-14 11:06:50 -05:00
parent ac919c7882
commit a895809274
13 changed files with 508 additions and 78 deletions

View file

@ -0,0 +1,57 @@
package WayofTime.bloodmagic.tile.routing;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
public class TileFilteredRoutingNode extends TileRoutingNode implements ISidedInventory
{
public int currentActiveSlot = 0;
public TileFilteredRoutingNode(int size, String name)
{
super(size, name);
}
@Override
public void readFromNBT(NBTTagCompound tag)
{
super.readFromNBT(tag);
currentActiveSlot = tag.getInteger("currentSlot");
}
@Override
public void writeToNBT(NBTTagCompound tag)
{
super.writeToNBT(tag);
tag.setInteger("currentSlot", currentActiveSlot);
}
public void swapFilters(int requestedSlot)
{
this.setInventorySlotContents(currentActiveSlot + 1, this.getStackInSlot(0));
this.setInventorySlotContents(0, this.getStackInSlot(requestedSlot + 1));
this.setInventorySlotContents(requestedSlot + 1, null);
currentActiveSlot = requestedSlot;
this.markDirty();
}
@Override
public int[] getSlotsForFace(EnumFacing side)
{
return new int[0];
}
@Override
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction)
{
return false;
}
@Override
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction)
{
return false;
}
}

View file

@ -1,9 +1,9 @@
package WayofTime.bloodmagic.tile.routing;
public class TileInputRoutingNode extends TileRoutingNode
public class TileInputRoutingNode extends TileFilteredRoutingNode
{
public TileInputRoutingNode()
{
super(1, "inputNode");
super(7, "inputNode");
}
}

View file

@ -1,9 +1,9 @@
package WayofTime.bloodmagic.tile.routing;
public class TileOutputRoutingNode extends TileRoutingNode
public class TileOutputRoutingNode extends TileFilteredRoutingNode
{
public TileOutputRoutingNode()
{
super(1, "outputNode");
super(7, "outputNode");
}
}