diff --git a/src/main/java/com/blakebr0/extendedcrafting/client/gui/GuiCraftingCore.java b/src/main/java/com/blakebr0/extendedcrafting/client/gui/GuiCraftingCore.java index 177abc26..35d8014c 100644 --- a/src/main/java/com/blakebr0/extendedcrafting/client/gui/GuiCraftingCore.java +++ b/src/main/java/com/blakebr0/extendedcrafting/client/gui/GuiCraftingCore.java @@ -35,10 +35,10 @@ private int getEnergyBarScaled(int pixels) { } private int getProgressBarScaled(int pixels) { - int i = this.tile.getProgress(); + long i = this.tile.getProgress(); CombinationRecipe recipe = this.tile.getRecipe(); long j = recipe == null ? 0 : recipe.getCost(); - return (int) (j != 0 && i != 0 ? (long) i * pixels / j : 0); + return (int) (j != 0 && i != 0 ? i * pixels / j : 0); } @Override diff --git a/src/main/java/com/blakebr0/extendedcrafting/compat/jei/combinationcrafting/CombinationCraftingWrapper.java b/src/main/java/com/blakebr0/extendedcrafting/compat/jei/combinationcrafting/CombinationCraftingWrapper.java index 7f60c9db..7439aff4 100644 --- a/src/main/java/com/blakebr0/extendedcrafting/compat/jei/combinationcrafting/CombinationCraftingWrapper.java +++ b/src/main/java/com/blakebr0/extendedcrafting/compat/jei/combinationcrafting/CombinationCraftingWrapper.java @@ -28,11 +28,14 @@ public class CombinationCraftingWrapper implements IRecipeWrapper { public CombinationCraftingWrapper(IJeiHelpers helpers, CombinationRecipe recipe) { this.helpers = helpers; this.recipe = recipe; - int period = recipe.getPedestalIngredients() - .stream() - .map(Ingredient::getMatchingStacks) - .map(a -> a.length) - .reduce(1, (a, b) -> a * b); + + int period = Math.max(1, recipe.getInputIngredient().getMatchingStacks().length); + for (Ingredient ingredient : recipe.getPedestalIngredients()) { + int length = ingredient.getMatchingStacks().length; + if (length > 0) { + period *= length; + } + } timer = helpers.getGuiHelper() .createTickTimer(period * 20, period, false); } @@ -47,6 +50,13 @@ public List getTooltipStrings(int mouseX, int mouseY) { ArrayList tooltip = new ArrayList<>(); tooltip.add(Utils.localize("tooltip.ec.items_required")); Object2IntLinkedOpenHashMap tooltipCount = new Object2IntLinkedOpenHashMap<>(); + + ItemStack[] coreStacks = recipe.getInputIngredient().getMatchingStacks(); + if(coreStacks.length != 0) { + String line = coreStacks[timer.getValue() % coreStacks.length].getDisplayName(); + tooltipCount.put(line, tooltipCount.getInt(line) + 1); + } + for (Ingredient ing : recipe.getPedestalIngredients()) { ItemStack[] stacks = ing.getMatchingStacks(); if(stacks.length == 0) continue; diff --git a/src/main/java/com/blakebr0/extendedcrafting/tile/TileCraftingCore.java b/src/main/java/com/blakebr0/extendedcrafting/tile/TileCraftingCore.java index 2714e129..426d57a4 100644 --- a/src/main/java/com/blakebr0/extendedcrafting/tile/TileCraftingCore.java +++ b/src/main/java/com/blakebr0/extendedcrafting/tile/TileCraftingCore.java @@ -39,7 +39,7 @@ public class TileCraftingCore extends TileEntity implements ITickable, IGTEnergy private final ItemStackHandler inventory = new StackHandler(); private final EnergyStorageCustom energy = new EnergyStorageCustom(ModConfig.confCraftingCoreRFCapacity); - private int progress; + private long progress; private int oldEnergy; private int pedestalCount; @@ -166,6 +166,8 @@ public CombinationRecipe getRecipe(List locations) { if (!recipes.isEmpty()) { for (CombinationRecipe recipe : recipes) { + if (recipe.getPedestalIngredients().isEmpty()) + return recipe; List pedestals = this.getPedestalsWithStuff(recipe, locations); if (!pedestals.isEmpty()) return recipe; @@ -175,7 +177,7 @@ public CombinationRecipe getRecipe(List locations) { return null; } - public int getProgress() { + public long getProgress() { return this.progress; } @@ -196,7 +198,7 @@ public int getPedestalCount() { public void readFromNBT(NBTTagCompound tag) { super.readFromNBT(tag); this.inventory.deserializeNBT(tag); - this.progress = tag.getInteger("Progress"); + this.progress = tag.getLong("Progress"); this.energy.setEnergy(tag.getInteger("Energy")); } @@ -204,7 +206,7 @@ public void readFromNBT(NBTTagCompound tag) { public NBTTagCompound writeToNBT(NBTTagCompound tag) { tag = super.writeToNBT(tag); tag.merge(this.inventory.serializeNBT()); - tag.setInteger("Progress", this.progress); + tag.setLong("Progress", this.progress); tag.setInteger("Energy", this.energy.getEnergyStored()); return tag;