diff --git a/src/main/scala/net/bdew/neiaddons/forestry/BaseProduceRecipeHandler.java b/src/main/scala/net/bdew/neiaddons/forestry/BaseProduceRecipeHandler.java index b92337b..122f40f 100644 --- a/src/main/scala/net/bdew/neiaddons/forestry/BaseProduceRecipeHandler.java +++ b/src/main/scala/net/bdew/neiaddons/forestry/BaseProduceRecipeHandler.java @@ -45,7 +45,7 @@ public BaseProduceRecipeHandler(ISpeciesRoot root) { public class CachedProduceRecipe extends CachedRecipe { private LabeledPositionedStack producer; - private ArrayList products; + private final ArrayList products; public CachedProduceRecipe(IAlleleSpecies species) { ItemStack producerStack = GeneticsUtils.stackFromSpecies(species, GeneticsUtils.RecipePosition.Producer); @@ -55,7 +55,7 @@ public CachedProduceRecipe(IAlleleSpecies species) { producer = new LabeledPositionedStack(producerStack, 22, 19, species.getName(), 13); } - products = new ArrayList(); + products = new ArrayList<>(); int i = 0; for (Entry product : Utils.mergeStacks(GeneticsUtils.getProduceFromSpecies(species)) @@ -64,15 +64,16 @@ public CachedProduceRecipe(IAlleleSpecies species) { products.add(new LabeledPositionedStack(product.getKey(), 96 + 22 * i++, 8, label, 10)); } + String jubilance = null; + if (species instanceof IAlleleBeeSpeciesCustom) { + IJubilanceProvider provider = ((IAlleleBeeSpeciesCustom) species).getJubilanceProvider(); + if (provider != null) jubilance = provider.getDescription(); + } + i = 0; for (Entry product : Utils.mergeStacks(GeneticsUtils.getSpecialtyFromSpecies(species)) .entrySet()) { String label = String.format("%.1f%%", product.getValue() * 100F); - String jubilance = null; - if (species instanceof IAlleleBeeSpeciesCustom) { - IJubilanceProvider provider = ((IAlleleBeeSpeciesCustom) species).getJubilanceProvider(); - if (provider != null) jubilance = provider.getDescription(); - } if (jubilance != null) products.add(new LabeledPositionedStack( product.getKey(), 96 + 22 * i++, 36, label, 10, EnumChatFormatting.GRAY + jubilance)); @@ -110,6 +111,10 @@ public PositionedStack getResult() { return null; } } + + public ArrayList getProducts() { + return products; + } } @Override @@ -134,11 +139,8 @@ public void loadCraftingRecipes(String outputId, Object... results) { @Override public List handleItemTooltip(GuiRecipe gui, ItemStack stack, List currenttip, int recipe) { CachedProduceRecipe crecipe = (CachedProduceRecipe) this.arecipes.get(recipe); - for (PositionedStack positionedStack : crecipe.getOtherStacks()) { - if (stack == positionedStack.item) { - currenttip.addAll(((LabeledPositionedStack) positionedStack).getTooltip()); - } - } + for (LabeledPositionedStack positionedStack : crecipe.getProducts()) + if (stack == positionedStack.item) currenttip.addAll(positionedStack.getTooltip()); return currenttip; }