diff options
author | NotAPenguin <michiel.vandeginste@gmail.com> | 2024-09-02 23:17:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-02 23:17:17 +0200 |
commit | 1b820de08a05070909a267e17f033fcf58ac8710 (patch) | |
tree | 02831a025986a06b20f87e5bcc69d1e0c639a342 /src/main/java/net/glease/ggfab/SingleUseToolRecipeLoader.java | |
parent | afd3fd92b6a6ab9ab0d0dc3214e6bc8ff7a86c9b (diff) | |
download | GT5-Unofficial-1b820de08a05070909a267e17f033fcf58ac8710.tar.gz GT5-Unofficial-1b820de08a05070909a267e17f033fcf58ac8710.tar.bz2 GT5-Unofficial-1b820de08a05070909a267e17f033fcf58ac8710.zip |
The Great Renaming (#3014)
* move kekztech to a single root dir
* move detrav to a single root dir
* move gtnh-lanthanides to a single root dir
* move tectech and delete some gross reflection in gt++
* remove more reflection inside gt5u
* delete more reflection in gt++
* fix imports
* move bartworks and bwcrossmod
* fix proxies
* move galactigreg and ggfab
* move gtneioreplugin
* try to fix gt++ bee loader
* apply the rename rules to BW
* apply rename rules to bwcrossmod
* apply rename rules to detrav scanner mod
* apply rename rules to galacticgreg
* apply rename rules to ggfab
* apply rename rules to goodgenerator
* apply rename rules to gtnh-lanthanides
* apply rename rules to gt++
* apply rename rules to kekztech
* apply rename rules to kubatech
* apply rename rules to tectech
* apply rename rules to gt
apply the rename rules to gt
* fix tt import
* fix mui hopefully
* fix coremod except intergalactic
* rename assline recipe class
* fix a class name i stumbled on
* rename StructureUtility to GTStructureUtility to prevent conflict with structurelib
* temporary rename of GTTooltipDataCache to old name
* fix gt client/server proxy names
Diffstat (limited to 'src/main/java/net/glease/ggfab/SingleUseToolRecipeLoader.java')
-rw-r--r-- | src/main/java/net/glease/ggfab/SingleUseToolRecipeLoader.java | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/src/main/java/net/glease/ggfab/SingleUseToolRecipeLoader.java b/src/main/java/net/glease/ggfab/SingleUseToolRecipeLoader.java deleted file mode 100644 index aa2a72f71c..0000000000 --- a/src/main/java/net/glease/ggfab/SingleUseToolRecipeLoader.java +++ /dev/null @@ -1,103 +0,0 @@ -package net.glease.ggfab; - -import static gregtech.api.enums.ToolDictNames.*; -import static gregtech.api.util.GT_RecipeBuilder.SECONDS; - -import net.glease.ggfab.api.GGFabRecipeMaps; -import net.glease.ggfab.api.GigaGramFabAPI; - -import gregtech.api.enums.GT_Values; -import gregtech.api.enums.ItemList; -import gregtech.api.enums.Materials; -import gregtech.api.enums.TierEU; -import gregtech.api.enums.ToolDictNames; -import gregtech.api.interfaces.IToolStats; -import gregtech.api.util.GT_ModHandler; -import gregtech.api.util.GT_Utility; - -class SingleUseToolRecipeLoader implements Runnable { - - @Override - public void run() { - ToolDictNames[] hardTools = new ToolDictNames[] { craftingToolHardHammer, craftingToolScrewdriver, - craftingToolWrench, craftingToolCrowbar, craftingToolWireCutter, craftingToolFile, craftingToolSaw }; - ToolDictNames[] softTools = new ToolDictNames[] { craftingToolSoftHammer }; - addSingleUseToolRecipe(Materials.Steel, hardTools); - addSingleUseToolRecipe(Materials.Silver, 5000, hardTools); - addSingleUseToolRecipe(Materials.VanadiumSteel, hardTools); - addSingleUseToolRecipe(Materials.TungstenSteel, hardTools); - addSingleUseToolRecipe(Materials.HSSG, hardTools); - addSingleUseToolRecipe(Materials.Rubber, softTools); - addSingleUseToolRecipe(Materials.StyreneButadieneRubber, softTools); - addSingleUseToolRecipe(Materials.Polybenzimidazole, softTools); - - String prefix = "Shape_One_Use_"; - for (GGItemList value : GGItemList.values()) { - if (!value.name() - .startsWith(prefix)) { - continue; - } - ToolDictNames type = ToolDictNames.valueOf( - value.name() - .substring(prefix.length())); - GT_ModHandler - .addCraftingRecipe(value.get(1L), new Object[] { "h", "P", "I", 'P', ItemList.Shape_Empty, 'I', type }); - } - } - - private void addSingleUseToolRecipe(Materials material, ToolDictNames... types) { - addSingleUseToolRecipe(material, 10000, types); - } - - private static long findNiceFactor(long fluids, long count) { - long end = Math.min(fluids, count); - for (long i = count / 256; i < end; i++) { - if (fluids % i == 0 && count % i == 0 && count / i < 256) return i; - } - return -1; - } - - private void addSingleUseToolRecipe(Materials material, int outputModifier, ToolDictNames... types) { - if (material.mStandardMoltenFluid == null) { - throw new IllegalArgumentException("material does not have molten fluid form"); - } - for (ToolDictNames type : types) { - IToolStats stats = GigaGramFabAPI.SINGLE_USE_TOOLS.get(type); - Long cost = GigaGramFabAPI.COST_SINGLE_USE_TOOLS.get(type); - if (stats == null || cost == null) { - throw new IllegalArgumentException(type + " not registered"); - } - long fluids = cost * GT_Values.L / GT_Values.M, duration = 6 * SECONDS; - long count = (long) (material.mDurability * stats.getMaxDurabilityMultiplier() - * outputModifier - * 100 - / stats.getToolDamagePerContainerCraft() - / 10000); - if (count > 64 * 4) { - long niceFactor = findNiceFactor(fluids, count); - if (niceFactor < 0) { - double mod = (double) count / (64 * 4L); - fluids = Math.max((long) (fluids / mod), 1L); - duration = Math.max((long) (duration / mod), 1L); - count = 64 * 4; - } else { - fluids /= niceFactor; - duration = Math.max(duration / niceFactor, 1); - count /= niceFactor; - } - } else if (count < 128) { - long mod = GT_Utility.ceilDiv(128, count); - fluids *= mod; - duration *= mod; - count *= mod; - } - GT_Values.RA.stdBuilder() - .fluidInputs(material.getMolten(fluids)) // - .metadata(GGFabRecipeMaps.OUTPUT_TYPE, type) // - .metadata(GGFabRecipeMaps.OUTPUT_COUNT, (int) count) // - .eut(TierEU.RECIPE_MV) - .duration(duration) // - .addTo(GGFabRecipeMaps.toolCastRecipes); - } - } -} |