diff --git a/src/main/java/techreborn/api/recipe/ITileRecipeHandler.java b/src/main/java/techreborn/api/recipe/ITileRecipeHandler.java index b0214140d..2518ff613 100644 --- a/src/main/java/techreborn/api/recipe/ITileRecipeHandler.java +++ b/src/main/java/techreborn/api/recipe/ITileRecipeHandler.java @@ -28,6 +28,7 @@ import net.minecraft.tileentity.TileEntity; /** * Created by Mark on 03/04/2016. + * @param descendant of BaseRecipe */ public interface ITileRecipeHandler { boolean canCraft(TileEntity tile, T recipe); diff --git a/src/main/java/techreborn/client/container/builder/ContainerTileInventoryBuilder.java b/src/main/java/techreborn/client/container/builder/ContainerTileInventoryBuilder.java index 9d417ff67..bdeb08303 100644 --- a/src/main/java/techreborn/client/container/builder/ContainerTileInventoryBuilder.java +++ b/src/main/java/techreborn/client/container/builder/ContainerTileInventoryBuilder.java @@ -126,6 +126,7 @@ public class ContainerTileInventoryBuilder { * @param supplier The supplier must supply a variable holding inside a Short, it * will be truncated by force. * @param setter The setter to call when the variable has been updated. + * @return ContainerTileInventoryBuilder Inventory which will do the sync */ public ContainerTileInventoryBuilder syncShortValue(final IntSupplier supplier, final IntConsumer setter) { this.parent.shortValues.add(Pair.of(supplier, setter)); @@ -136,6 +137,7 @@ public class ContainerTileInventoryBuilder { * @param supplier The supplier it can supply a variable holding in an Integer it * will be split inside multiples shorts. * @param setter The setter to call when the variable has been updated. + * @return ContainerTileInventoryBuilder Inventory which will do the sync */ public ContainerTileInventoryBuilder syncIntegerValue(final IntSupplier supplier, final IntConsumer setter) { this.parent.integerValues.add(Pair.of(supplier, setter)); diff --git a/src/main/java/techreborn/compat/crafttweaker/CTScrapbox.java b/src/main/java/techreborn/compat/crafttweaker/CTScrapbox.java index b78bf1c41..689a74603 100644 --- a/src/main/java/techreborn/compat/crafttweaker/CTScrapbox.java +++ b/src/main/java/techreborn/compat/crafttweaker/CTScrapbox.java @@ -56,7 +56,7 @@ public class CTScrapbox { @ZenMethod public static void removeRecipe(IItemStack output) { - ScrapboxList.stacks.remove(output); + ScrapboxList.stacks.remove(CraftTweakerCompat.toStack(output)); CraftTweakerAPI.apply(new Remove(CraftTweakerCompat.toStack(output), getMachineName())); } diff --git a/src/main/java/techreborn/tiles/TileAutoCraftingTable.java b/src/main/java/techreborn/tiles/TileAutoCraftingTable.java index 999e587d4..21590197a 100644 --- a/src/main/java/techreborn/tiles/TileAutoCraftingTable.java +++ b/src/main/java/techreborn/tiles/TileAutoCraftingTable.java @@ -226,41 +226,44 @@ public class TileAutoCraftingTable extends TilePowerAcceptor implements IContain } public boolean make(IRecipe recipe) { - if (canMake(recipe)) { - if (recipe == null && customRecipe) { + IRecipe recipe2 = recipe; + if (canMake(recipe2)) { + if (recipe2 == null && customRecipe) { if (lastCustomRecipe == null) { return false; }//Should be uptodate as we just set it in canMake recipe = lastCustomRecipe; } - for (int i = 0; i < recipe.getIngredients().size(); i++) { - Ingredient ingredient = recipe.getIngredients().get(i); - //Looks for the best slot to take it from - ItemStack bestSlot = inventory.getStackInSlot(i); - if (ingredient.apply(bestSlot)) { - handleContainerItem(bestSlot); - bestSlot.shrink(1); - } else { - for (int j = 0; j < 9; j++) { - ItemStack stack = inventory.getStackInSlot(j); - if (ingredient.apply(stack)) { - handleContainerItem(stack); - stack.shrink(1); //TODO is this right? or do I need to use it as an actull crafting grid - break; + else if (recipe2 != null) { + for (int i = 0; i < recipe2.getIngredients().size(); i++) { + Ingredient ingredient = recipe2.getIngredients().get(i); + //Looks for the best slot to take it from + ItemStack bestSlot = inventory.getStackInSlot(i); + if (ingredient.apply(bestSlot)) { + handleContainerItem(bestSlot); + bestSlot.shrink(1); + } else { + for (int j = 0; j < 9; j++) { + ItemStack stack = inventory.getStackInSlot(j); + if (ingredient.apply(stack)) { + handleContainerItem(stack); + stack.shrink(1); //TODO is this right? or do I need to use it as an actull crafting grid + break; + } } } } + ItemStack output = inventory.getStackInSlot(9); + //TODO fire forge recipe event + ItemStack ouputStack = recipe2.getCraftingResult(getCraftingInventory()); + if (output.isEmpty()) { + inventory.setInventorySlotContents(9, ouputStack.copy()); + } else { + //TODO use ouputStack in someway? + output.grow(recipe2.getRecipeOutput().getCount()); + } + return true; } - ItemStack output = inventory.getStackInSlot(9); - //TODO fire forge recipe event - ItemStack ouputStack = recipe.getCraftingResult(getCraftingInventory()); - if (output.isEmpty()) { - inventory.setInventorySlotContents(9, ouputStack.copy()); - } else { - //TODO use ouputStack in someway? - output.grow(recipe.getRecipeOutput().getCount()); - } - return true; } return false; }