Skip to content

Commit

Permalink
Multiply up recycling recipes for tiny/small dust removals
Browse files Browse the repository at this point in the history
  • Loading branch information
YoungOnionMC committed Dec 26, 2023
1 parent 3f3ff7d commit 66e6ed2
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
18 changes: 14 additions & 4 deletions src/main/java/gregtech/api/unification/OreDictUnifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
21 changes: 19 additions & 2 deletions src/main/java/gregtech/loaders/recipe/RecyclingRecipes.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -112,14 +115,28 @@ private static void registerMaceratorRecycling(ItemStack input, List<MaterialSta
RecipeMaps.MACERATOR_RECIPES.getMaxOutputs(),
OreDictUnifier::getDust);

int mult = 1;
long matAmount = materials.get(0).amount;
if(matAmount < M) {
if((matAmount * 9) >= 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<SimpleRecipeBuilder> 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);

Expand Down

0 comments on commit 66e6ed2

Please sign in to comment.