Skip to content
This repository has been archived by the owner on May 26, 2024. It is now read-only.

Commit

Permalink
Fixes based on feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdielKavash committed Feb 28, 2024
1 parent 2a7efb1 commit a13ddab
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -165,6 +166,11 @@ public boolean supportsBatchMode() {
return false;
}

@Override
public boolean isBatchModeEnabled() {
return false;
}

@Override
public int getMaxEfficiency(final ItemStack aStack) {
return 10000;
Expand Down Expand Up @@ -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<Mode, ItemStack> 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));
Expand All @@ -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]);
Expand All @@ -339,7 +345,7 @@ public CheckRecipeResult process() {
duration = TICKS_PER_OPERATION;
calculatedEut = GT_Values.VP[tier];

return CheckRecipeResultRegistry.SUCCESSFUL;
return SimpleCheckRecipeResult.ofSuccess("growing_trees");
}
};
}
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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),
Expand All @@ -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),
Expand All @@ -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),
Expand All @@ -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),
Expand Down Expand Up @@ -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),
Expand All @@ -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),
Expand All @@ -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),
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand All @@ -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),
Expand Down Expand Up @@ -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),
Expand All @@ -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),
Expand All @@ -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),
Expand Down Expand Up @@ -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),
Expand All @@ -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),
Expand All @@ -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),
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -697,7 +679,6 @@ private static void generateForestryTrees() {
}
}

@Optional.Method(modid = Mods.Names.EXTRA_TREES)
private static void generateExtraTreesTrees() {
for (ExtraTreeSpecies species : ExtraTreeSpecies.values()) {

Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/gregtech/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit a13ddab

Please sign in to comment.