Added engineering table filter/blueprint support

This commit is contained in:
Calclavia 2014-01-12 13:54:53 +08:00
parent d860d672d1
commit a54e0d066a

View file

@ -18,6 +18,7 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.packet.Packet;
import resonantinduction.api.IArmbot;
import resonantinduction.api.IArmbotUseable;
import resonantinduction.archaic.imprint.ItemBlockFilter;
import resonantinduction.core.ResonantInduction;
import resonantinduction.core.prefab.ContainerFake;
import resonantinduction.electrical.encoder.coding.args.ArgumentData;
@ -273,6 +274,39 @@ public class TileEngineeringTable extends TileAdvanced implements IPacketReceive
didCraft = true;
}
// TODO: Change this later.
int imprintInputSlot = 4;
if (!didCraft)
{
ItemStack filterStack = this.craftingMatrix[imprintInputSlot];
if (filterStack != null && filterStack.getItem() instanceof ItemBlockFilter)
{
ArrayList<ItemStack> filters = ItemBlockFilter.getFilters(filterStack);
for (ItemStack outputStack : filters)
{
if (outputStack != null)
{
Pair<ItemStack, ItemStack[]> idealRecipe = this.getCraftingManager().getIdealRecipe(outputStack);
if (idealRecipe != null)
{
ItemStack recipeOutput = idealRecipe.left();
if (recipeOutput != null & recipeOutput.stackSize > 0)
{
this.output[CRAFTING_OUTPUT_SLOT] = recipeOutput;
didCraft = true;
break;
}
}
}
}
}
}
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}