From b8ebc3d68d7c8fae96ff464360d75b9142abb9f6 Mon Sep 17 00:00:00 2001 From: boubou19 Date: Mon, 24 Jun 2024 17:08:01 +0200 Subject: Put some sanity in GT_MetaGenerated_Item_02/03 and in GT_MetaGenerated_Tool_01 (#2659) * enum work * sorting the class * extracting the enum in its own class * initial enum work for GT_MetaGenerated_Item_03 * split * finished enum work * extract enum in its own class * migrate to enum * remove duplicated recipes * sorted enums * extracted enum in its own class * spotless * fix compilation errors * spotless * fix mistake --- .../base/GregtechMeta_MultiBlockBase.java | 25 ++--- .../GregtechMetaAtmosphericReconditioner.java | 7 +- .../production/GregtechMetaTileEntityTreeFarm.java | 113 +++++++++++---------- .../gregtech/loaders/ProcessingElectricSnips.java | 3 +- 4 files changed, 79 insertions(+), 69 deletions(-) (limited to 'src/main/java/gtPlusPlus/xmod/gregtech') diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index 0a38677d51..e19a25981d 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -74,6 +74,7 @@ import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.api.util.IGT_HatchAdder; import gregtech.common.items.GT_MetaGenerated_Tool_01; +import gregtech.common.items.ID_MetaTool_01; import gregtech.common.tileentities.machines.IDualInputHatch; import gtPlusPlus.GTplusplus; import gtPlusPlus.GTplusplus.INIT_PHASE; @@ -1606,52 +1607,52 @@ public abstract class GregtechMeta_MultiBlockBaseyield: Affects fruit output. * * See {@link forestry.core.genetics.alleles.EnumAllele} for detailed numeric values for each allele. - * + * * @param sapling A sapling to farm. Must be a Forestry sapling with a valid genome. * @return A map of outputs for each mode. Outputs for some modes might be null. */ @@ -650,7 +657,7 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase< * Registers outputs for a sapling. This method assumes that output in mode SAPLING is the same as the input * sapling. Output amount is further modified by mode, machine tier, and tool used. Recipes are added in * {@link gtPlusPlus.xmod.gregtech.loaders.recipe.RecipeLoader_TreeFarm}. - * + * * @param sapling The input sapling to farm, and also the output in mode SAPLING. * @param log ItemStack to output in mode LOG. * @param leaves ItemStack to output in mode LEAVES. @@ -723,32 +730,32 @@ public class GregtechMetaTileEntityTreeFarm extends GregtechMeta_MultiBlockBase< GT_MetaGenerated_Tool toolInstance = GT_MetaGenerated_Tool_01.INSTANCE; altToolsForNEI = new ItemStack[][] { // Mode.LOG - { toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.SAW, 1, null, null, null), - toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.POCKET_SAW, 1, null, null, null), - toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.BUZZSAW_LV, 1, null, null, null), - toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.CHAINSAW_LV, 1, null, null, null), - toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.BUZZSAW_MV, 1, null, null, null), - toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.CHAINSAW_MV, 1, null, null, null), - toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.BUZZSAW_HV, 1, null, null, null), - toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.CHAINSAW_HV, 1, null, null, null), }, + { toolInstance.getToolWithStats(SAW.ID, 1, null, null, null), + toolInstance.getToolWithStats(POCKET_SAW.ID, 1, null, null, null), + toolInstance.getToolWithStats(ID_MetaTool_01.BUZZSAW_LV.ID, 1, null, null, null), + toolInstance.getToolWithStats(CHAINSAW_LV.ID, 1, null, null, null), + toolInstance.getToolWithStats(ID_MetaTool_01.BUZZSAW_MV.ID, 1, null, null, null), + toolInstance.getToolWithStats(CHAINSAW_MV.ID, 1, null, null, null), + toolInstance.getToolWithStats(ID_MetaTool_01.BUZZSAW_HV.ID, 1, null, null, null), + toolInstance.getToolWithStats(CHAINSAW_HV.ID, 1, null, null, null), }, // Mode.SAPLING - { toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.BRANCHCUTTER, 1, null, null, null), - toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.POCKET_BRANCHCUTTER, 1, null, null, null), + { toolInstance.getToolWithStats(ID_MetaTool_01.BRANCHCUTTER.ID, 1, null, null, null), + toolInstance.getToolWithStats(ID_MetaTool_01.POCKET_BRANCHCUTTER.ID, 1, null, null, null), GT_ModHandler.getModItem(Mods.Forestry.ID, "grafter", 1, 0), }, // Mode.LEAVES { new ItemStack(Items.shears), - toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.WIRECUTTER, 1, null, null, null), - toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.POCKET_WIRECUTTER, 1, null, null, null), + toolInstance.getToolWithStats(ID_MetaTool_01.WIRECUTTER.ID, 1, null, null, null), + toolInstance.getToolWithStats(ID_MetaTool_01.POCKET_WIRECUTTER.ID, 1, null, null, null), MetaGeneratedGregtechTools.getInstance() .getToolWithStats(MetaGeneratedGregtechTools.ELECTRIC_SNIPS, 1, null, null, null), }, // Mode.FRUIT - { toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.KNIFE, 1, null, null, null), - toolInstance.getToolWithStats(GT_MetaGenerated_Tool_01.POCKET_KNIFE, 1, null, null, null), } }; + { toolInstance.getToolWithStats(ID_MetaTool_01.KNIFE.ID, 1, null, null, null), + toolInstance.getToolWithStats(ID_MetaTool_01.POCKET_KNIFE.ID, 1, null, null, null), } }; } /** * Add a recipe for this tree to NEI. These recipes are only used in NEI, they are never used for processing logic. - * + * * @return True if the recipe was added successfully. */ public static boolean addFakeRecipeToNEI(ItemStack saplingIn, ItemStack log, ItemStack saplingOut, ItemStack leaves, diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricSnips.java b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricSnips.java index 9a60f2c6bf..a894a7ad62 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricSnips.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricSnips.java @@ -9,6 +9,7 @@ import gregtech.api.enums.OrePrefixes; import gregtech.api.enums.SubTag; import gregtech.api.util.GT_OreDictUnificator; import gregtech.common.items.GT_MetaGenerated_Tool_01; +import gregtech.common.items.ID_MetaTool_01; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.recipe.common.CI; @@ -112,7 +113,7 @@ public class ProcessingElectricSnips implements Interface_OreRecipeRegistrator, new long[] { aBatteryStorage, GT_Values.V[aVoltageTier], 3L, -1L }); ItemStack aInputCutter = GT_MetaGenerated_Tool_01.INSTANCE - .getToolWithStats(GT_MetaGenerated_Tool_01.WIRECUTTER, 1, aMaterial, aMaterial, null); + .getToolWithStats(ID_MetaTool_01.WIRECUTTER.ID, 1, aMaterial, aMaterial, null); long aDura = MetaGeneratedGregtechTools.getToolMaxDamage(aOutputStack); if (aDura <= 32000) { -- cgit