diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java index 2ea5fa6d3c..5ce6c2db45 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntityTreeFarm.java @@ -47,6 +47,7 @@ import gregtech.api.recipe.RecipeMap; import gregtech.api.recipe.check.CheckRecipeResult; import gregtech.api.recipe.check.CheckRecipeResultRegistry; +import gregtech.api.recipe.check.SimpleCheckRecipeResult; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; @@ -165,6 +166,11 @@ public boolean supportsBatchMode() { return false; } + @Override + public boolean isBatchModeEnabled() { + return false; + } + @Override public int getMaxEfficiency(final ItemStack aStack) { return 10000; @@ -296,13 +302,13 @@ public CheckRecipeResult process() { } ItemStack sapling = findSapling(); - if (sapling == null) return CheckRecipeResultRegistry.NO_RECIPE; + if (sapling == null) return SimpleCheckRecipeResult.ofFailure("no_sapling"); EnumMap outputPerMode = getOutputsForSapling(sapling); if (outputPerMode == null) { // This should usually not be possible, outputs for all valid saplings should be defined. Logger.INFO("No output found for sapling: " + sapling.getDisplayName()); - return CheckRecipeResultRegistry.NO_RECIPE; + return SimpleCheckRecipeResult.ofFailure("no_output_for_sapling"); } int tier = Math.max(1, GT_Utility.getTier(availableVoltage * availableAmperage)); @@ -325,7 +331,7 @@ public CheckRecipeResult process() { if (outputs.isEmpty()) { // No outputs can be produced using the tools we have available. - return CheckRecipeResultRegistry.NO_RECIPE; + return SimpleCheckRecipeResult.ofFailure("no_tools"); } outputItems = outputs.toArray(new ItemStack[0]); @@ -339,7 +345,7 @@ public CheckRecipeResult process() { duration = TICKS_PER_OPERATION; calculatedEut = GT_Values.VP[tier]; - return CheckRecipeResultRegistry.SUCCESSFUL; + return SimpleCheckRecipeResult.ofSuccess("growing_trees"); } }; } @@ -355,24 +361,24 @@ public CheckRecipeResult process() { private int useToolForMode(Mode mode) { for (ItemStack stack : getStoredInputs()) { int toolMultiplier = getToolMultiplier(stack, mode); - if (toolMultiplier > 0) { - boolean canDamage = GT_ModHandler - .damageOrDechargeItem(stack, TOOL_DAMAGE_PER_OPERATION, TOOL_CHARGE_PER_OPERATION, null); - if (canDamage) { - // Tool was used. - if (GT_ModHandler.isElectricItem(stack) - && !GT_ModHandler.canUseElectricItem(stack, TOOL_CHARGE_PER_OPERATION)) { - // Tool is out of charge, move it to output. - depleteInput(stack); - addOutput(stack); - } - return toolMultiplier; - } else { - // Correct item type, but the tool could not be used. + if (toolMultiplier < 0) continue; + boolean canDamage = GT_ModHandler + .damageOrDechargeItem(stack, TOOL_DAMAGE_PER_OPERATION, TOOL_CHARGE_PER_OPERATION, null); + if (canDamage) { + // Tool was used. + if (GT_ModHandler.isElectricItem(stack) + && !GT_ModHandler.canUseElectricItem(stack, TOOL_CHARGE_PER_OPERATION)) { + // Tool is out of charge, move it to output. depleteInput(stack); addOutput(stack); } + return toolMultiplier; + } else { + // Correct item type, but the tool could not be used. + depleteInput(stack); + addOutput(stack); } + } return -1; } diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_TreeFarm.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_TreeFarm.java index acac282d2c..76b8bc853e 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_TreeFarm.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/recipe/RecipeLoader_TreeFarm.java @@ -6,7 +6,6 @@ import net.minecraft.nbt.NBTTagCompound; import binnie.extratrees.genetics.ExtraTreeSpecies; -import cpw.mods.fml.common.Optional; import forestry.api.arboriculture.EnumGermlingType; import forestry.api.arboriculture.EnumWoodType; import forestry.api.arboriculture.ITree; @@ -96,7 +95,6 @@ private static void generateVanillaTrees() { null); } - @Optional.Method(modid = Mods.Names.INDUSTRIAL_CRAFT2) private static void generateIC2Trees() { GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Rubber Tree GT_ModHandler.getModItem(Mods.IndustrialCraft2.ID, "blockRubSapling", 1, 0), @@ -105,7 +103,6 @@ private static void generateIC2Trees() { GT_ModHandler.getModItem(Mods.IndustrialCraft2.ID, "itemHarz", 1, 0)); } - @Optional.Method(modid = Mods.Names.TINKER_CONSTRUCT) private static void generateTinkersTrees() { GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Slimy GT_ModHandler.getModItem(Mods.TinkerConstruct.ID, "slime.sapling", 1, 0), @@ -114,7 +111,6 @@ private static void generateTinkersTrees() { GT_ModHandler.getModItem(Mods.TinkerConstruct.ID, "strangeFood", 1, 0)); } - @Optional.Method(modid = Mods.Names.G_T_PLUS_PLUS) private static void generateGTPPTrees() { GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Rainforest Oak GT_ModHandler.getModItem(Mods.GTPlusPlus.ID, "blockRainforestOakSapling", 1, 0), @@ -129,7 +125,6 @@ private static void generateGTPPTrees() { GT_ModHandler.getModItem(Mods.GTPlusPlus.ID, "item.BasicAgrichemItem", 1, 24)); } - @Optional.Method(modid = Mods.Names.TWILIGHT_FOREST) private static void generateTwilightForestTrees() { GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Sickly Twilight Oak GT_ModHandler.getModItem(Mods.TwilightForest.ID, "tile.TFSapling", 1, 0), @@ -202,7 +197,6 @@ private static void generateTwilightForestTrees() { null); } - @Optional.Method(modid = Mods.Names.GALAXY_SPACE) private static void generateGalaxySpaceTrees() { GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Barnarda C GT_ModHandler.getModItem(Mods.GalaxySpace.ID, "barnardaCsapling", 1, 0), @@ -211,7 +205,6 @@ private static void generateGalaxySpaceTrees() { null); } - @Optional.Method(modid = Mods.Names.GALACTICRAFT_AMUN_RA) private static void generateAmunRaTrees() { GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Virilig GT_ModHandler.getModItem(Mods.GalacticraftAmunRa.ID, "tile.saplings", 1, 0), @@ -226,7 +219,6 @@ private static void generateAmunRaTrees() { GT_ModHandler.getModItem(Mods.GalacticraftAmunRa.ID, "tile.wood1", 1, 1)); } - @Optional.Method(modid = Mods.Names.NATURA) private static void generateNaturaTrees() { GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Redwood GT_ModHandler.getModItem(Mods.Natura.ID, "florasapling", 1, 0), @@ -326,7 +318,6 @@ private static void generateNaturaTrees() { null); } - @Optional.Method(modid = Mods.Names.BIOMES_O_PLENTY) private static void generateBOPTrees() { GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Apple GT_ModHandler.getModItem(Mods.BiomesOPlenty.ID, "saplings", 1, 0), @@ -486,7 +477,6 @@ private static void generateBOPTrees() { null); } - @Optional.Method(modid = Mods.Names.PAMS_HARVEST_CRAFT) private static void addPamTree(String name, int meta) { GregtechMetaTileEntityTreeFarm.registerTreeProducts( GT_ModHandler.getModItem(Mods.PamsHarvestCraft.ID, "pam" + name + "Sapling", 1, 0), @@ -495,7 +485,6 @@ private static void addPamTree(String name, int meta) { GT_ModHandler.getModItem(Mods.PamsHarvestCraft.ID, name + "Item", 2, 0)); } - @Optional.Method(modid = Mods.Names.PAMS_HARVEST_CRAFT) private static void generatePamsTrees() { GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Cinnamon GT_ModHandler.getModItem(Mods.PamsHarvestCraft.ID, "pamappleSapling", 1, 0), @@ -558,7 +547,6 @@ private static void generatePamsTrees() { addPamTree("gooseberry", 0); } - @Optional.Method(modid = Mods.Names.PAMS_HARVEST_THE_NETHER) private static void generatePamsNetherTrees() { GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Ignis Fruit GT_ModHandler.getModItem(Mods.PamsHarvestTheNether.ID, "netherSapling", 1, 0), @@ -567,7 +555,6 @@ private static void generatePamsNetherTrees() { GT_ModHandler.getModItem(Mods.PamsHarvestTheNether.ID, "ignisfruitItem", 2, 0)); } - @Optional.Method(modid = Mods.Names.THAUMCRAFT) private static void generateThaumcraftTrees() { GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Greatwood GT_ModHandler.getModItem(Mods.Thaumcraft.ID, "blockCustomPlant", 1, 0), @@ -582,7 +569,6 @@ private static void generateThaumcraftTrees() { null); } - @Optional.Method(modid = Mods.Names.THAUMIC_BASES) private static void generateThaumicBasesTrees() { GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Golden Oak GT_ModHandler.getModItem(Mods.ThaumicBases.ID, "goldenOakSapling", 1, 0), @@ -610,7 +596,6 @@ private static void generateThaumicBasesTrees() { null); } - @Optional.Method(modid = Mods.Names.TAINTED_MAGIC) private static void generateTaintedMagicTrees() { GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Warpwood GT_ModHandler.getModItem(Mods.TaintedMagic.ID, "BlockWarpwoodSapling", 1, 0), @@ -619,7 +604,6 @@ private static void generateTaintedMagicTrees() { null); } - @Optional.Method(modid = Mods.Names.FORBIDDEN_MAGIC) private static void generateForbiddenMagicTrees() { GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Warpwood GT_ModHandler.getModItem(Mods.ForbiddenMagic.ID, "TaintSapling", 1, 0), @@ -628,7 +612,6 @@ private static void generateForbiddenMagicTrees() { GT_ModHandler.getModItem(Mods.ForbiddenMagic.ID, "TaintFruit", 1, 0)); } - @Optional.Method(modid = Mods.Names.WITCHERY) private static void generateWitcheryTrees() { GregtechMetaTileEntityTreeFarm.registerTreeProducts( // Rowan GT_ModHandler.getModItem(Mods.Witchery.ID, "witchsapling", 1, 0), @@ -657,7 +640,6 @@ private static void generateWitcheryTrees() { * than I do, and knows a more straightforward way to retrieve the relevant ItemStacks here, please update this. */ - @Optional.Method(modid = Mods.Names.FORESTRY) private static void generateForestryTrees() { for (TreeDefinition tree : TreeDefinition.values()) { String speciesUID = tree.getUID(); @@ -697,7 +679,6 @@ private static void generateForestryTrees() { } } - @Optional.Method(modid = Mods.Names.EXTRA_TREES) private static void generateExtraTreesTrees() { for (ExtraTreeSpecies species : ExtraTreeSpecies.values()) { diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang index 1a49d1a297..5b9e9dd59f 100644 --- a/src/main/resources/assets/gregtech/lang/en_US.lang +++ b/src/main/resources/assets/gregtech/lang/en_US.lang @@ -17,6 +17,8 @@ GT5U.gui.text.managing_power=§aManaging power GT5U.gui.text.no_scrap=§aInput too low quality GT5U.gui.text.warm_up=§aWarming up GT5U.gui.text.machine_locked_to_different_recipe=§7Machine is already locked to a different recipe +GT5U.gui.text.no_output_for_sapling=§7This sapling yields no outputs +GT5U.gui.text.no_tools=§7Missing applicable tools GTPP.EBF.heat=Heat capacity