Restrict Fabricator inventory more like Carpenter.

Only accept related items while recipe is active, never accept casts/meltables.
This commit is contained in:
Nirek-K committed 2015-07-15 20:41:10 -05:00
1 parent 124aba3ede
commit 454abdd2ed
1 file changed
+14 -16
@@ -169,19 +169,6 @@ public class MachineFabricator extends TilePowered implements ICrafter, ILiquidT
return null;
}
public static boolean isInventoryResource(ItemStack resource)
{
if(resource == null) {
return false;
}
for (Recipe recipe: recipes) {
if (recipe.internal.isIngredient(resource)) {
return true;
}
}
return false;
}
public static boolean isPlan(ItemStack plan) {
for (Recipe recipe : recipes) {
if (StackUtils.isIdenticalItem(recipe.getPlan(), plan)) {
@@ -590,10 +577,21 @@ public class MachineFabricator extends TilePowered implements ICrafter, ILiquidT
return RecipeManager.findMatchingSmelting(itemStack) != null;
} else if (slotIndex == SLOT_PLAN) {
return RecipeManager.isPlan(itemStack);
} else if (GuiUtil.isIndexInRange(slotIndex, SLOT_INVENTORY_1, SLOT_INVENTORY_COUNT)) {
return RecipeManager.isInventoryResource(itemStack);
}
return false;
return GuiUtil.isIndexInRange(slotIndex, SLOT_INVENTORY_1, SLOT_INVENTORY_COUNT);
}
@Override
public boolean isItemValidForSlot(int slotIndex, ItemStack itemStack) {
if (GuiUtil.isIndexInRange(slotIndex, SLOT_INVENTORY_1, SLOT_INVENTORY_COUNT)) {
if (tile.getRecipe() != null) {
return tile.getRecipe().internal.isIngredient(itemStack);
}else if (RecipeManager.isPlan(itemStack) ) {
return false;
}else if (RecipeManager.findMatchingSmelting(itemStack) != null) {
return false;
}
}
return true;
}
@Override