diff options
Diffstat (limited to 'src/main/java/gregtech/api/util')
4 files changed, 35 insertions, 61 deletions
diff --git a/src/main/java/gregtech/api/util/GT_BaseCrop.java b/src/main/java/gregtech/api/util/GT_BaseCrop.java index c379cec52a..d8608c85a0 100644 --- a/src/main/java/gregtech/api/util/GT_BaseCrop.java +++ b/src/main/java/gregtech/api/util/GT_BaseCrop.java @@ -115,12 +115,10 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo { mStats[4] = aStatWeed; mAttributes = aAttributes; mBlock = aBlock; - if (GregTech_API.sRecipeFile.get(ConfigCategories.Recipes.crops, aCropName, true)) { - if (!Crops.instance.registerCrop(this, aID)) - throw new GT_ItsNotMyFaultException("Make sure the Crop ID is valid!"); - if (aBaseSeed != null) Crops.instance.registerBaseSeed(aBaseSeed, this, 1, 1, 1, 1); - sCropList.add(this); - } + if (!Crops.instance.registerCrop(this, aID)) + throw new GT_ItsNotMyFaultException("Make sure the Crop ID is valid!"); + if (aBaseSeed != null) Crops.instance.registerBaseSeed(aBaseSeed, this, 1, 1, 1, 1); + sCropList.add(this); } if (bIc2NeiLoaded) { try { @@ -226,7 +224,7 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo { /** * Checks if the crop needs a block below it - * + * * @return True if the crop needs a block below it to grow to its max size */ public boolean needsBlockBelow() { @@ -263,7 +261,7 @@ public class GT_BaseCrop extends CropCard implements ICropCardInfo { /** * An isolated function to check if an item stack is a block that should be below this crop - * + * * @param aItem a stack of the block placed under the crop * @return The result of the check */ diff --git a/src/main/java/gregtech/api/util/GT_ModHandler.java b/src/main/java/gregtech/api/util/GT_ModHandler.java index 0ada5df764..70dc2f30b0 100644 --- a/src/main/java/gregtech/api/util/GT_ModHandler.java +++ b/src/main/java/gregtech/api/util/GT_ModHandler.java @@ -58,7 +58,6 @@ import net.minecraftforge.oredict.ShapelessOreRecipe; import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.GT_Values; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; @@ -494,8 +493,6 @@ public class GT_ModHandler { if (aOutput == null || aChance <= 0) return false; aOutput.stackSize = 1; if (GT_Config.troll && !GT_Utility.areStacksEqual(aOutput, new ItemStack(Items.wooden_hoe, 1, 0))) return false; - aChance = (float) GregTech_API.sRecipeFile.get(ConfigCategories.Machines.scrapboxdrops, aOutput, aChance); - if (aChance <= 0) return false; try { GT_Utility.callMethod( GT_Utility.getFieldContent("ic2.api.recipe.Recipes", "scrapboxDrops", true, true), @@ -538,7 +535,6 @@ public class GT_ModHandler { public static boolean addSmeltingRecipe(ItemStack aInput, ItemStack aOutput) { aOutput = GT_OreDictUnificator.get(true, aOutput); if (aInput == null || aOutput == null) return false; - if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.smelting, aInput, true)) return false; FurnaceRecipes.smelting() .func_151394_a(aInput, GT_Utility.copyOrNull(aOutput), 0.0F); return true; @@ -562,10 +558,6 @@ public class GT_ModHandler { || (OrePrefixes.gem.contains(aInput)))) { return false; } - int duration = GregTech_API.sRecipeFile.get("alloysmelting", input2 == null ? aInput : aOutput, 130); - if (duration <= 0) { - return false; - } GT_RecipeBuilder recipeBuilder = GT_Values.RA.stdBuilder(); if (input2 == null) { recipeBuilder.itemInputs(aInput); @@ -573,7 +565,7 @@ public class GT_ModHandler { recipeBuilder.itemInputs(aInput, input2); } recipeBuilder.itemOutputs(aOutput) - .duration(duration * TICKS) + .duration(6 * SECONDS + 10 * TICKS) .eut(3) .recipeCategory(RecipeCategories.alloySmelterRecycling); if (hidden) { @@ -617,7 +609,6 @@ public class GT_ModHandler { public static boolean addExtractionRecipe(ItemStack aInput, ItemStack aOutput) { aOutput = GT_OreDictUnificator.get(true, aOutput); if (aInput == null || aOutput == null) return false; - if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.extractor, aInput, true)) return false; RA.stdBuilder() .itemInputs(aInput) .itemOutputs(aOutput) @@ -894,7 +885,6 @@ public class GT_ModHandler { @Deprecated public static boolean addThermalCentrifugeRecipe(ItemStack aInput, int[] aChances, int aHeat, Object... aOutput) { if (aInput == null || aOutput == null || aOutput.length == 0 || aOutput[0] == null) return false; - if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.thermalcentrifuge, aInput, true)) return false; RA.addThermalCentrifugeRecipe( aInput, (ItemStack) aOutput[0], @@ -909,7 +899,6 @@ public class GT_ModHandler { @Deprecated public static boolean addThermalCentrifugeRecipe(ItemStack aInput, int aHeat, Object... aOutput) { if (aInput == null || aOutput == null || aOutput.length == 0 || aOutput[0] == null) return false; - if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.thermalcentrifuge, aInput, true)) return false; RA.addThermalCentrifugeRecipe( aInput, (ItemStack) aOutput[0], @@ -925,7 +914,6 @@ public class GT_ModHandler { */ public static boolean addOreWasherRecipe(ItemStack aInput, int[] aChances, int aWaterAmount, Object... aOutput) { if (aInput == null || aOutput == null || aOutput.length == 0 || aOutput[0] == null) return false; - if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.orewashing, aInput, true)) return false; RA.stdBuilder() .itemInputs(aInput) .itemOutputs((ItemStack) aOutput[0], (ItemStack) aOutput[1], (ItemStack) aOutput[2]) @@ -948,7 +936,6 @@ public class GT_ModHandler { public static boolean addOreWasherRecipe(ItemStack aInput, int aWaterAmount, Object... aOutput) { if (aInput == null || aOutput == null || aOutput.length == 0 || aOutput[0] == null) return false; - if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.orewashing, aInput, true)) return false; RA.stdBuilder() .itemInputs(aInput) .itemOutputs((ItemStack) aOutput[0], (ItemStack) aOutput[1], (ItemStack) aOutput[2]) @@ -982,7 +969,6 @@ public class GT_ModHandler { public static boolean addCompressionRecipe(ItemStack aInput, ItemStack aOutput, int duration, int EUPerTick) { aOutput = GT_OreDictUnificator.get(true, aOutput); if (aInput == null || aOutput == null || GT_Utility.areStacksEqual(aInput, aOutput, true)) return false; - if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.compression, aInput, true)) return false; RA.addCompressorRecipe(aInput, aOutput, duration, EUPerTick); return true; } @@ -992,7 +978,6 @@ public class GT_ModHandler { */ public static boolean addIC2MatterAmplifier(ItemStack aAmplifier, int aValue) { if (aAmplifier == null || aValue <= 0) return false; - if (!GregTech_API.sRecipeFile.get(ConfigCategories.Machines.massfabamplifier, aAmplifier, true)) return false; try { NBTTagCompound tNBT = new NBTTagCompound(); tNBT.setInteger("amplification", aValue); diff --git a/src/main/java/gregtech/api/util/GT_RecipeConstants.java b/src/main/java/gregtech/api/util/GT_RecipeConstants.java index 8e728030f2..d9d6c7d7d2 100644 --- a/src/main/java/gregtech/api/util/GT_RecipeConstants.java +++ b/src/main/java/gregtech/api/util/GT_RecipeConstants.java @@ -14,7 +14,6 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; import cpw.mods.fml.common.registry.GameRegistry; -import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.interfaces.IRecipeMap; @@ -105,7 +104,7 @@ public class GT_RecipeConstants { if (!GT_Utility.isArrayOfLength(builder.getItemInputsBasic(), 1) || GT_Utility.isArrayEmptyOrNull(builder.getItemOutputs())) return Collections.emptyList(); int aDuration = builder.getDuration(); - if ((aDuration = GregTech_API.sRecipeFile.get("arcfurnace", builder.getItemInputBasic(0), aDuration)) <= 0) { + if (aDuration <= 0) { return Collections.emptyList(); } builder.duration(aDuration); @@ -291,10 +290,7 @@ public class GT_RecipeConstants { if (!builder.isValid()) return Collections.emptyList(); Integer fuelType = builder.getMetadata(FUEL_TYPE); if (fuelType == null) return Collections.emptyList(); - builder.metadata( - FUEL_VALUE, - GregTech_API.sRecipeFile - .get("fuel_" + fuelType, builder.getItemInputBasic(0), builder.getMetadataOrDefault(FUEL_VALUE, 0))); + builder.metadata(FUEL_VALUE, builder.getMetadataOrDefault(FUEL_VALUE, 0)); return FuelType.get(fuelType) .getTarget() .doAdd(builder); diff --git a/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java b/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java index e36e9c68af..f4490b59b0 100644 --- a/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java +++ b/src/main/java/gregtech/api/util/GT_RecipeRegistrator.java @@ -54,7 +54,6 @@ import com.google.common.collect.SetMultimap; import cpw.mods.fml.relauncher.ReflectionHelper; import gregtech.GT_Mod; import gregtech.api.GregTech_API; -import gregtech.api.enums.ConfigCategories; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; @@ -183,19 +182,19 @@ public class GT_RecipeRegistrator { || GT_Utility.getFluidForFilledItem(aStack, false) != null || aData.mMaterial.mMaterial.mSubTags.contains(SubTag.NO_RECIPES)) return; registerReverseMacerating(GT_Utility.copyAmount(1, aStack), aData, aData.mPrefix == null); - registerReverseSmelting( - GT_Utility.copyAmount(1, aStack), - aData.mMaterial.mMaterial, - aData.mMaterial.mAmount, - true); if (!GT_Utility.areStacksEqual(GT_ModHandler.getIC2Item("iridiumOre", 1L), aStack)) { + registerReverseSmelting( + GT_Utility.copyAmount(1, aStack), + aData.mMaterial.mMaterial, + aData.mMaterial.mAmount, + true); registerReverseFluidSmelting( GT_Utility.copyAmount(1, aStack), aData.mMaterial.mMaterial, aData.mMaterial.mAmount, aData.getByProduct(0)); + registerReverseArcSmelting(GT_Utility.copyAmount(1, aStack), aData); } - registerReverseArcSmelting(GT_Utility.copyAmount(1, aStack), aData); } /** @@ -604,30 +603,26 @@ public class GT_RecipeRegistrator { if (aRecipeReplacing && aPlate != null && sShapesA[i] != null && sShapesA[i].length > 1) { assert aItemData != null; - if (GregTech_API.sRecipeFile.get( - ConfigCategories.Recipes.recipereplacements, - aItemData.mMaterial.mMaterial + "." + sShapesA[i][0], - true)) { - if (null != (tStack = GT_ModHandler.removeRecipe(tRecipe.shape))) { - switch (sShapesA[i].length) { - case 2 -> GT_ModHandler.addCraftingRecipe( - tStack, - GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { sShapesA[i][1], s_P.charAt(0), aPlate, s_R.charAt(0), - OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData }); - case 3 -> GT_ModHandler.addCraftingRecipe( - tStack, - GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { sShapesA[i][1], sShapesA[i][2], s_P.charAt(0), aPlate, - s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), - aItemData }); - default -> GT_ModHandler.addCraftingRecipe( - tStack, - GT_ModHandler.RecipeBits.BUFFERED, - new Object[] { sShapesA[i][1], sShapesA[i][2], sShapesA[i][3], - s_P.charAt(0), aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), - s_I.charAt(0), aItemData }); - } + + if (null != (tStack = GT_ModHandler.removeRecipe(tRecipe.shape))) { + switch (sShapesA[i].length) { + case 2 -> GT_ModHandler.addCraftingRecipe( + tStack, + GT_ModHandler.RecipeBits.BUFFERED, + new Object[] { sShapesA[i][1], s_P.charAt(0), aPlate, s_R.charAt(0), + OrePrefixes.stick.get(tMaterial), s_I.charAt(0), aItemData }); + case 3 -> GT_ModHandler.addCraftingRecipe( + tStack, + GT_ModHandler.RecipeBits.BUFFERED, + new Object[] { sShapesA[i][1], sShapesA[i][2], s_P.charAt(0), aPlate, + s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), + aItemData }); + default -> GT_ModHandler.addCraftingRecipe( + tStack, + GT_ModHandler.RecipeBits.BUFFERED, + new Object[] { sShapesA[i][1], sShapesA[i][2], sShapesA[i][3], s_P.charAt(0), + aPlate, s_R.charAt(0), OrePrefixes.stick.get(tMaterial), s_I.charAt(0), + aItemData }); } } } |