From 66e6ed22abcf1daa7e998969b079464f3b3b3e13 Mon Sep 17 00:00:00 2001 From: YoungOnion <39562198+YoungOnionMC@users.noreply.github.com> Date: Tue, 26 Dec 2023 02:23:14 -0700 Subject: [PATCH] Multiply up recycling recipes for tiny/small dust removals --- .../api/unification/OreDictUnifier.java | 18 ++++++++++++---- .../loaders/recipe/RecyclingRecipes.java | 21 +++++++++++++++++-- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/src/main/java/gregtech/api/unification/OreDictUnifier.java b/src/main/java/gregtech/api/unification/OreDictUnifier.java index a945fe5b4f5..7a284d101b1 100644 --- a/src/main/java/gregtech/api/unification/OreDictUnifier.java +++ b/src/main/java/gregtech/api/unification/OreDictUnifier.java @@ -3,6 +3,7 @@ import gregtech.api.GTValues; import gregtech.api.GregTechAPI; import gregtech.api.unification.material.Material; +import gregtech.api.unification.material.info.MaterialFlags; import gregtech.api.unification.material.properties.PropertyKey; import gregtech.api.unification.material.registry.MaterialRegistry; import gregtech.api.unification.ore.OrePrefix; @@ -310,10 +311,19 @@ public static ItemStack getDust(Material material, long materialAmount) { return ItemStack.EMPTY; if (materialAmount % M == 0 || materialAmount >= M * 16) return get(OrePrefix.dust, material, (int) (materialAmount / M)); - else if ((materialAmount * 4) % M == 0 || materialAmount >= M * 8) - return get(OrePrefix.dustSmall, material, (int) ((materialAmount * 4) / M)); - else if ((materialAmount * 9) >= M) - return get(OrePrefix.dustTiny, material, (int) ((materialAmount * 9) / M)); + else if ((materialAmount * 4) % M == 0 || materialAmount >= M * 8) { + if (material.hasFlag(MaterialFlags.GENERATE_SMALL_DUST)) + return get(OrePrefix.dustSmall, material, (int) ((materialAmount * 4) / M)); + else + return get(OrePrefix.dust, material, 1); + } + else if ((materialAmount * 9) >= M) { + if(material.hasFlag(MaterialFlags.GENERATE_TINY_DUST)) + return get(OrePrefix.dustTiny, material, (int) (((materialAmount * 9) / M))); + else + return get(OrePrefix.dust, material, 1); + } + return ItemStack.EMPTY; } diff --git a/src/main/java/gregtech/loaders/recipe/RecyclingRecipes.java b/src/main/java/gregtech/loaders/recipe/RecyclingRecipes.java index ba4223d289f..ed7c1206e9e 100644 --- a/src/main/java/gregtech/loaders/recipe/RecyclingRecipes.java +++ b/src/main/java/gregtech/loaders/recipe/RecyclingRecipes.java @@ -1,6 +1,7 @@ package gregtech.loaders.recipe; import gregtech.api.GTValues; +import gregtech.api.items.materialitem.MetaPrefixItem; import gregtech.api.metatileentity.MetaTileEntity; import gregtech.api.recipes.RecipeBuilder; import gregtech.api.recipes.RecipeMaps; @@ -20,6 +21,8 @@ import gregtech.api.unification.stack.UnificationEntry; import gregtech.api.util.GTUtility; +import gregtech.api.util.SmallDigits; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.Tuple; @@ -112,14 +115,28 @@ private static void registerMaceratorRecycling(ItemStack input, List= M && materials.get(0).material.hasFlag(GENERATE_TINY_DUST)) + mult = 1; + else if ((matAmount * 4) % M == 0 && materials.get(0).material.hasFlag(GENERATE_SMALL_DUST)) + mult = 1; + else + mult = (int) M / (int) matAmount; + } + // Exit if no valid Materials exist for this recycling Recipe. if (outputs.size() == 0) return; + ItemStack in = input.copy(); + in.setCount(input.getCount() * mult); + // Build the final Recipe. RecipeBuilder recipe = RecipeMaps.MACERATOR_RECIPES.recipeBuilder() - .inputs(input.copy()) + .inputs(in) .outputs(outputs) - .duration(calculateDuration(outputs)) + .duration(calculateDuration(outputs) * mult) .EUt(2 * multiplier) .category(RecipeCategories.MACERATOR_RECYCLING);