mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-22 04:52:26 +00:00
Restrict Fabricator inventory more like Carpenter.
Only accept related items while recipe is active, never accept casts/meltables.
This commit is contained in:
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
|
||||
|
||||
Reference in new issue
Block a user