diff --git a/docs/content/Modpacks/Changes/v8.0.0.md b/docs/content/Modpacks/Changes/v8.0.0.md index 5fc9d5adbbd..7d12c75e1b8 100644 --- a/docs/content/Modpacks/Changes/v8.0.0.md +++ b/docs/content/Modpacks/Changes/v8.0.0.md @@ -156,4 +156,5 @@ As a recipe-matching optimization, input handlers whose `getTotalContentAmount() - Calling the battery buffer constructor with the following args gives the same behaviour as a charger machine: `(info, tier, inventorySize, BatteryBufferMachine.AMPS_PER_BATTERY_CHARGER, 0)` - Refactored Jade provider code. Use the `MachineInfoProvider` class for jade providers for a specific machine type, and `MachineTraitProvider` for providers for a specific machine trait. - `GTUtil.getMoltenFluid(Material)` has been moved to `Material.getHotFluid()`. -- `ICopyable::copyConfig`'s `CompoundTag` argument should now be mutated by reference instead of a new one returned (and thus, the return type has been changed to `void`). \ No newline at end of file +- `ICopyable::copyConfig`'s `CompoundTag` argument should now be mutated by reference instead of a new one returned (and thus, the return type has been changed to `void`). +- Tiered Chance Boosting has been formally removed from the API (as it was deprecated in v7.0.) `ChancedInput` and `ChancedOutput` kubeJS calls will throw errors if they still had chance boost values as arguments. \ No newline at end of file diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java index a67b4869ea2..12a51b8c59e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/EURecipeCapability.java @@ -147,7 +147,7 @@ public List getCapabilityHandlers(MetaMachine machine */ public static List makeEUContent(EnergyStack eu) { return List.of( - new Content(eu, ChanceLogic.getMaxChancedValue(), ChanceLogic.getMaxChancedValue(), 0)); + new Content(eu, ChanceLogic.getMaxChancedValue(), ChanceLogic.getMaxChancedValue())); } /** diff --git a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java index 83c0ecc6685..4d09c9832bd 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java +++ b/src/main/java/com/gregtechceu/gtceu/api/capability/recipe/ItemRecipeCapability.java @@ -90,9 +90,6 @@ public List compressIngredients(@Unmodifiable Collection ingredi // spotless:off if (ingredient.getContainedCustom() instanceof IntCircuitIngredient) { list.addFirst(ingredient); - } else if (ingredient.getContainedCustom() instanceof IntProviderIngredient intProvider && - intProvider.getInner().getCustomIngredient() instanceof IntCircuitIngredient) { - list.addFirst(ingredient); } else { list.add(ingredient); } diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java index 33d5a8f49d3..2f2038c0973 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/multiblock/MultiblockDisplayText.java @@ -434,7 +434,6 @@ public Builder addOutputLines(GTRecipe recipe) { if (recipe != null) { int recipeTier = RecipeHelper.getPreOCRecipeEuTier(recipe); int chanceTier = recipeTier + recipe.ocLevel; - var function = recipe.getType().getChanceFunction(); double maxDurationSec = (double) recipe.duration / 20.0; var itemOutputs = recipe.getOutputContents(ItemRecipeCapability.CAP); var fluidOutputs = recipe.getOutputContents(FluidRecipeCapability.CAP); @@ -456,8 +455,7 @@ public Builder addOutputLines(GTRecipe recipe) { provider.getCountProvider().getMinValue(), provider.getCountProvider().getMaxValue()); if (item.chance() < item.maxChance()) { - countD = countD * runs * function.getBoostedChance(item, recipeTier, chanceTier) / - item.maxChance(); + countD = countD * runs * item.chance() / item.maxChance(); } countD = countD * provider.getMidRoll(); } else { @@ -468,8 +466,7 @@ public Builder addOutputLines(GTRecipe recipe) { countD *= count; if (item.chance() < item.maxChance()) { rounded = true; - countD = countD * runs * function.getBoostedChance(item, recipeTier, chanceTier) / - item.maxChance(); + countD = countD * runs * item.chance() / item.maxChance(); } count = Math.max(1, (int) Math.round(countD)); displaycount = Component.literal(String.valueOf(count)); @@ -500,8 +497,7 @@ public Builder addOutputLines(GTRecipe recipe) { provider.getCountProvider().getMinValue(), provider.getCountProvider().getMaxValue()); if (fluid.chance() < fluid.maxChance()) { - amountD = amountD * runs * function.getBoostedChance(fluid, recipeTier, chanceTier) / - fluid.maxChance(); + amountD = amountD * runs * fluid.chance() / fluid.maxChance(); } amountD = amountD * provider.getMidRoll(); } else { @@ -512,8 +508,7 @@ public Builder addOutputLines(GTRecipe recipe) { amountD *= amount; if (fluid.chance() < fluid.maxChance()) { rounded = true; - amountD = amountD * runs * function.getBoostedChance(fluid, recipeTier, chanceTier) / - fluid.maxChance(); + amountD = amountD * runs * fluid.chance() / fluid.maxChance(); } amount = Math.max(1, (int) Math.round(amountD)); displaycount = Component.literal(String.valueOf(amount)); diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java index b8e2024926a..3497f265752 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableFluidTank.java @@ -124,9 +124,6 @@ public List handleRecipeInner(IO io, GTRecipe recipe, FluidStack[] fluids; if (ingredient.ingredient() instanceof IntProviderFluidIngredient provider) { - provider.setFluidStacks(null); - provider.setSampledCount(-1); - if (simulate) { fluids = new FluidStack[] { provider.getMaxSizeStack() }; } else { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java index f9ebcdcc338..f9ed76e858b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/NotifiableItemStackHandler.java @@ -117,9 +117,6 @@ public static List handleRecipe(IO io, GTRecipe recipe, List> validMachineClasses() { public long getInputAmperage() { var recipeLogic = getMachine().getTrait(RecipeLogic.TYPE); if (recipeLogic == null) return 0; - var lastRecipe = recipeLogic.getLastRecipe(); + var lastRecipe = recipeLogic.getLastDisplayedRecipe(); long amperage; if (lastRecipe != null) { amperage = lastRecipe.getInputEUt().amperage(); @@ -49,7 +49,7 @@ public long getInputAmperage() { public long getOutputAmperage() { var recipeLogic = getMachine().getTrait(RecipeLogic.TYPE); if (recipeLogic == null) return 0; - var lastRecipe = recipeLogic.getLastRecipe(); + var lastRecipe = recipeLogic.getLastDisplayedRecipe(); if (lastRecipe != null) { return lastRecipe.getOutputEUt().amperage(); } else { diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java index 5e9295b0f9d..6f097336b02 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/trait/RecipeLogic.java @@ -99,8 +99,12 @@ public enum Status implements StringRepresentable { @Nullable @Getter @SaveField - @SyncToClient protected GTRecipe lastRecipe; + @Nullable + @Getter + @SaveField + @SyncToClient + protected GTRecipe lastDisplayedRecipe; @Getter @SaveField @SyncToClient @@ -165,6 +169,7 @@ protected void onStatusSynced() { public void resetRecipeLogic() { recipeDirty = false; lastRecipe = null; + lastDisplayedRecipe = null; lastOriginRecipe = null; consecutiveRecipes = 0; progress = 0; @@ -354,16 +359,18 @@ public void findAndHandleRecipe() { if (!recipeDirty && lastRecipe != null && checkRecipe(lastRecipe).isSuccess()) { GTRecipe recipe = lastRecipe; lastRecipe = null; + lastDisplayedRecipe = null; lastOriginRecipe = null; setupRecipe(recipe); } else { // try to find and handle a new recipe failureReasonMap.clear(); lastRecipe = null; + lastDisplayedRecipe = null; lastOriginRecipe = null; handleSearchingRecipes(searchRecipe()); } - syncDataHolder.markClientSyncFieldDirty("lastRecipe"); + syncDataHolder.markClientSyncFieldDirty("lastDisplayedRecipe"); recipeDirty = false; } @@ -393,6 +400,8 @@ public ActionResult handleTickRecipe(GTRecipe recipe) { var result = RecipeHelper.matchTickRecipe(getRLMachine(), recipe); if (!result.isSuccess()) return result; + recipe.doTickPrerolls(this.chanceCaches); + result = handleTickRecipeIO(recipe, IO.IN); if (!result.isSuccess()) return result; @@ -410,6 +419,12 @@ public void setupRecipe(GTRecipe recipe) { syncDataHolder.resyncAllFields(); return; } + if (lastRecipe != null && !recipe.equals(lastRecipe)) { + chanceCaches.clear(); + } + lastDisplayedRecipe = recipe.copy(); + syncDataHolder.markClientSyncFieldDirty("lastDisplayedRecipe"); + recipe.doPrerolls(this.chanceCaches); var handledIO = handleRecipeIO(recipe, IO.IN); if (handledIO.isSuccess()) { if (lastRecipe != null && !recipe.equals(lastRecipe)) { @@ -423,6 +438,8 @@ public void setupRecipe(GTRecipe recipe) { duration = recipe.duration; isActive = true; syncDataHolder.resyncAllFields(); + } else { + lastDisplayedRecipe = null; } } @@ -541,6 +558,7 @@ public void onRecipeFinish() { isActive = false; // Force a recipe recheck. lastRecipe = null; + lastDisplayedRecipe = null; syncDataHolder.resyncAllFields(); return; } @@ -551,7 +569,6 @@ public void onRecipeFinish() { markLastRecipeDirty(); } else { lastRecipe = modified; - syncDataHolder.markClientSyncFieldDirty("lastRecipe"); } } else { markLastRecipeDirty(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java index 71d0da2b039..b94568bc08e 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipe.java @@ -6,6 +6,7 @@ import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; import com.gregtechceu.gtceu.api.recipe.ingredient.EnergyStack; +import com.gregtechceu.gtceu.api.recipe.ingredient.IRangedIngredient; import net.minecraft.core.HolderLookup; import net.minecraft.nbt.CompoundTag; @@ -16,12 +17,14 @@ import net.minecraft.world.item.crafting.RecipeSerializer; import net.minecraft.world.level.Level; +import it.unimi.dsi.fastutil.objects.Object2IntMap; import lombok.Getter; import lombok.Setter; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.*; +import java.util.stream.Stream; public class GTRecipe implements Recipe { @@ -246,6 +249,36 @@ public ChanceLogic getChanceLogicForCapability(RecipeCapability cap, IO io, b return new EnergyStack(v, a); } + public void doPrerolls(IdentityHashMap, Object2IntMap> chanceCaches) { + var rangedContents = getFullContents(); + for (Content item : rangedContents) { + if (item.content() instanceof IRangedIngredient ranged) + ranged.rollSampledCount(); + } + } + + public void doTickPrerolls(IdentityHashMap, Object2IntMap> chanceCaches) { + var rangedContents = getFullTickContents(); + for (Content item : rangedContents) { + if (item.content() instanceof IRangedIngredient ranged) + ranged.rollSampledCount(); + } + } + + public List getFullContents() { + return Stream + .concat(inputs.values().stream(), outputs.values().stream()) + .flatMap(List::stream) + .toList(); + } + + public List getFullTickContents() { + return Stream + .concat(tickInputs.values().stream(), tickOutputs.values().stream()) + .flatMap(List::stream) + .toList(); + } + public int getTotalRuns() { return parallels * subtickParallels * batchParallels; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java index 8ae29f0a0ad..db990d0abbb 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/GTRecipeType.java @@ -3,7 +3,6 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.capability.recipe.*; import com.gregtechceu.gtceu.api.recipe.category.GTRecipeCategory; -import com.gregtechceu.gtceu.api.recipe.chance.boost.ChanceBoostFunction; import com.gregtechceu.gtceu.api.recipe.gui.GTRecipeTypeUILayout; import com.gregtechceu.gtceu.api.recipe.lookup.RecipeAdditionHandler; import com.gregtechceu.gtceu.api.recipe.lookup.RecipeDB; @@ -51,9 +50,6 @@ public class GTRecipeType implements RecipeType { @Getter @Setter private GTRecipeBuilder recipeBuilder; - @Getter - @Setter - private ChanceBoostFunction chanceFunction = ChanceBoostFunction.NONE; @Setter @Getter private GTRecipeType smallRecipeMap; diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeHelper.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeHelper.java index b1c338e3f2e..6614bed193d 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeHelper.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeHelper.java @@ -408,8 +408,7 @@ public static int getRatioForDistillery(SizedFluidIngredient fluidInput, SizedFl } public static boolean isFluidStackDivisibleForDistillery(SizedFluidIngredient fluidStack, int divisor) { - int amount = (fluidStack.ingredient() instanceof IRangedIngredient ranged ? ranged.getMaxRoll() : - fluidStack.amount()); +// int amount = (fluidStack.ingredient() instanceof IRangedIngredient ranged ? ranged.getMaxRoll() : fluidStack.amount()); return fluidStack.amount() % divisor == 0 && fluidStack.amount() / divisor >= 25; } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java index 0bc6050ace0..53dae26ab7b 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/RecipeRunner.java @@ -7,7 +7,6 @@ import com.gregtechceu.gtceu.api.machine.trait.RecipeHandlerGroup; import com.gregtechceu.gtceu.api.machine.trait.RecipeHandlerGroupColor; import com.gregtechceu.gtceu.api.machine.trait.RecipeHandlerList; -import com.gregtechceu.gtceu.api.recipe.chance.boost.ChanceBoostFunction; import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic; import com.gregtechceu.gtceu.api.recipe.content.Content; @@ -73,9 +72,6 @@ public ActionResult handle(Map, List> entries) { * Populates the content match list to know if conditions are satisfied. */ private void fillContentMatchList(Map, List> entries) { - ChanceBoostFunction function = recipe.getType().getChanceFunction(); - int recipeTier = RecipeHelper.getPreOCRecipeEuTier(recipe); - int chanceTier = recipeTier + recipe.ocLevel; for (var entry : entries.entrySet()) { RecipeCapability cap = entry.getKey(); if (!cap.doMatchInRecipe()) continue; @@ -97,7 +93,7 @@ private void fillContentMatchList(Map, List> entrie if (cont.chance() >= cont.maxChance()) { contentList.add(cont.content()); - } else if (cont.chance() > 0 || cont.tierChanceBoost() > 0) { + } else if (cont.chance() > 0) { chancedContents.add(cont); } // Do not add Non-Consumed ingredients; they'd just get dropped after the chance roll anyway @@ -106,8 +102,7 @@ private void fillContentMatchList(Map, List> entrie // add chanced contents to the recipe content map if (!chancedContents.isEmpty()) { var cache = this.chanceCaches.get(cap); - chancedContents = logic.roll(cap, chancedContents, function, recipeTier, chanceTier, cache, - recipe.getTotalRuns()); + chancedContents = logic.roll(cap, chancedContents, cache, recipe.getTotalRuns()); for (Content cont : chancedContents) { contentList.add(cont.content()); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/boost/ChanceBoostFunction.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/boost/ChanceBoostFunction.java deleted file mode 100644 index 39825e62f13..00000000000 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/boost/ChanceBoostFunction.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.gregtechceu.gtceu.api.recipe.chance.boost; - -import com.gregtechceu.gtceu.api.GTValues; -import com.gregtechceu.gtceu.api.recipe.content.Content; - -import net.minecraft.util.Mth; - -import org.jetbrains.annotations.NotNull; - -/** - * A function used to boost a {@link Content}'s chance - */ -@FunctionalInterface -public interface ChanceBoostFunction { - - /** - * Chance boosting function based on the number of performed overclocks - */ - ChanceBoostFunction OVERCLOCK = (entry, recipeTier, chanceTier) -> { - int tierDiff = chanceTier - recipeTier; - if (tierDiff <= 0) return entry.chance(); // equal or invalid tiers do not boost at all - if (recipeTier == GTValues.ULV) tierDiff--; // LV does not boost over ULV - return Mth.clamp(entry.chance() + (entry.tierChanceBoost() * tierDiff), 0, entry.maxChance()); - }; - - /** - * Chance boosting function which performs no boosting - */ - ChanceBoostFunction NONE = (entry, recipeTier, chanceTier) -> entry.chance(); - - /** - * @param entry the amount to boost by - * @param recipeTier the base tier of the recipe - * @param chanceTier the tier the recipe is run at - * @return the boosted chance - */ - int getBoostedChance(@NotNull Content entry, int recipeTier, int chanceTier); -} diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/logic/ChanceLogic.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/logic/ChanceLogic.java index ea8fda79007..5c2bf29fc55 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/logic/ChanceLogic.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/chance/logic/ChanceLogic.java @@ -3,7 +3,6 @@ import com.gregtechceu.gtceu.GTCEu; import com.gregtechceu.gtceu.api.GTValues; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; -import com.gregtechceu.gtceu.api.recipe.chance.boost.ChanceBoostFunction; import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.content.ContentModifier; import com.gregtechceu.gtceu.api.registry.GTRegistries; @@ -37,8 +36,7 @@ public abstract class ChanceLogic { @Override public @Unmodifiable List<@NotNull Content> roll(RecipeCapability cap, @NotNull @Unmodifiable List<@NotNull Content> chancedEntries, - @NotNull ChanceBoostFunction boostFunction, int recipeTier, - int chanceTier, @Nullable Object2IntMap cache, int times) { + @Nullable Object2IntMap cache, int times) { ImmutableList.Builder builder = ImmutableList.builder(); for (Content entry : chancedEntries) { int maxChance = entry.maxChance(); @@ -46,7 +44,7 @@ public abstract class ChanceLogic { // OR Chanced outputs are deterministic // If a large batch is being done we can calculate how many we expect to get. // Add the guaranteed part of that to the list, then roll for the remaining chanced part. - int newChance = getChance(entry, boostFunction, recipeTier, chanceTier); + int newChance = getChance(entry); int totalChance = times * newChance; int guaranteed = totalChance / maxChance; if (guaranteed > 0) builder.add(entry.copyChanced(cap, ContentModifier.multiplier(guaranteed))); @@ -83,13 +81,12 @@ public String toString() { @Override public @Unmodifiable List<@NotNull Content> roll(RecipeCapability cap, @NotNull @Unmodifiable List<@NotNull Content> chancedEntries, - @NotNull ChanceBoostFunction boostFunction, int recipeTier, - int chanceTier, @Nullable Object2IntMap cache, int times) { + @Nullable Object2IntMap cache, int times) { ImmutableList.Builder builder = ImmutableList.builder(); for (int i = 0; i < times; ++i) { boolean failed = false; for (Content entry : chancedEntries) { - int newChance = getChance(entry, boostFunction, recipeTier, chanceTier); + int newChance = getChance(entry); int cached = getCachedChance(entry, cache); int chance = newChance + cached; if (passesChance(chance, entry.maxChance())) newChance -= entry.maxChance(); @@ -123,13 +120,12 @@ public String toString() { @Override public @Unmodifiable List<@NotNull Content> roll(RecipeCapability cap, @NotNull @Unmodifiable List<@NotNull Content> chancedEntries, - @NotNull ChanceBoostFunction boostFunction, int recipeTier, - int chanceTier, @Nullable Object2IntMap cache, int times) { + @Nullable Object2IntMap cache, int times) { ImmutableList.Builder builder = ImmutableList.builder(); for (int i = 0; i < times; ++i) { Content selected = null; for (Content entry : chancedEntries) { - int newChance = getChance(entry, boostFunction, recipeTier, chanceTier); + int newChance = getChance(entry); int cached = getCachedChance(entry, cache); int chance = newChance + cached; if (passesChance(chance, entry.maxChance())) { @@ -163,8 +159,7 @@ public String toString() { @Override public @Unmodifiable List<@NotNull Content> roll(RecipeCapability cap, @NotNull @Unmodifiable List<@NotNull Content> chancedEntries, - @NotNull ChanceBoostFunction boostFunction, int recipeTier, - int chanceTier, @Nullable Object2IntMap cache, int times) { + @Nullable Object2IntMap cache, int times) { // Have to set up a system where all chances are set to be out of 10000 IntList chancesOutOfTenThousand = new IntArrayList(); @@ -202,7 +197,7 @@ public String toString() { List normalizedEntries = new ArrayList<>(); for (int i = 0; i < chancesOutOfTenThousand.size(); i++) { normalizedEntries.add(new Content(chancedEntries.get(i).content(), chancesOutOfTenThousand.getInt(i), - getMaxChancedValue(), chancedEntries.get(i).tierChanceBoost())); + getMaxChancedValue())); } // Use the new, normalized list for the logic @@ -211,7 +206,7 @@ public String toString() { int nonGuaranteedTimes = times; if (times > 1) { for (Content entry : normalizedEntries) { - int newChance = getChance(entry, boostFunction, recipeTier, chanceTier); + int newChance = getChance(entry); int totalChance = times * newChance; int guaranteed = totalChance / 10000; if (guaranteed > 0) { @@ -225,7 +220,7 @@ public String toString() { Content selected = null; int maxChance = getMaxChancedValue(); for (Content entry : normalizedEntries) { - int newChance = getChance(entry, boostFunction, recipeTier, chanceTier); + int newChance = getChance(entry); int cached = getCachedChance(entry, cache); int chance = newChance + cached; if (passesChance(chance, maxChance)) { @@ -260,8 +255,7 @@ public String toString() { @Override public @Unmodifiable List<@NotNull Content> roll(RecipeCapability cap, @NotNull @Unmodifiable List<@NotNull Content> chancedEntries, - @NotNull ChanceBoostFunction boostFunction, int recipeTier, - int chanceTier, @Nullable Object2IntMap cache, int times) { + @Nullable Object2IntMap cache, int times) { return Collections.emptyList(); } @@ -285,15 +279,11 @@ private ChanceLogic(String id) { } /** - * @param entry the entry to get the complete chance for - * @param boostFunction the function boosting the entry's chance - * @param recipeTier the base tier of the recipe - * @param chanceTier the tier the recipe is run at + * @param entry the entry to get the complete chance for * @return the total chance for the entry */ - static int getChance(@NotNull Content entry, @NotNull ChanceBoostFunction boostFunction, int recipeTier, - int chanceTier) { - return boostFunction.getBoostedChance(entry, recipeTier, chanceTier); + static int getChance(@NotNull Content entry) { + return entry.chance(); } /** @@ -339,35 +329,26 @@ static void updateCachedChance(Object ingredient, @Nullable Object2IntMap cac * Roll the chance and attempt to produce the output * * @param chancedEntries the list of entries to roll - * @param boostFunction the function to boost the entries' chances - * @param recipeTier the base tier of the recipe - * @param chanceTier the tier the recipe is run at * @param cache the cache of previously rolled chances, can be null * @param times the number of times to roll * @return a list of the produced outputs, empty if roll fails */ public abstract @Unmodifiable List<@NotNull Content> roll(RecipeCapability cap, @NotNull @Unmodifiable List<@NotNull Content> chancedEntries, - @NotNull ChanceBoostFunction boostFunction, - int recipeTier, int chanceTier, @Nullable Object2IntMap cache, int times); /** * Roll the chance and attempt to produce the output * * @param chancedEntries the list of entries to roll - * @param boostFunction the function to boost the entries' chances - * @param recipeTier the base tier of the recipe - * @param chanceTier the tier the recipe is run at * @param times the number of times to roll * @return a list of the produced outputs */ @Unmodifiable public List<@NotNull Content> roll(RecipeCapability cap, @NotNull @Unmodifiable List<@NotNull Content> chancedEntries, - @NotNull ChanceBoostFunction boostFunction, int recipeTier, int chanceTier, int times) { - return roll(cap, chancedEntries, boostFunction, recipeTier, chanceTier, null, times); + return roll(cap, chancedEntries, null, times); } @NotNull diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java index 65a02d34e07..2c001614edc 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/Content.java @@ -1,7 +1,6 @@ package com.gregtechceu.gtceu.api.recipe.content; import com.gregtechceu.gtceu.api.capability.recipe.RecipeCapability; -import com.gregtechceu.gtceu.api.recipe.chance.boost.ChanceBoostFunction; import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic; import com.gregtechceu.gtceu.utils.FormattingUtil; @@ -14,13 +13,12 @@ import com.mojang.serialization.codecs.RecordCodecBuilder; import org.jetbrains.annotations.NotNull; -public record Content(Object content, int chance, int maxChance, int tierChanceBoost) { +public record Content(Object content, int chance, int maxChance) { - public Content(Object content, int chance, int maxChance, int tierChanceBoost) { + public Content(Object content, int chance, int maxChance) { this.content = content; this.chance = chance; this.maxChance = maxChance; - this.tierChanceBoost = fixBoost(tierChanceBoost); } public static Codec codec(RecipeCapability capability) { @@ -28,8 +26,7 @@ public static Codec codec(RecipeCapability capability) { return RecordCodecBuilder.create(instance -> instance.group( capability.serializer.codec().fieldOf("content").forGetter(val -> capability.of(val.content)), ExtraCodecs.NON_NEGATIVE_INT.optionalFieldOf("chance", ChanceLogic.getMaxChancedValue()).forGetter(val -> val.chance), - ExtraCodecs.NON_NEGATIVE_INT.optionalFieldOf("maxChance", ChanceLogic.getMaxChancedValue()).forGetter(val -> val.maxChance), - Codec.INT.optionalFieldOf("tierChanceBoost", 0).forGetter(val -> val.tierChanceBoost)) + ExtraCodecs.NON_NEGATIVE_INT.optionalFieldOf("maxChance", ChanceLogic.getMaxChancedValue()).forGetter(val -> val.maxChance)) .apply(instance, Content::new)); // spotless:on } @@ -38,7 +35,7 @@ public static Codec codec(RecipeCapability capability) { * Directly copies a Content. */ public Content copy(RecipeCapability capability) { - return new Content(capability.copyContent(content), chance, maxChance, tierChanceBoost); + return new Content(capability.copyContent(content), chance, maxChance); } /** @@ -48,7 +45,7 @@ public Content copy(RecipeCapability capability, @NotNull ContentModifier mod if (modifier == ContentModifier.IDENTITY || chance < maxChance) { return copy(capability); } else { - return new Content(capability.copyContent(content, modifier), chance, maxChance, tierChanceBoost); + return new Content(capability.copyContent(content, modifier), chance, maxChance); } } @@ -59,7 +56,7 @@ public Content copyChanced(RecipeCapability capability, @NotNull ContentModif if (modifier == ContentModifier.IDENTITY) { return copy(capability); } else { - return new Content(capability.copyContent(content, modifier), chance, maxChance, tierChanceBoost); + return new Content(capability.copyContent(content, modifier), chance, maxChance); } } @@ -83,51 +80,21 @@ private int fixBoost(int chanceBoost) { return chanceBoost < 0 ? -fixed : fixed; } - public static void addChanceTooltips(RichTooltip tooltip, Content content, ChanceLogic logic, int recipeTier, - int chanceTier, ChanceBoostFunction function) { + public static void addChanceTooltips(RichTooltip tooltip, Content content, ChanceLogic logic) { if (content.chance() < ChanceLogic.getMaxChancedValue()) { - int boostedChance = function.getBoostedChance(content, recipeTier, chanceTier); - if (boostedChance == 0) { + if (content.chance() == 0) { tooltip.addLine(Component.translatable("gtceu.gui.content.chance_nc")); } else { float baseChanceFloat = 100f * content.chance() / content.maxChance(); - if (content.tierChanceBoost() != 0) { - float boostedChanceFloat = 100f * boostedChance / content.maxChance(); - if (logic != ChanceLogic.NONE && logic != ChanceLogic.OR) { - tooltip.addLine(Component.translatable("gtceu.gui.content.chance_base_logic", - FormattingUtil.formatNumber2Places(baseChanceFloat), logic.getTranslation()) - .withStyle(ChatFormatting.YELLOW)); - } else { - tooltip.addLine( - FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_base", - baseChanceFloat)); - } - - String key = "gtceu.gui.content.chance_tier_boost_" + - ((content.tierChanceBoost() > 0) ? "plus" : "minus"); - tooltip.addLine(FormattingUtil.formatPercentage2Places(key, - Math.abs(100f * content.tierChanceBoost() / content.maxChance()))); - - if (logic != ChanceLogic.NONE && logic != ChanceLogic.OR) { - tooltip.addLine(Component.translatable("gtceu.gui.content.chance_boosted_logic", - FormattingUtil.formatNumber2Places(boostedChanceFloat), logic.getTranslation()) - .withStyle(ChatFormatting.YELLOW)); - } else { - tooltip.addLine( - FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_boosted", - boostedChanceFloat)); - } + if (logic != ChanceLogic.NONE && logic != ChanceLogic.OR) { + tooltip.addLine(Component.translatable("gtceu.gui.content.chance_no_boost_logic", + FormattingUtil.formatNumber2Places(baseChanceFloat), logic.getTranslation()) + .withStyle(ChatFormatting.YELLOW)); } else { - if (logic != ChanceLogic.NONE && logic != ChanceLogic.OR) { - tooltip.addLine(Component.translatable("gtceu.gui.content.chance_no_boost_logic", - FormattingUtil.formatNumber2Places(baseChanceFloat), logic.getTranslation()) - .withStyle(ChatFormatting.YELLOW)); - } else { - tooltip.addLine( - FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_no_boost", - baseChanceFloat)); - } + tooltip.addLine( + FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_no_boost", + baseChanceFloat)); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java index 3ec1fb025fe..7623a4c21e0 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/ContentModifier.java @@ -42,7 +42,7 @@ public double apply(double number) { * @return A new Content map that is the modified version of the argument */ public Map, List> applyContents(Map, List> contents) { - if (this == IDENTITY) return new HashMap<>(contents); + // Prerolls require copying, even on IDENTITY Map, List> copyContents = new HashMap<>(); for (var entry : contents.entrySet()) { var contentList = entry.getValue(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java index 55cac528a08..12c657059c3 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/content/IContentSerializer.java @@ -37,15 +37,13 @@ default void toNetworkContent(RegistryFriendlyByteBuf buf, Content content) { toNetwork(buf, inner); buf.writeVarInt(content.chance()); buf.writeVarInt(content.maxChance()); - buf.writeVarInt(content.tierChanceBoost()); } default Content fromNetworkContent(RegistryFriendlyByteBuf buf) { T inner = fromNetwork(buf); int chance = buf.readVarInt(); int maxChance = buf.readVarInt(); - int tierChanceBoost = buf.readVarInt(); - return new Content(inner, chance, maxChance, tierChanceBoost); + return new Content(inner, chance, maxChance); } Class contentClass(); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/CapabilityContentBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/CapabilityContentBuilder.java index 44b16966aba..6eb0776a61f 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/CapabilityContentBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/CapabilityContentBuilder.java @@ -57,13 +57,12 @@ void buildWidgetContent(IWidget widget, Content content, IO io, boolean perTick, recipeType, recipe, chanceTier, recipeTier) -> { if (!(widget instanceof RecipeViewerSlotWidget recipeViewerSlotWidget)) return; - float chance = (float) recipeType.getChanceFunction() - .getBoostedChance(content, recipeTier, chanceTier) / content.maxChance(); + float chance = (float) content.chance() / content.maxChance(); var innerContent = ItemRecipeCapability.CAP.of(content.content()); recipeViewerSlotWidget.value(ItemRecipeCapability.mapIngredientToEntryList(innerContent)); recipeViewerSlotWidget - .overlay(new ContentOverlay(content, perTick, recipeTier, chanceTier, recipeType.getChanceFunction())); + .overlay(new ContentOverlay(content, perTick)); recipeViewerSlotWidget.chance(chance); if (io == IO.IN && (content.chance() == 0 || @@ -78,8 +77,7 @@ void buildWidgetContent(IWidget widget, Content content, IO io, boolean perTick, recipeViewerSlotWidget.tooltipBuilder((tooltip) -> { Content.addChanceTooltips(tooltip, content, - recipe.getChanceLogicForCapability(ItemRecipeCapability.CAP, io, perTick), - recipeTier, chanceTier, recipeType.getChanceFunction()); + recipe.getChanceLogicForCapability(ItemRecipeCapability.CAP, io, perTick)); if (innerContent.ingredient().getCustomIngredient() instanceof IntProviderIngredient ingredient) { IntProvider countProvider = ingredient.getCountProvider(); @@ -103,13 +101,12 @@ void buildWidgetContent(IWidget widget, Content content, IO io, boolean perTick, recipeType, recipe, chanceTier, recipeTier) -> { if (!(widget instanceof RecipeViewerSlotWidget recipeViewerSlotWidget)) return; - float chance = (float) recipeType.getChanceFunction() - .getBoostedChance(content, recipeTier, chanceTier) / content.maxChance(); + float chance = (float) content.chance() / content.maxChance(); SizedFluidIngredient ingredient = FluidRecipeCapability.CAP.of(content.content()); recipeViewerSlotWidget.value(FluidRecipeCapability.mapIngredientToEntryList(ingredient)); recipeViewerSlotWidget - .overlay(new ContentOverlay(content, perTick, recipeTier, chanceTier, recipeType.getChanceFunction())); + .overlay(new ContentOverlay(content, perTick)); recipeViewerSlotWidget.chance(chance); recipeViewerSlotWidget.tooltipBuilder((tooltip) -> { diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/ContentOverlay.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/ContentOverlay.java index 720a0ed3d89..3a3f7ea4e47 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/ContentOverlay.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/gui/ContentOverlay.java @@ -1,6 +1,5 @@ package com.gregtechceu.gtceu.api.recipe.gui; -import com.gregtechceu.gtceu.api.recipe.chance.boost.ChanceBoostFunction; import com.gregtechceu.gtceu.api.recipe.chance.logic.ChanceLogic; import com.gregtechceu.gtceu.api.recipe.content.Content; import com.gregtechceu.gtceu.api.recipe.ingredient.IRangedIngredient; @@ -22,16 +21,14 @@ import brachy.modularui.screen.viewport.GuiContext; import brachy.modularui.theme.WidgetTheme; import com.mojang.blaze3d.systems.RenderSystem; -import org.jetbrains.annotations.Nullable; @OnlyIn(Dist.CLIENT) -public record ContentOverlay(Content content, boolean perTick, int recipeTier, int chanceTier, - @Nullable ChanceBoostFunction function) +public record ContentOverlay(Content content, boolean perTick) implements IDrawable { @Override public void draw(GuiContext context, int x, int y, int width, int height, WidgetTheme widgetTheme) { - drawChance(context.getGraphics(), x, y, width, height, recipeTier, chanceTier, function); + drawChance(context.getGraphics(), x, y, width, height); drawRangeAmount(context.getGraphics(), x, y, width, height); drawFluidAmount(context.getGraphics(), x, y, width, height); if (perTick) { @@ -87,21 +84,18 @@ public void drawFluidAmount(GuiGraphics graphics, float x, float y, int width, i } } - public void drawChance(GuiGraphics graphics, float x, float y, int width, int height, int recipeTier, - int chanceTier, @Nullable ChanceBoostFunction function) { + public void drawChance(GuiGraphics graphics, float x, float y, int width, int height) { if (content.chance() == ChanceLogic.getMaxChancedValue()) return; graphics.pose().pushPose(); graphics.pose().translate(0, 0, 400); graphics.pose().scale(0.5f, 0.5f, 1); - var func = function == null ? ChanceBoostFunction.NONE : function; - int chance = func.getBoostedChance(content, recipeTier, chanceTier); - float chanceFloat = 1f * chance / content.maxChance(); + float chanceFloat = 1f * content.chance() / content.maxChance(); String percent = FormattingUtil.formatNumber2Places(100 * chanceFloat); - Component s = chance == 0 ? Component.translatable("gtceu.gui.content.chance_nc_short") : + Component s = content.chance() == 0 ? Component.translatable("gtceu.gui.content.chance_nc_short") : Component.literal(percent + "%"); - int color = chance == 0 ? 0xFF0000 : GradientUtil.toRGB(Mth.lerp(chanceFloat, 29f, 167f), 100f, 50f); + int color = content.chance() == 0 ? 0xFF0000 : GradientUtil.toRGB(Mth.lerp(chanceFloat, 29f, 167f), 100f, 50f); Font fontRenderer = Minecraft.getInstance().font; graphics.drawString(fontRenderer, s, (int) ((x + (width / 3f)) * 2 - fontRenderer.width(s) + 23), (int) ((y + (height / 3f) + 6) * 2 - height), color, true); diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IRangedIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IRangedIngredient.java index 707f63186a3..5f3575731bb 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IRangedIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IRangedIngredient.java @@ -28,6 +28,8 @@ default int rollSampledCount() { int rollSampledCount(@NotNull RandomSource random); + int getAmount(); + /** * @return the average roll of this ranged amount */ diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java index c18b2bf2395..62f05bfd292 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredient.java @@ -19,6 +19,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import java.util.Arrays; import java.util.stream.Stream; /** @@ -45,7 +46,6 @@ public class IntProviderFluidIngredient extends FluidIngredient implements IRang * The last result of {@link IntProviderFluidIngredient#rollSampledCount()}. -1 if not rolled. */ @Getter - @Setter protected int sampledCount = -1; /** * The {@link FluidIngredient} to have a ranged amount. @@ -54,81 +54,82 @@ public class IntProviderFluidIngredient extends FluidIngredient implements IRang private final FluidIngredient inner; @Setter protected FluidStack @Nullable [] fluidStacks = null; + @Getter + private int amount; + private boolean changed = true; protected IntProviderFluidIngredient(FluidIngredient inner, IntProvider provider) { this.inner = inner; this.countProvider = provider; + setAmount(provider.getMaxValue()); } protected IntProviderFluidIngredient(FluidIngredient inner, IntProvider provider, int sampledCount) { this.inner = inner; this.countProvider = provider; this.sampledCount = sampledCount; + setAmount(isRolled() ? sampledCount : provider.getMaxValue()); } public IntProviderFluidIngredient copy() { - IntProviderFluidIngredient copied = new IntProviderFluidIngredient(this.inner, this.countProvider); - copied.setSampledCount(this.sampledCount); - copied.setFluidStacks(this.fluidStacks); - return copied; - } + IntProviderFluidIngredient ipfi = new IntProviderFluidIngredient(this.inner, this.countProvider); + ipfi.setSampledCount(this.sampledCount); + ipfi.setFluidStacks(this.fluidStacks); + ipfi.setAmount(this.getAmount()); + return ipfi; + } + +// @Override +// public boolean isEmpty() { +// return this.getAmount() == 0 || inner.isEmpty(); +// } +// +// @Override +// public boolean isEmpty() { +// return inner.isEmpty(); +// } /** - * An {@link IntProviderFluidIngredient} does not have an amount. - * You probably want either {@link IntProviderFluidIngredient#getStacks()} or - * {@link IntProviderFluidIngredient#getMaxSizeStack()}. - */ - @Deprecated - public int getAmount() { - if (ConfigHolder.INSTANCE.dev.debug) { - throw new IllegalCallerException("An IPFI should never have getAmount() called on it!"); - } - return -1; - } - - /** - * Gets a usable {@link FluidStack FluidStack[]} from this {@link IntProviderFluidIngredient}. + * Gets a usable {@link FluidStack Stream} from this {@link IntProviderFluidIngredient}. * If this ingredient has not yet had its {@link IntProviderFluidIngredient#sampledCount} rolled, rolls it. * - * @return a {@link FluidStack FluidStack[]} with amount {@link IntProviderFluidIngredient#sampledCount} + * @return a {@link FluidStack FluidStack[]} with amount {@link IntProviderFluidIngredient#amount} */ @Override public Stream generateStacks() { - if (fluidStacks == null) { - int cachedAmount = rollSampledCount(GTValues.RNG); - if (cachedAmount == 0) { - return Stream.of(EMPTY_STACK_ARRAY); - } - var innerStacks = inner.getStacks(); - this.fluidStacks = new FluidStack[innerStacks.length]; - for (int i = 0; i < fluidStacks.length; i++) { - fluidStacks[i] = innerStacks[i].copyWithAmount(cachedAmount); - } - } - return Stream.of(fluidStacks); + return Arrays.stream(getFluidStacks()); } /** * Gets a usable {@link FluidStack FluidStack[]} from this {@link IntProviderFluidIngredient}. * If this ingredient has not yet had its {@link IntProviderFluidIngredient#sampledCount} rolled, rolls it. * - * @return a {@link FluidStack FluidStack[]} with amount {@link IntProviderFluidIngredient#sampledCount} + * @return a {@link FluidStack FluidStack[]} with amount {@link IntProviderFluidIngredient#amount} */ public FluidStack[] getFluidStacks() { - if (fluidStacks == null) { - int cachedAmount = rollSampledCount(GTValues.RNG); - if (cachedAmount == 0) { - return EMPTY_STACK_ARRAY; + if (changed || fluidStacks == null) { + changed = false; + if (!isRolled()) { + setAmount(rollSampledCount()); + if (getAmount() == 0) { + fluidStacks = EMPTY_STACK_ARRAY; + return EMPTY_STACK_ARRAY; + } } var innerStacks = inner.getStacks(); this.fluidStacks = new FluidStack[innerStacks.length]; for (int i = 0; i < fluidStacks.length; i++) { - fluidStacks[i] = innerStacks[i].copyWithAmount(cachedAmount); + fluidStacks[i] = innerStacks[i].copyWithAmount(getAmount()); } } return fluidStacks; } + public void setAmount(int amount) { + this.amount = amount; + this.changed = true; + } + @Override public boolean test(@NotNull FluidStack stack) { return inner.test(stack); @@ -166,10 +167,11 @@ public FluidIngredientType getType() { * @return the amount rolled */ public int rollSampledCount(@NotNull RandomSource random) { - if (sampledCount == -1) { + if (!isRolled()) { sampledCount = countProvider.sample(random); + this.setAmount(sampledCount); } - return sampledCount; + return getAmount(); } @Override @@ -199,9 +201,18 @@ public static boolean intProviderEqual(IntProvider o1, IntProvider o2) { @Override public void reset() { sampledCount = -1; + this.setAmount(getMaxRoll()); fluidStacks = null; } + /** + * Also sets the Amount of this ingredient + */ + public void setSampledCount(int count) { + this.sampledCount = count; + this.setAmount(count); + } + /** * @param inner {@link FluidIngredient} * @param provider usually as {@link UniformInt#of(int, int)} diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java index 6de67058db8..e0e61bd468a 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredient.java @@ -39,7 +39,8 @@ public class IntProviderIngredient implements ICustomIngredient, IRangedIngredie public static final MapCodec CODEC = RecordCodecBuilder.mapCodec(instance -> instance.group( Ingredient.CODEC.fieldOf("inner").forGetter(IntProviderIngredient::getInner), IntProvider.CODEC.fieldOf("count_provider").forGetter(IntProviderIngredient::getCountProvider), - Codec.INT.optionalFieldOf("sampled_count", -1).forGetter(IRangedIngredient::getSampledCount) + Codec.INT.optionalFieldOf("sampled_count", -1).forGetter(IRangedIngredient::getSampledCount), + Codec.INT.optionalFieldOf("sampled_count", -1).forGetter(IRangedIngredient::getAmount) ).apply(instance, IntProviderIngredient::new)); // spotless:on public static final ResourceLocation TYPE = GTCEu.id("int_provider"); @@ -51,7 +52,6 @@ public class IntProviderIngredient implements ICustomIngredient, IRangedIngredie * The last result of {@link IntProviderIngredient#rollSampledCount(RandomSource)}. -1 if not rolled. */ @Getter - @Setter protected int sampledCount = -1; /** * The {@link Ingredient} to have a ranged amount. @@ -59,17 +59,26 @@ public class IntProviderIngredient implements ICustomIngredient, IRangedIngredie @Getter protected final Ingredient inner; @Setter - protected ItemStack @Nullable [] itemStacks = null; + protected @Nullable ItemStack[] itemStacks = null; + @Getter + private int amount; + private boolean changed = true; protected IntProviderIngredient(Ingredient inner, IntProvider countProvider) { this.inner = inner; this.countProvider = countProvider; + this.amount = getMaxRoll(); } - protected IntProviderIngredient(Ingredient inner, IntProvider countProvider, int sampledCount) { + protected IntProviderIngredient(Ingredient inner, IntProvider countProvider, int sampledCount, int amount) { this.inner = inner; this.countProvider = countProvider; this.sampledCount = sampledCount; + this.amount = amount; + } + + public IntProviderIngredient copy() { + return new IntProviderIngredient(this.inner, this.countProvider, this.sampledCount, this.amount); } /** @@ -103,20 +112,29 @@ public boolean test(@Nullable ItemStack stack) { * @return a {@link ItemStack ItemStack[]} with count {@link IntProviderIngredient#sampledCount} */ public ItemStack[] getItemStacks() { - if (itemStacks == null) { - int cachedCount = rollSampledCount(); - if (cachedCount == 0) { - return EMPTY_STACK_ARRAY; + if (changed || itemStacks == null) { + changed = false; + if (!isRolled()) { + setAmount(rollSampledCount()); + if (getAmount() == 0) { + itemStacks = EMPTY_STACK_ARRAY; + return EMPTY_STACK_ARRAY; + } } var innerStacks = inner.getItems(); this.itemStacks = new ItemStack[innerStacks.length]; for (int i = 0; i < itemStacks.length; i++) { - itemStacks[i] = innerStacks[i].copyWithCount(cachedCount); + itemStacks[i] = innerStacks[i].copyWithCount(getAmount()); } } return itemStacks; } + public void setAmount(int amount) { + this.amount = amount; + this.changed = true; + } + @Override public Stream getItems() { return Arrays.stream(getItemStacks()); @@ -169,17 +187,27 @@ public IngredientType getType() { */ @Override public int rollSampledCount(@NotNull RandomSource random) { - if (sampledCount == -1) { + if (!isRolled()) { sampledCount = countProvider.sample(random); + this.setAmount(sampledCount); } return sampledCount; } + /** + * Also sets the Amount of this ingredient + */ + public void setSampledCount(int count) { + this.sampledCount = count; + this.setAmount(count); + } + /** * Resets the random roll on this ingredient */ public void reset() { sampledCount = -1; + setAmount(getMaxRoll()); itemStacks = null; } } diff --git a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ModifierFunction.java b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ModifierFunction.java index 35067a36053..fca5c1f30b4 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ModifierFunction.java +++ b/src/main/java/com/gregtechceu/gtceu/api/recipe/modifier/ModifierFunction.java @@ -204,7 +204,7 @@ public ModifierFunction build() { private static Map, List> applyAllButEU(ContentModifier cm, Map, List> contents) { - if (cm == ContentModifier.IDENTITY) return new HashMap<>(contents); + // Prerolls require copying, even on IDENTITY Map, List> copyContents = new HashMap<>(); for (var entry : contents.entrySet()) { var cap = entry.getKey(); diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/impl/FluidAreaRender.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/impl/FluidAreaRender.java index a116a8d7e51..5296fc7c225 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/impl/FluidAreaRender.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/impl/FluidAreaRender.java @@ -91,7 +91,7 @@ public void render(WorkableMultiblockMachine machine, float partialTick, if (trait == null || !machine.isFormed() || trait.getFluidOffsets().isEmpty()) return; if (!fixedFluid) { - var lastRecipe = machine.getRecipeLogic().getLastRecipe(); + var lastRecipe = machine.getRecipeLogic().getLastDisplayedRecipe(); if (lastRecipe == null) { cachedRecipe = null; cachedFluid = null; diff --git a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/impl/GrowingPlantRender.java b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/impl/GrowingPlantRender.java index fe5dc7a56ff..5b811116d96 100644 --- a/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/impl/GrowingPlantRender.java +++ b/src/main/java/com/gregtechceu/gtceu/client/renderer/machine/impl/GrowingPlantRender.java @@ -115,7 +115,7 @@ public void render(IRecipeLogicMachine rlm, float partialTick, PoseStack poseSta final RecipeLogic recipeLogic = rlm.getRecipeLogic(); Optional currentBlock = this.growingBlock - .or(() -> Optional.ofNullable(recipeLogic.getLastRecipe()).flatMap(this::findGrowing)); + .or(() -> Optional.ofNullable(recipeLogic.getLastDisplayedRecipe()).flatMap(this::findGrowing)); if (currentBlock.isEmpty()) return; Block growing = currentBlock.get(); BlockState state = growing.defaultBlockState(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java index 2cc469ee7af..a70f43d5633 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java +++ b/src/main/java/com/gregtechceu/gtceu/common/data/GTRecipeTypes.java @@ -583,10 +583,8 @@ public class GTRecipeTypes { if (shouldDivide && fluidsDivisible) { builder.chance(inputContent.chance()) - .tierChanceBoost(inputContent.tierChanceBoost()) .inputFluids(dividedInputFluid) .chance(outputContent.chance()) - .tierChanceBoost(outputContent.tierChanceBoost()) .outputFluids(dividedOutputFluid) .duration(Math.max(1, recipeDuration / ratio)); } else if (!shouldDivide) { @@ -595,10 +593,8 @@ public class GTRecipeTypes { } builder.conditions.addAll(recipeBuilder.conditions); builder.chance(inputContent.chance()) - .tierChanceBoost(inputContent.tierChanceBoost()) .inputFluids(input) .chance(outputContent.chance()) - .tierChanceBoost(outputContent.tierChanceBoost()) .outputFluids(output) .duration(recipeDuration) .save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/common/item/behavior/PortableScannerBehavior.java b/src/main/java/com/gregtechceu/gtceu/common/item/behavior/PortableScannerBehavior.java index 6f9e157749f..81b0ebd718b 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/item/behavior/PortableScannerBehavior.java +++ b/src/main/java/com/gregtechceu/gtceu/common/item/behavior/PortableScannerBehavior.java @@ -313,7 +313,7 @@ public int addScannerInfo(Player player, Level level, BlockPos pos, DisplayMode // Recipe logic for EU production/consumption RecipeLogic recipeLogic = machine.getTrait(RecipeLogic.TYPE); if (recipeLogic != null) { - GTRecipe recipe = recipeLogic.getLastRecipe(); + GTRecipe recipe = recipeLogic.getLastDisplayedRecipe(); if (recipeLogic.getStatus().equals(RecipeLogic.Status.WAITING)) { list.add(Component.translatable("behavior.portable_scanner.divider")); list.add(Component.translatable("gtceu.multiblock.waiting")); diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FusionReactorMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FusionReactorMachine.java index c49ab2c0de2..ebdb7e77854 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FusionReactorMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/electric/FusionReactorMachine.java @@ -200,7 +200,7 @@ public static ModifierFunction recipeModifier(MetaMachine machine, GTRecipe reci @Override public boolean onWorking() { - GTRecipe recipe = recipeLogic.getLastRecipe(); + GTRecipe recipe = recipeLogic.getLastDisplayedRecipe(); assert recipe != null; if (recipe.data.contains("eu_to_start")) { long heatDiff = recipe.data.getLong("eu_to_start") - this.heat; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java index 218628ca87c..b6e764dbd0d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeCombustionEngineMachine.java @@ -204,7 +204,7 @@ public boolean regressWhenWaiting() { @Nullable public String getRecipeFluidInputInfo() { // Previous Recipe is always null on first world load, so try to acquire a new recipe - GTRecipe recipe = recipeLogic.getLastRecipe(); + GTRecipe recipe = recipeLogic.getLastDisplayedRecipe(); if (recipe == null) { Iterator iterator = recipeLogic.searchRecipe(); recipe = iterator.hasNext() ? iterator.next() : null; diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeTurbineMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeTurbineMachine.java index 63c42720d6a..367829ee39d 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeTurbineMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/multiblock/generator/LargeTurbineMachine.java @@ -100,8 +100,8 @@ public int getTotalEfficiency() { } public long getCurrentProduction() { - return isActive() && recipeLogic.getLastRecipe() != null ? - recipeLogic.getLastRecipe().getOutputEUt().voltage() : 0; + return isActive() && recipeLogic.getLastDisplayedRecipe() != null ? + recipeLogic.getLastDisplayedRecipe().getOutputEUt().voltage() : 0; } public int getRotorDurabilityPercent() { diff --git a/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolidBoilerMachine.java b/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolidBoilerMachine.java index b59eaf2c6a5..d254093e849 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolidBoilerMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/common/machine/steam/SteamSolidBoilerMachine.java @@ -71,8 +71,8 @@ protected long getBaseSteamOutput() { @Override public void afterWorking() { super.afterWorking(); - if (recipeLogic.getLastRecipe() != null) { - var inputs = recipeLogic.getLastRecipe().inputs.getOrDefault(ItemRecipeCapability.CAP, + if (recipeLogic.getLastDisplayedRecipe() != null) { + var inputs = recipeLogic.getLastDisplayedRecipe().inputs.getOrDefault(ItemRecipeCapability.CAP, Collections.emptyList()); if (!inputs.isEmpty()) { var input = ItemRecipeCapability.CAP.of(inputs.getFirst().content()).getItems(); diff --git a/src/main/java/com/gregtechceu/gtceu/common/mui/GTMultiblockTextUtil.java b/src/main/java/com/gregtechceu/gtceu/common/mui/GTMultiblockTextUtil.java index 8944bfdf141..30e603a76e3 100644 --- a/src/main/java/com/gregtechceu/gtceu/common/mui/GTMultiblockTextUtil.java +++ b/src/main/java/com/gregtechceu/gtceu/common/mui/GTMultiblockTextUtil.java @@ -259,8 +259,8 @@ public static TextWidget addEnergyTierLine(WorkableElectricMultiblockMachine public static TextWidget addParallelLine(WorkableMultiblockMachine rlMachine, PanelSyncManager syncManager) { IntSyncValue parallelAmount = syncManager.getOrCreateSyncHandler("parallelAmount", IntSyncValue.class, () -> new IntSyncValue(() -> { - if (rlMachine.getRecipeLogic().getLastRecipe() == null) return 0; - return rlMachine.getRecipeLogic().getLastRecipe().parallels; + if (rlMachine.getRecipeLogic().getLastDisplayedRecipe() == null) return 0; + return rlMachine.getRecipeLogic().getLastDisplayedRecipe().parallels; })); return Text.dynamic(() -> { @@ -278,8 +278,8 @@ public static TextWidget addBatchModeLine(WorkableMultiblockMachine rlMachine () -> new BooleanSyncValue(rlMachine::isBatchEnabled)); IntSyncValue batchAmount = syncManager.getOrCreateSyncHandler("batchAmount", IntSyncValue.class, () -> new IntSyncValue(() -> { - if (rlMachine.getRecipeLogic().getLastRecipe() == null) return 0; - return rlMachine.getRecipeLogic().getLastRecipe().batchParallels; + if (rlMachine.getRecipeLogic().getLastDisplayedRecipe() == null) return 0; + return rlMachine.getRecipeLogic().getLastDisplayedRecipe().batchParallels; })); return Text.dynamic(() -> { @@ -296,8 +296,8 @@ public static TextWidget addSubtickParallelsLine(WorkableMultiblockMachine rl PanelSyncManager syncManager) { IntSyncValue subtickAmount = syncManager.getOrCreateSyncHandler("subtickAmount", IntSyncValue.class, () -> new IntSyncValue(() -> { - if (rlMachine.getRecipeLogic().getLastRecipe() == null) return 0; - return rlMachine.getRecipeLogic().getLastRecipe().subtickParallels; + if (rlMachine.getRecipeLogic().getLastDisplayedRecipe() == null) return 0; + return rlMachine.getRecipeLogic().getLastDisplayedRecipe().subtickParallels; })); return Text.dynamic(() -> { @@ -313,8 +313,8 @@ public static TextWidget addSubtickParallelsLine(WorkableMultiblockMachine rl public static TextWidget addTotalRunsLine(WorkableMultiblockMachine rlMachine, PanelSyncManager syncManager) { IntSyncValue totalRunAmount = syncManager.getOrCreateSyncHandler("totalRunAmount", IntSyncValue.class, () -> new IntSyncValue(() -> { - if (rlMachine.getRecipeLogic().getLastRecipe() == null) return 0; - return rlMachine.getRecipeLogic().getLastRecipe().getTotalRuns(); + if (rlMachine.getRecipeLogic().getLastDisplayedRecipe() == null) return 0; + return rlMachine.getRecipeLogic().getLastDisplayedRecipe().getTotalRuns(); })); return Text.dynamic(() -> { @@ -403,7 +403,7 @@ public static DynamicWidget addOutputLines(WorkableMultiblockMachine rlmachin "GTRecipe", GenericSyncValue.class, () -> GenericSyncValue.builder(GTRecipe.class) - .getter(() -> rlmachine.getRecipeLogic().getLastRecipe()) + .getter(() -> rlmachine.getRecipeLogic().getLastDisplayedRecipe()) .setter((newRecipe) -> {}) .adapter(GTByteBufAdapters.GTRECIPE) .nullable() @@ -443,7 +443,6 @@ public static DynamicWidget addOutputLines(WorkableMultiblockMachine rlmachin public static Optional> createItemLineForOutput(Content itemOutput, GTRecipe recipe) { int runs = recipe.getTotalRuns(); - var function = recipe.getType().getChanceFunction(); int recipeTier = RecipeHelper.getPreOCRecipeEuTier(recipe); int chanceTier = recipeTier + recipe.ocLevel; @@ -464,8 +463,7 @@ public static Optional> createItemLineForOutput(Content itemOutput, GT provider.getCountProvider().getMinValue(), provider.getCountProvider().getMaxValue()); if (itemOutput.chance() < itemOutput.maxChance()) { - countD = countD * runs * function.getBoostedChance(itemOutput, recipeTier, chanceTier) / - itemOutput.maxChance(); + countD = countD * runs * itemOutput.chance() / itemOutput.maxChance(); } countD = countD * provider.getMidRoll(); } else { @@ -476,8 +474,7 @@ public static Optional> createItemLineForOutput(Content itemOutput, GT countD *= count; if (itemOutput.chance() < itemOutput.maxChance()) { rounded = true; - countD = countD * runs * function.getBoostedChance(itemOutput, recipeTier, chanceTier) / - itemOutput.maxChance(); + countD = countD * runs * itemOutput.chance() / itemOutput.maxChance(); } count = Math.max(1, (int) Math.round(countD)); displaycount = Component.literal(String.valueOf(count)); @@ -511,7 +508,6 @@ public static Optional> createItemLineForOutput(Content itemOutput, GT public static Optional> createFluidLineForOutput(Content fluidOutput, GTRecipe recipe) { int runs = recipe.getTotalRuns(); - var function = recipe.getType().getChanceFunction(); int recipeTier = RecipeHelper.getPreOCRecipeEuTier(recipe); int chanceTier = recipeTier + recipe.ocLevel; @@ -532,8 +528,7 @@ public static Optional> createFluidLineForOutput(Content fluidOutput, provider.getCountProvider().getMinValue(), provider.getCountProvider().getMaxValue()); if (fluidOutput.chance() < fluidOutput.maxChance()) { - amountD = amountD * runs * function.getBoostedChance(fluidOutput, recipeTier, chanceTier) / - fluidOutput.maxChance(); + amountD = amountD * runs * fluidOutput.chance() / fluidOutput.maxChance(); } amountD = amountD * provider.getMidRoll(); } else { @@ -544,8 +539,7 @@ public static Optional> createFluidLineForOutput(Content fluidOutput, amountD *= amount; if (fluidOutput.chance() < fluidOutput.maxChance()) { rounded = true; - amountD = amountD * runs * function.getBoostedChance(fluidOutput, recipeTier, chanceTier) / - fluidOutput.maxChance(); + amountD = amountD * runs * fluidOutput.chance() / fluidOutput.maxChance(); } amount = Math.max(1, (int) Math.round(amountD)); displaycount = Component.literal(String.valueOf(amount)); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java index 9e4ff275552..241dace08cd 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/builder/GTRecipeBuilder.java @@ -99,8 +99,6 @@ public class GTRecipeBuilder { public int chance = ChanceLogic.getMaxChancedValue(); @Setter public int maxChance = ChanceLogic.getMaxChancedValue(); - @Setter - public int tierChanceBoost = 0; private boolean itemMaterialInfo = false; private boolean fluidMaterialInfo = false; private boolean removePreviousMatInfo = false; @@ -179,7 +177,7 @@ public GTRecipeBuilder copyFrom(GTRecipeBuilder builder) { } protected Content makeContent(Object o) { - return new Content(o, chance, maxChance, tierChanceBoost); + return new Content(o, chance, maxChance); } public GTRecipeBuilder input(RecipeCapability capability, T obj) { @@ -741,115 +739,97 @@ public GTRecipeBuilder circuitMeta(int configuration) { return notConsumable(IntCircuitIngredient.circuit(configuration)); } - public GTRecipeBuilder chancedInput(Ingredient stack, int chance, int tierChanceBoost) { + public GTRecipeBuilder chancedInput(Ingredient stack, int chance) { if (checkChanceAndPrintError(chance)) { return this; } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; inputItems(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeBuilder chancedInput(SizedIngredient stack, int chance, int tierChanceBoost) { + public GTRecipeBuilder chancedInput(SizedIngredient stack, int chance) { if (checkChanceAndPrintError(chance)) { return this; } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; inputItems(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeBuilder chancedInput(SizedFluidIngredient stack, int chance, int tierChanceBoost) { + public GTRecipeBuilder chancedInput(SizedFluidIngredient stack, int chance) { if (checkChanceAndPrintError(chance)) { return this; } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; inputFluids(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeBuilder chancedOutput(Ingredient stack, int chance, int tierChanceBoost) { + public GTRecipeBuilder chancedOutput(Ingredient stack, int chance) { if (checkChanceAndPrintError(chance)) { return this; } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; outputItems(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeBuilder chancedOutput(SizedIngredient stack, int chance, int tierChanceBoost) { + public GTRecipeBuilder chancedOutput(SizedIngredient stack, int chance) { if (checkChanceAndPrintError(chance)) { return this; } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; outputItems(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeBuilder chancedOutput(SizedFluidIngredient stack, int chance, int tierChanceBoost) { + public GTRecipeBuilder chancedOutput(SizedFluidIngredient stack, int chance) { if (checkChanceAndPrintError(chance)) { return this; } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; outputFluids(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeBuilder chancedInput(ItemStack stack, int chance, int tierChanceBoost) { - return chancedInput(SizedIngredient.of(stack.getItem(), stack.getCount()), chance, tierChanceBoost); + public GTRecipeBuilder chancedInput(ItemStack stack, int chance) { + return chancedInput(SizedIngredient.of(stack.getItem(), stack.getCount()), chance); } - public GTRecipeBuilder chancedInput(FluidStack stack, int chance, int tierChanceBoost) { - return chancedInput(SizedFluidIngredient.of(stack), chance, tierChanceBoost); + public GTRecipeBuilder chancedInput(FluidStack stack, int chance) { + return chancedInput(SizedFluidIngredient.of(stack), chance); } - public GTRecipeBuilder chancedOutput(ItemStack stack, int chance, int tierChanceBoost) { - return chancedOutput(SizedIngredient.of(stack.getItem(), stack.getCount()), chance, tierChanceBoost); + public GTRecipeBuilder chancedOutput(ItemStack stack, int chance) { + return chancedOutput(SizedIngredient.of(stack.getItem(), stack.getCount()), chance); } - public GTRecipeBuilder chancedOutput(FluidStack stack, int chance, int tierChanceBoost) { - return chancedOutput(SizedFluidIngredient.of(stack), chance, tierChanceBoost); + public GTRecipeBuilder chancedOutput(FluidStack stack, int chance) { + return chancedOutput(SizedFluidIngredient.of(stack), chance); } - public GTRecipeBuilder chancedOutput(TagPrefix tag, Material mat, int chance, int tierChanceBoost) { - return chancedOutput(ChemicalHelper.get(tag, mat), chance, tierChanceBoost); + public GTRecipeBuilder chancedOutput(TagPrefix tag, Material mat, int chance) { + return chancedOutput(ChemicalHelper.get(tag, mat), chance); } - public GTRecipeBuilder chancedOutput(TagPrefix tag, Material mat, int count, int chance, int tierChanceBoost) { - return chancedOutput(ChemicalHelper.get(tag, mat, count), chance, tierChanceBoost); + public GTRecipeBuilder chancedOutput(TagPrefix tag, Material mat, int count, int chance) { + return chancedOutput(ChemicalHelper.get(tag, mat, count), chance); } - public GTRecipeBuilder chancedOutput(ItemStack stack, String fraction, int tierChanceBoost) { + public GTRecipeBuilder chancedOutput(ItemStack stack, String fraction) { if (stack.isEmpty()) { return this; } @@ -889,36 +869,32 @@ public GTRecipeBuilder chancedOutput(ItemStack stack, String fraction, int tierC int lastChance = this.chance; int lastMaxChance = this.maxChance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; this.maxChance = maxChance; - this.tierChanceBoost = tierChanceBoost; outputItems(stack); this.chance = lastChance; this.maxChance = lastMaxChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTRecipeBuilder chancedOutput(TagPrefix prefix, Material material, int count, String fraction, - int tierChanceBoost) { - return chancedOutput(ChemicalHelper.get(prefix, material, count), fraction, tierChanceBoost); + public GTRecipeBuilder chancedOutput(TagPrefix prefix, Material material, int count, String fraction) { + return chancedOutput(ChemicalHelper.get(prefix, material, count), fraction); } - public GTRecipeBuilder chancedOutput(TagPrefix prefix, Material material, String fraction, int tierChanceBoost) { - return chancedOutput(prefix, material, 1, fraction, tierChanceBoost); + public GTRecipeBuilder chancedOutput(TagPrefix prefix, Material material, String fraction) { + return chancedOutput(prefix, material, 1, fraction); } - public GTRecipeBuilder chancedOutput(Item item, int count, String fraction, int tierChanceBoost) { - return chancedOutput(new ItemStack(item, count), fraction, tierChanceBoost); + public GTRecipeBuilder chancedOutput(Item item, int count, String fraction) { + return chancedOutput(new ItemStack(item, count), fraction); } - public GTRecipeBuilder chancedOutput(Item item, String fraction, int tierChanceBoost) { - return chancedOutput(item, 1, fraction, tierChanceBoost); + public GTRecipeBuilder chancedOutput(Item item, String fraction) { + return chancedOutput(item, 1, fraction); } - public GTRecipeBuilder chancedFluidOutput(FluidStack stack, String fraction, int tierChanceBoost) { + public GTRecipeBuilder chancedFluidOutput(FluidStack stack, String fraction) { if (stack.isEmpty()) { return this; } @@ -958,14 +934,11 @@ public GTRecipeBuilder chancedFluidOutput(FluidStack stack, String fraction, int int lastChance = this.chance; int lastMaxChance = this.maxChance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; this.maxChance = maxChance; - this.tierChanceBoost = tierChanceBoost; outputFluids(stack); this.chance = lastChance; this.maxChance = lastMaxChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } @@ -1573,7 +1546,7 @@ private void addOutputMaterialInfo() { if (items.length > 0) { out = items[0].getItem(); // use the max amount of items for decomp info so dupes can't happen - outputCount = intProvider.getCountProvider().getMaxValue(); + outputCount = intProvider.getMaxRoll(); } } else if (!currOutput.ingredient().hasNoItems()) { ItemStack[] items = currOutput.getItems(); @@ -1624,7 +1597,7 @@ private void removeExistingMaterialInfo() { if (items.length > 0) { out = items[0].getItem(); // use the max amount of items for decomp info so dupes can't happen - outputCount = intProvider.getCountProvider().getMaxValue(); + outputCount = intProvider.getMaxRoll(); } } else if (!currOutput.ingredient().hasNoItems()) { ItemStack[] items = currOutput.getItems(); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java index abc9f0aef95..59d4b665c11 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/MaterialRecipeHandler.java @@ -76,7 +76,7 @@ private static void processDust(@NotNull RecipeOutput provider, @NotNull Materia AUTOCLAVE_RECIPES.recipeBuilder("autoclave_" + id + "_water") .inputItems(dustStack) .inputFluids(Water.getFluid(250)) - .chancedOutput(gemStack, 7500, 0) + .chancedOutput(gemStack, 7500) .duration(1200).EUt(24) .save(provider); @@ -92,28 +92,28 @@ private static void processDust(@NotNull RecipeOutput provider, @NotNull Materia IMPLOSION_RECIPES.recipeBuilder("implode_" + id + "_powderbarrel") .inputItems(dustStack.copyWithCount(4)) .outputItems(gemStack.copyWithCount(3)) - .chancedOutput(dust, GTMaterials.DarkAsh, 2500, 0) + .chancedOutput(dust, GTMaterials.DarkAsh, 2500) .explosivesType(new ItemStack(GTBlocks.POWDERBARREL, 8)) .save(provider); IMPLOSION_RECIPES.recipeBuilder("implode_" + id + "_tnt") .inputItems(dustStack.copyWithCount(4)) .outputItems(gemStack.copyWithCount(3)) - .chancedOutput(dust, GTMaterials.DarkAsh, 2500, 0) + .chancedOutput(dust, GTMaterials.DarkAsh, 2500) .explosivesAmount(4) .save(provider); IMPLOSION_RECIPES.recipeBuilder("implode_" + id + "_dynamite") .inputItems(dustStack.copyWithCount(4)) .outputItems(gemStack.copyWithCount(3)) - .chancedOutput(dust, GTMaterials.DarkAsh, 2500, 0) + .chancedOutput(dust, GTMaterials.DarkAsh, 2500) .explosivesType(GTItems.DYNAMITE.asStack(2)) .save(provider); IMPLOSION_RECIPES.recipeBuilder("implode_" + id + "_itnt") .inputItems(dustStack.copyWithCount(4)) .outputItems(gemStack.copyWithCount(3)) - .chancedOutput(dust, GTMaterials.DarkAsh, 2500, 0) + .chancedOutput(dust, GTMaterials.DarkAsh, 2500) .explosivesType(new ItemStack(GTBlocks.INDUSTRIAL_TNT)) .save(provider); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java index 6db3c80e9a6..68a1d6797e2 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/generated/OreRecipeHandler.java @@ -122,7 +122,7 @@ private static void processOre(@NotNull RecipeOutput provider, @NotNull TagPrefi .recipeBuilder("macerate_" + prefixString + material.getName() + "_ore_to_crushed_ore") .inputItems(inputStack) .outputItems(crushedStack.copyWithCount(crushedCount * 2)) - .chancedOutput(byproductStack, 1400, 0) + .chancedOutput(byproductStack, 1400) .EUt(2) .duration(400) .category(GTRecipeCategories.ORE_CRUSHING); @@ -130,7 +130,7 @@ private static void processOre(@NotNull RecipeOutput provider, @NotNull TagPrefi for (MaterialStack secondaryMaterial : orePrefix.secondaryMaterials()) { if (secondaryMaterial.material().hasProperty(PropertyKey.DUST)) { ItemStack dustStack = ChemicalHelper.getGem(secondaryMaterial); - builder.chancedOutput(dustStack, 6700, 0); + builder.chancedOutput(dustStack, 6700); } } @@ -195,7 +195,7 @@ private static void processRawOre(@NotNull RecipeOutput provider, @NotNull OrePr .recipeBuilder("macerate_raw_" + material.getName() + "_ore_to_crushed_ore") .inputItems(rawOre, material) .outputItems(crushedStack.copyWithCount(property.getOreMultiplier() * 2)) - .chancedOutput(byproductStack, 1400, 0) + .chancedOutput(byproductStack, 1400) .EUt(2) .category(GTRecipeCategories.ORE_CRUSHING) .duration(400); @@ -258,8 +258,7 @@ private static void processCrushedOre(@NotNull RecipeOutput provider, @NotNull O .inputItems(crushed, material) .outputItems(impureDustStack) .duration(400).EUt(2) - .chancedOutput(ChemicalHelper.get(dust, byproductMaterial, property.getByProductMultiplier()), 1400, - 0) + .chancedOutput(ChemicalHelper.get(dust, byproductMaterial, property.getByProductMultiplier()), 1400) .category(GTRecipeCategories.ORE_CRUSHING) .save(provider); @@ -282,7 +281,7 @@ private static void processCrushedOre(@NotNull RecipeOutput provider, @NotNull O .inputFluids(Water.getFluid(1000)) .circuitMeta(1) .outputItems(crushedPurifiedOre) - .chancedOutput(TagPrefix.dust, byproductMaterial, "1/3", 0) + .chancedOutput(TagPrefix.dust, byproductMaterial, "1/3") .outputItems(TagPrefix.dust, GTMaterials.Stone) .save(provider); @@ -290,7 +289,7 @@ private static void processCrushedOre(@NotNull RecipeOutput provider, @NotNull O .inputItems(crushed, material) .inputFluids(DistilledWater.getFluid(100)) .outputItems(crushedPurifiedOre) - .chancedOutput(TagPrefix.dust, byproductMaterial, "1/3", 0) + .chancedOutput(TagPrefix.dust, byproductMaterial, "1/3") .outputItems(TagPrefix.dust, GTMaterials.Stone) .duration(200) .save(provider); @@ -299,7 +298,7 @@ private static void processCrushedOre(@NotNull RecipeOutput provider, @NotNull O .inputItems(crushed, material) .outputItems(crushedCentrifugedOre) .chancedOutput(TagPrefix.dust, property.getOreByProduct(1, material), property.getByProductMultiplier(), - "1/3", 0) + "1/3") .outputItems(TagPrefix.dust, GTMaterials.Stone) .save(provider); @@ -310,9 +309,8 @@ private static void processCrushedOre(@NotNull RecipeOutput provider, @NotNull O .inputItems(crushed, material) .inputFluids(washedInTuple.first().getFluid(washedInTuple.secondInt())) .outputItems(crushedPurifiedOre) - .chancedOutput(ChemicalHelper.get(dust, washingByproduct, property.getByProductMultiplier()), 7000, - 0) - .chancedOutput(ChemicalHelper.get(dust, Stone), 4000, 0) + .chancedOutput(ChemicalHelper.get(dust, washingByproduct, property.getByProductMultiplier()), 7000) + .chancedOutput(ChemicalHelper.get(dust, Stone), 4000) .duration(200).EUt(VA[LV]) .category(GTRecipeCategories.ORE_BATHING) .save(provider); @@ -343,7 +341,7 @@ private static void processCrushedCentrifuged(@NotNull RecipeOutput provider, MACERATOR_RECIPES.recipeBuilder("macerate_" + material.getName() + "_refined_ore_to_dust") .inputItems(crushedRefined, material) .outputItems(dustStack) - .chancedOutput(byproductStack, 1400, 0) + .chancedOutput(byproductStack, 1400) .duration(400).EUt(2) .category(GTRecipeCategories.ORE_CRUSHING) .save(provider); @@ -378,7 +376,7 @@ private static void processCrushedPurified(@NotNull RecipeOutput provider, MACERATOR_RECIPES.recipeBuilder("macerate_" + material.getName() + "_crushed_ore_to_dust") .inputItems(crushedPurified, material) .outputItems(dustStack) - .chancedOutput(byproductStack, 1400, 0) + .chancedOutput(byproductStack, 1400) .duration(400).EUt(2) .category(GTRecipeCategories.ORE_CRUSHING) .save(provider); @@ -392,7 +390,7 @@ private static void processCrushedPurified(@NotNull RecipeOutput provider, .recipeBuilder("centrifuge_" + material.getName() + "_purified_ore_to_refined_ore") .inputItems(crushedPurified, material) .outputItems(crushedCentrifugedStack) - .chancedOutput(TagPrefix.dust, byproductMaterial, "1/3", 0) + .chancedOutput(TagPrefix.dust, byproductMaterial, "1/3") .save(provider); } @@ -407,32 +405,32 @@ private static void processCrushedPurified(@NotNull RecipeOutput provider, GTRecipeBuilder builder = SIFTER_RECIPES .recipeBuilder("sift_" + material.getName() + "_purified_ore_to_gems") .inputItems(crushedPurified, material) - .chancedOutput(exquisiteStack, 500, 0) - .chancedOutput(flawlessStack, 1500, 0) - .chancedOutput(gemStack, 5000, 0) - .chancedOutput(dustStack, 2500, 0) + .chancedOutput(exquisiteStack, 500) + .chancedOutput(flawlessStack, 1500) + .chancedOutput(gemStack, 5000) + .chancedOutput(dustStack, 2500) .duration(400).EUt(16); if (!flawedStack.isEmpty()) - builder.chancedOutput(flawedStack, 2000, 0); + builder.chancedOutput(flawedStack, 2000); if (!chippedStack.isEmpty()) - builder.chancedOutput(chippedStack, 3000, 0); + builder.chancedOutput(chippedStack, 3000); builder.save(provider); } else { GTRecipeBuilder builder = SIFTER_RECIPES .recipeBuilder("sift_" + material.getName() + "_purified_ore_to_gems") .inputItems(crushedPurified, material) - .chancedOutput(exquisiteStack, 300, 0) - .chancedOutput(flawlessStack, 1000, 0) - .chancedOutput(gemStack, 3500, 0) - .chancedOutput(dustStack, 5000, 0) + .chancedOutput(exquisiteStack, 300) + .chancedOutput(flawlessStack, 1000) + .chancedOutput(gemStack, 3500) + .chancedOutput(dustStack, 5000) .duration(400).EUt(16); if (!flawedStack.isEmpty()) - builder.chancedOutput(flawedStack, 2500, 0); + builder.chancedOutput(flawedStack, 2500); if (!chippedStack.isEmpty()) - builder.chancedOutput(chippedStack, 3500, 0); + builder.chancedOutput(chippedStack, 3500); builder.save(provider); } @@ -456,7 +454,7 @@ private static void processDirtyDust(@NotNull RecipeOutput provider, @NotNull Or .duration((int) (material.getMass() * 4)).EUt(24); if (byproduct.hasProperty(PropertyKey.DUST)) { - builder.chancedOutput(TagPrefix.dust, byproduct, "1/9", 0); + builder.chancedOutput(TagPrefix.dust, byproduct, "1/9"); } else { builder.outputFluids(byproduct.getFluid(L / 9)); } @@ -494,8 +492,8 @@ private static void processPureDust(@NotNull RecipeOutput provider, @NotNull Ore ELECTROMAGNETIC_SEPARATOR_RECIPES.recipeBuilder("separate_" + material.getName() + "_pure_dust_to_dust") .inputItems(dustPure, material) .outputItems(dustStack) - .chancedOutput(TagPrefix.dust, separatedMaterial.get(0), 1000, 0) - .chancedOutput(separatedStack2, prefix == TagPrefix.dust ? 500 : 2000, 0) + .chancedOutput(TagPrefix.dust, separatedMaterial.get(0), 1000) + .chancedOutput(separatedStack2, prefix == TagPrefix.dust ? 500 : 2000) .duration(200).EUt(24) .save(provider); } @@ -503,7 +501,7 @@ private static void processPureDust(@NotNull RecipeOutput provider, @NotNull Ore CENTRIFUGE_RECIPES.recipeBuilder("centrifuge_" + material.getName() + "_pure_dust_to_dust") .inputItems(dustPure, material) .outputItems(dustStack) - .chancedOutput(TagPrefix.dust, byproductMaterial, "1/9", 0) + .chancedOutput(TagPrefix.dust, byproductMaterial, "1/9") .duration(100) .EUt(5) .save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CircuitRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CircuitRecipes.java index fb53a5df79b..bf6097b6403 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CircuitRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/CircuitRecipes.java @@ -690,14 +690,14 @@ private static void componentRecipes(RecipeOutput provider) { AUTOCLAVE_RECIPES.recipeBuilder("raw_crystal_chip_emerald") .inputItems(gemExquisite, Emerald) .inputFluids(Europium.getFluid(L / 9)) - .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 2500, 0) + .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 2500) .cleanroom(CleanroomType.CLEANROOM) .duration(12000).EUt(320).save(provider); AUTOCLAVE_RECIPES.recipeBuilder("raw_crystal_chip_olivine") .inputItems(gemExquisite, Olivine) .inputFluids(Europium.getFluid(L / 9)) - .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 2500, 0) + .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 2500) .cleanroom(CleanroomType.CLEANROOM) .duration(12000).EUt(320).save(provider); @@ -716,14 +716,14 @@ private static void componentRecipes(RecipeOutput provider) { AUTOCLAVE_RECIPES.recipeBuilder("raw_crystal_chip_from_part_mutagen") .inputItems(RAW_CRYSTAL_CHIP_PART) .inputFluids(Mutagen.getFluid(250)) - .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 8500, 0) + .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 8500) .cleanroom(CleanroomType.CLEANROOM) .duration(12000).EUt(VA[HV]).save(provider); AUTOCLAVE_RECIPES.recipeBuilder("raw_crystal_chip_from_part_bacterial_sludge") .inputItems(RAW_CRYSTAL_CHIP_PART) .inputFluids(BacterialSludge.getFluid(250)) - .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 8500, 0) + .chancedOutput(RAW_CRYSTAL_CHIP.asStack(), 8500) .cleanroom(CleanroomType.CLEANROOM) .duration(12000).EUt(VA[HV]).save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java index 7bd60f81227..162b6ea0783 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MachineRecipeLoader.java @@ -202,10 +202,10 @@ private static void registerPrimitiveBlastFurnaceRecipes(RecipeOutput provider) .inputItems(dust, Charcoal, 2).outputItems(ingot, Steel).outputItems(dustTiny, DarkAsh, 2) .duration(1800).save(provider); PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coke_gem").inputItems(ingot, Iron) - .inputItems(gem, Coke).outputItems(ingot, Steel).chancedOutput(dust, Ash, "1/9", 0).duration(1500) + .inputItems(gem, Coke).outputItems(ingot, Steel).chancedOutput(dust, Ash, "1/9").duration(1500) .save(provider); PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coke_dust").inputItems(ingot, Iron) - .inputItems(dust, Coke).outputItems(ingot, Steel).chancedOutput(dust, Ash, "1/9", 0).duration(1500) + .inputItems(dust, Coke).outputItems(ingot, Steel).chancedOutput(dust, Ash, "1/9").duration(1500) .save(provider); PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coal_block").inputItems(block, Iron) @@ -232,10 +232,10 @@ private static void registerPrimitiveBlastFurnaceRecipes(RecipeOutput provider) .duration(800) .save(provider); PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coke_gem_wrought").inputItems(ingot, WroughtIron) - .inputItems(gem, Coke).outputItems(ingot, Steel).chancedOutput(dust, Ash, "1/9", 0).duration(600) + .inputItems(gem, Coke).outputItems(ingot, Steel).chancedOutput(dust, Ash, "1/9").duration(600) .save(provider); PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coke_dust_wrought").inputItems(ingot, WroughtIron) - .inputItems(dust, Coke).outputItems(ingot, Steel).chancedOutput(dust, Ash, "1/9", 0).duration(600) + .inputItems(dust, Coke).outputItems(ingot, Steel).chancedOutput(dust, Ash, "1/9").duration(600) .save(provider); PRIMITIVE_BLAST_FURNACE_RECIPES.recipeBuilder("steel_from_coal_block_wrought").inputItems(block, WroughtIron) @@ -318,14 +318,14 @@ private static void registerMixingCrystallizationRecipes(RecipeOutput provider) AUTOCLAVE_RECIPES.recipeBuilder("silicon_dioxide_to_quartzite_gem") .inputItems(dust, SiliconDioxide) .inputFluids(DistilledWater.getFluid(250)) - .chancedOutput(ChemicalHelper.get(gem, Quartzite), 4500, 0) + .chancedOutput(ChemicalHelper.get(gem, Quartzite), 4500) .duration(1200).EUt(24).save(provider); // todo find UU-Matter replacement // AUTOCLAVE_RECIPES.recipeBuilder() // .inputItems(dust, NetherStar) // .inputFluids(UUMatter.getFluid(576)) - // .chancedOutput(new ItemStack(Items.NETHER_STAR), 3333, 0) + // .chancedOutput(new ItemStack(Items.NETHER_STAR), 3333) // .duration(72000).EUt(VA[HV]).save(provider); MIXER_RECIPES.recipeBuilder("indium_concentrate") @@ -1083,26 +1083,26 @@ private static void registerAssemblerRecipes(RecipeOutput provider) { private static void registerBlastFurnaceRecipes(RecipeOutput provider) { BLAST_RECIPES.recipeBuilder("aluminium_from_ruby_dust").duration(400).EUt(100).inputItems(dust, Ruby) - .outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9", 0).blastFurnaceTemp(1200) + .outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9").blastFurnaceTemp(1200) .save(provider); BLAST_RECIPES.recipeBuilder("aluminium_from_ruby_gem").duration(320).EUt(100).inputItems(gem, Ruby) - .outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9", 0).blastFurnaceTemp(1200) + .outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9").blastFurnaceTemp(1200) .save(provider); BLAST_RECIPES.recipeBuilder("aluminium_from_green_sapphire_dust").duration(400).EUt(100) - .inputItems(dust, GreenSapphire).outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9", 0) + .inputItems(dust, GreenSapphire).outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9") .blastFurnaceTemp(1200).save(provider); BLAST_RECIPES.recipeBuilder("aluminium_from_green_sapphire_gem").duration(320).EUt(100) - .inputItems(gem, GreenSapphire).outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9", 0) + .inputItems(gem, GreenSapphire).outputItems(nugget, Aluminium, 3).chancedOutput(dust, Ash, "1/9") .blastFurnaceTemp(1200).save(provider); BLAST_RECIPES.recipeBuilder("aluminium_from_sapphire_dust").duration(400).EUt(100).inputItems(dust, Sapphire) .outputItems(nugget, Aluminium, 3).blastFurnaceTemp(1200).save(provider); BLAST_RECIPES.recipeBuilder("aluminium_from_sapphire_gem").duration(320).EUt(100).inputItems(gem, Sapphire) .outputItems(nugget, Aluminium, 3).blastFurnaceTemp(1200).save(provider); BLAST_RECIPES.recipeBuilder("steel_from_iron").duration(500).EUt(VA[MV]).inputItems(ingot, Iron) - .inputFluids(Oxygen.getFluid(200)).outputItems(ingot, Steel).chancedOutput(dust, Ash, "1/9", 0) + .inputFluids(Oxygen.getFluid(200)).outputItems(ingot, Steel).chancedOutput(dust, Ash, "1/9") .blastFurnaceTemp(1000).save(provider); BLAST_RECIPES.recipeBuilder("steel_from_wrought_iron").duration(300).EUt(VA[MV]).inputItems(ingot, WroughtIron) - .inputFluids(Oxygen.getFluid(200)).outputItems(ingot, Steel).chancedOutput(dust, Ash, "1/9", 0) + .inputFluids(Oxygen.getFluid(200)).outputItems(ingot, Steel).chancedOutput(dust, Ash, "1/9") .blastFurnaceTemp(1000).save(provider); BLAST_RECIPES.recipeBuilder("tempered_glass_blasting") @@ -1158,7 +1158,7 @@ private static void registerBlastFurnaceMetallurgyRecipes(RecipeOutput provider) .inputItems(dust, SiliconDioxide, 3) .inputItems(dust, Carbon, 2) .outputItems(ingotHot, Silicon) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonMonoxide.getFluid(2000)) .save(provider); } @@ -1170,7 +1170,7 @@ private static void createSulfurDioxideRecipe(RecipeOutput provider, Material in .inputItems(dust, inputMaterial) .inputFluids(Oxygen.getFluid(3000)) .outputItems(dust, outputMaterial) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(SulfurDioxide.getFluid(sulfurDioxideAmount)) .save(provider); } @@ -1244,14 +1244,14 @@ private static void registerRecyclingRecipes(RecipeOutput provider) { MACERATOR_RECIPES.recipeBuilder("macerate_end_stone") .inputItems(new ItemStack(Blocks.END_STONE)) .outputItems(dust, Endstone) - .chancedOutput(dust, Tungstate, 330, 0) + .chancedOutput(dust, Tungstate, 330) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_netherrack") .inputItems(new ItemStack(Blocks.NETHERRACK)) .outputItems(dust, Netherrack) - .chancedOutput(nugget, Gold, 750, 0) + .chancedOutput(nugget, Gold, 750) .duration(150).EUt(2) .save(provider); @@ -1266,7 +1266,7 @@ private static void registerRecyclingRecipes(RecipeOutput provider) { // MACERATOR_RECIPES.recipeBuilder() // .inputItems(stone, Soapstone) // .outputItems(dustImpure, Talc) - // .chancedOutput(dust, Chromite, "1/90", 0) + // .chancedOutput(dust, Chromite, "1/90") // .duration(150).EUt(2) // .save(provider); @@ -1274,63 +1274,63 @@ private static void registerRecyclingRecipes(RecipeOutput provider) { // MACERATOR_RECIPES.recipeBuilder() // .inputItems(stone, Redrock) // .outputItems(dust, Redrock) - // .chancedOutput(dust, Redrock, 1000, 0) + // .chancedOutput(dust, Redrock, 1000) // .duration(150).EUt(2) // .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_marble") .inputItems(rock, Marble) .outputItems(dust, Marble) - .chancedOutput(dust, Marble, 1500, 0) + .chancedOutput(dust, Marble, 1500) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_basalt") .inputItems(Blocks.BASALT.asItem()) .outputItems(dust, Basalt) - .chancedOutput(dust, Basalt, 1500, 0) + .chancedOutput(dust, Basalt, 1500) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_deepslate") .inputItems(Blocks.DEEPSLATE.asItem()) .outputItems(dust, Deepslate) - .chancedOutput(dust, Thorium, 150, 0) + .chancedOutput(dust, Thorium, 150) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_red_granite") .inputItems(rock, RedGranite) .outputItems(dust, RedGranite) - .chancedOutput(dust, Uranium238, 25, 0) + .chancedOutput(dust, Uranium238, 25) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_andesite") .inputItems(Blocks.ANDESITE.asItem()) .outputItems(dust, Andesite) - .chancedOutput(dust, Stone, 25, 0) + .chancedOutput(dust, Stone, 25) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_diorite") .inputItems(Blocks.DIORITE.asItem()) .outputItems(dust, Diorite) - .chancedOutput(dust, Stone, 25, 0) + .chancedOutput(dust, Stone, 25) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_granite") .inputItems(Blocks.GRANITE.asItem()) .outputItems(dust, Granite) - .chancedOutput(dust, Stone, 25, 0) + .chancedOutput(dust, Stone, 25) .duration(150).EUt(2) .save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_calcite") .inputItems(Blocks.CALCITE.asItem()) .outputItems(dust, Calcite) - .chancedOutput(dust, Stone, 25, 0) + .chancedOutput(dust, Stone, 25) .duration(150).EUt(2) .save(provider); @@ -1350,14 +1350,14 @@ private static void registerRecyclingRecipes(RecipeOutput provider) { MACERATOR_RECIPES.recipeBuilder("macerate_pork_chop") .inputItems(new ItemStack(Items.PORKCHOP)) .outputItems(dust, Meat) - .chancedOutput(dust, Meat, 6500, 0) + .chancedOutput(dust, Meat, 6500) .outputItems(dustTiny, Bone) .duration(102).EUt(2).save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_fish") .inputItems(ItemTags.FISHES) .outputItems(dust, Meat) - .chancedOutput(dust, Meat, 5000, 0) + .chancedOutput(dust, Meat, 5000) .outputItems(dustTiny, Bone) .duration(102).EUt(2).save(provider); @@ -1370,14 +1370,14 @@ private static void registerRecyclingRecipes(RecipeOutput provider) { MACERATOR_RECIPES.recipeBuilder("macerate_steak") .inputItems(new ItemStack(Items.BEEF)) .outputItems(dust, Meat) - .chancedOutput(dust, Meat, 5000, 0) + .chancedOutput(dust, Meat, 5000) .outputItems(dustTiny, Bone) .duration(102).EUt(2).save(provider); MACERATOR_RECIPES.recipeBuilder("macerate_rabbit") .inputItems(new ItemStack(Items.RABBIT)) .outputItems(dust, Meat) - .chancedOutput(dust, Meat, 5000, 0) + .chancedOutput(dust, Meat, 5000) .outputItems(dustTiny, Bone) .duration(102).EUt(2).save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java index b0e237fd745..05e22148899 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/MiscRecipeLoader.java @@ -69,11 +69,11 @@ public static void init(RecipeOutput provider) { SIFTER_RECIPES.recipeBuilder("gravel_sifting").duration(100).EUt(16) .inputItems(new ItemStack(Blocks.GRAVEL)) .outputItems(gem, Flint) - .chancedOutput(gem, Flint, 9000, 0) - .chancedOutput(gem, Flint, 8000, 0) - .chancedOutput(gem, Flint, 6000, 0) - .chancedOutput(gem, Flint, "1/3", 0) - .chancedOutput(gem, Flint, 2500, 0) + .chancedOutput(gem, Flint, 9000) + .chancedOutput(gem, Flint, 8000) + .chancedOutput(gem, Flint, 6000) + .chancedOutput(gem, Flint, "1/3") + .chancedOutput(gem, Flint, 2500) .save(provider); PACKER_RECIPES.recipeBuilder("matchbox") diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java index 5b6fad97f38..2936bf2287d 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/VanillaStandardRecipes.java @@ -279,7 +279,7 @@ private static void smashingRecipes(RecipeOutput provider) { MACERATOR_RECIPES.recipeBuilder("gravel_to_flint") .inputItems(new ItemStack(Blocks.GRAVEL, 1)) .outputItems(dust, Stone) - .chancedOutput(new ItemStack(Items.FLINT), 3300, 0) + .chancedOutput(new ItemStack(Items.FLINT), 3300) .duration(400).EUt(2) .save(provider); @@ -346,7 +346,7 @@ private static void smashingRecipes(RecipeOutput provider) { MACERATOR_RECIPES.recipeBuilder("macerate_melon_block") .inputItems(new ItemStack(Blocks.MELON)) .outputItems(new ItemStack(Items.MELON_SLICE, 8)) - .chancedOutput(new ItemStack(Items.MELON_SEEDS), 8500, 0) + .chancedOutput(new ItemStack(Items.MELON_SEEDS), 8500) .duration(400).EUt(2) .save(provider); @@ -365,9 +365,9 @@ private static void smashingRecipes(RecipeOutput provider) { MACERATOR_RECIPES.recipeBuilder("macerate_wool") .inputItems(ItemTags.WOOL) .outputItems(new ItemStack(Items.STRING)) - .chancedOutput(new ItemStack(Items.STRING), 9000, 0) - .chancedOutput(new ItemStack(Items.STRING), 5000, 0) - .chancedOutput(new ItemStack(Items.STRING), 2000, 0) + .chancedOutput(new ItemStack(Items.STRING), 9000) + .chancedOutput(new ItemStack(Items.STRING), 5000) + .chancedOutput(new ItemStack(Items.STRING), 2000) .duration(200).EUt(2) .save(provider); } @@ -379,7 +379,7 @@ private static void woodRecipes(RecipeOutput provider) { MACERATOR_RECIPES.recipeBuilder("macerate_logs") .inputItems(ItemTags.LOGS) .outputItems(dust, Wood, 6) - .chancedOutput(dust, Wood, 8500, 0) + .chancedOutput(dust, Wood, 8500) .duration(150).EUt(2) .save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java index a2cdcf7ff0b..d2b4425f278 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/misc/WoodMachineRecipes.java @@ -1231,21 +1231,21 @@ private static void registerPyrolyseOvenRecipes(RecipeOutput provider) { // COAL TAR ============================================ PYROLYSE_RECIPES.recipeBuilder("charcoal_to_coal_tar").circuitMeta(8) .inputItems(Items.CHARCOAL, 32) - .chancedOutput(dust, Ash, 5000, 0) + .chancedOutput(dust, Ash, 5000) .outputFluids(CoalTar.getFluid(1000)) .duration(640).EUt(64) .save(provider); PYROLYSE_RECIPES.recipeBuilder("coal_to_coal_tar").circuitMeta(8) .inputItems(Items.COAL, 12) - .chancedOutput(dust, DarkAsh, 5000, 0) + .chancedOutput(dust, DarkAsh, 5000) .outputFluids(CoalTar.getFluid(3000)) .duration(320).EUt(96) .save(provider); PYROLYSE_RECIPES.recipeBuilder("coke_to_coal_tar").circuitMeta(8) .inputItems(gem, Coke, 8) - .chancedOutput(dust, Ash, 7500, 0) + .chancedOutput(dust, Ash, 7500) .outputFluids(CoalTar.getFluid(4000)) .duration(320).EUt(96) .save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/DistillationRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/DistillationRecipes.java index eca73167826..b19908818a5 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/DistillationRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/DistillationRecipes.java @@ -31,7 +31,7 @@ public static void init(RecipeOutput provider) { DISTILLATION_RECIPES.recipeBuilder("distill_charcoal_byproducts") .inputFluids(CharcoalByproducts.getFluid(1000)) - .chancedOutput(dust, Charcoal, 2500, 0) + .chancedOutput(dust, Charcoal, 2500) .outputFluids(WoodTar.getFluid(250)) .outputFluids(WoodVinegar.getFluid(400)) .outputFluids(WoodGas.getFluid(250)) @@ -115,14 +115,14 @@ public static void init(RecipeOutput provider) { DISTILLATION_RECIPES.recipeBuilder("distill_biomass") .inputFluids(Biomass.getFluid(1000)) - .chancedOutput(dust, Wood, 5000, 0) + .chancedOutput(dust, Wood, 5000) .outputFluids(Ethanol.getFluid(600)) .outputFluids(Water.getFluid(300)) .duration(32).EUt(400).save(provider); DISTILLATION_RECIPES.recipeBuilder("distill_coal_gas") .inputFluids(CoalGas.getFluid(1000)) - .chancedOutput(dust, Coke, 2500, 0) + .chancedOutput(dust, Coke, 2500) .outputFluids(CoalTar.getFluid(200)) .outputFluids(Ammonia.getFluid(300)) .outputFluids(Ethylbenzene.getFluid(250)) @@ -132,7 +132,7 @@ public static void init(RecipeOutput provider) { DISTILLATION_RECIPES.recipeBuilder("distill_coal_tar") .inputFluids(CoalTar.getFluid(1000)) - .chancedOutput(dust, Coke, 2500, 0) + .chancedOutput(dust, Coke, 2500) .outputFluids(Naphthalene.getFluid(400)) .outputFluids(HydrogenSulfide.getFluid(300)) .outputFluids(Creosote.getFluid(200)) @@ -147,7 +147,7 @@ public static void init(RecipeOutput provider) { .outputFluids(CarbonDioxide.getFluid(2500)) .outputFluids(Helium.getFluid(1000)) .outputFluids(Argon.getFluid(500)) - .chancedOutput(dust, Ice, 9000, 0) + .chancedOutput(dust, Ice, 9000) .disableDistilleryRecipes(true) .duration(2000).EUt(VA[HV]).save(provider); @@ -159,7 +159,7 @@ public static void init(RecipeOutput provider) { .outputFluids(SulfurDioxide.getFluid(7500)) .outputFluids(Helium3.getFluid(2500)) .outputFluids(Neon.getFluid(500)) - .chancedOutput(dust, Ash, 2250, 0) + .chancedOutput(dust, Ash, 2250) .disableDistilleryRecipes(true) .duration(2000).EUt(VA[EV]).save(provider); @@ -172,7 +172,7 @@ public static void init(RecipeOutput provider) { .outputFluids(Krypton.getFluid(1000)) .outputFluids(Xenon.getFluid(1000)) .outputFluids(Radon.getFluid(1000)) - .chancedOutput(dust, EnderPearl, 1000, 0) + .chancedOutput(dust, EnderPearl, 1000) .disableDistilleryRecipes(true) .duration(2000).EUt(VA[IV]).save(provider); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GemSlurryRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GemSlurryRecipes.java index 24eb0d0484d..900357a0490 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GemSlurryRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GemSlurryRecipes.java @@ -29,9 +29,9 @@ public static void init(RecipeOutput provider) { .inputFluids(RubySlurry.getFluid(3000)) .outputItems(dust, Aluminium, 2) .outputItems(dust, Chromium) - .chancedOutput(dust, Titanium, 200, 0) - .chancedOutput(dust, Iron, 200, 0) - .chancedOutput(dust, Vanadium, 200, 0) + .chancedOutput(dust, Titanium, 200) + .chancedOutput(dust, Iron, 200) + .chancedOutput(dust, Vanadium, 200) .outputFluids(DilutedHydrochloricAcid.getFluid(2000)) .save(provider); @@ -51,9 +51,9 @@ public static void init(RecipeOutput provider) { CENTRIFUGE_RECIPES.recipeBuilder("sapphire_slurry_centrifuging").duration(320).EUt(VA[HV]) .inputFluids(SapphireSlurry.getFluid(3000)) .outputItems(dust, Aluminium, 2) - .chancedOutput(dust, Titanium, 200, 0) - .chancedOutput(dust, Iron, 200, 0) - .chancedOutput(dust, Vanadium, 200, 0) + .chancedOutput(dust, Titanium, 200) + .chancedOutput(dust, Iron, 200) + .chancedOutput(dust, Vanadium, 200) .outputFluids(DilutedHydrochloricAcid.getFluid(2000)) .save(provider); @@ -73,10 +73,10 @@ public static void init(RecipeOutput provider) { CENTRIFUGE_RECIPES.recipeBuilder("green_sapphire_slurry_centrifuging").duration(320).EUt(VA[HV]) .inputFluids(GreenSapphireSlurry.getFluid(3000)) .outputItems(dust, Aluminium, 2) - .chancedOutput(dust, Beryllium, 200, 0) - .chancedOutput(dust, Titanium, 200, 0) - .chancedOutput(dust, Iron, 200, 0) - .chancedOutput(dust, Vanadium, 200, 0) + .chancedOutput(dust, Beryllium, 200) + .chancedOutput(dust, Titanium, 200) + .chancedOutput(dust, Iron, 200) + .chancedOutput(dust, Vanadium, 200) .outputFluids(DilutedHydrochloricAcid.getFluid(2000)) .save(provider); } diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GrowthMediumRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GrowthMediumRecipes.java index 8a9e0cd82cf..e4a57af3a42 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GrowthMediumRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/GrowthMediumRecipes.java @@ -21,8 +21,8 @@ public static void init(RecipeOutput provider) { .inputItems(PLANT_BALL, 2) .outputItems(BIO_CHAFF) .outputItems(BIO_CHAFF) - .chancedOutput(BIO_CHAFF.asStack(), 5000, 0) - .chancedOutput(BIO_CHAFF.asStack(), 2500, 0) + .chancedOutput(BIO_CHAFF.asStack(), 5000) + .chancedOutput(BIO_CHAFF.asStack(), 2500) .save(provider); MACERATOR_RECIPES.recipeBuilder("dirt_from_bio_chaff").EUt(4).duration(300) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/NaquadahRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/NaquadahRecipes.java index 1d85e04a677..314cdf0e585 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/NaquadahRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/NaquadahRecipes.java @@ -88,7 +88,7 @@ public static void init(RecipeOutput provider) { DISTILLATION_RECIPES.recipeBuilder("enriched_naquadah_waste_separation").EUt(VA[HV]).duration(300) .inputFluids(EnrichedNaquadahWaste.getFluid(2000)) - .chancedOutput(dust, BariumSulfide, 5000, 0) + .chancedOutput(dust, BariumSulfide, 5000) .outputFluids(SulfuricAcid.getFluid(500)) .outputFluids(EnrichedNaquadahSolution.getFluid(250)) .outputFluids(NaquadriaSolution.getFluid(100)) @@ -125,7 +125,7 @@ public static void init(RecipeOutput provider) { DISTILLATION_RECIPES.recipeBuilder("naquadria_waste_separation").EUt(VA[HV]).duration(300) .inputFluids(NaquadriaWaste.getFluid(2000)) - .chancedOutput(dust, GalliumSulfide, 5000, 0) + .chancedOutput(dust, GalliumSulfide, 5000) .outputFluids(SulfuricAcid.getFluid(500)) .outputFluids(NaquadriaSolution.getFluid(250)) .outputFluids(EnrichedNaquadahSolution.getFluid(100)) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java index d8efe74f3ba..651e6121747 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/PetrochemRecipes.java @@ -122,7 +122,7 @@ private static void distillationRecipes(RecipeOutput provider) { DISTILLATION_RECIPES.recipeBuilder("distill_steam_cracked_ethane") .inputFluids(SteamCrackedEthane.getFluid(1000)) - .chancedOutput(dust, Carbon, 2500, 0) + .chancedOutput(dust, Carbon, 2500) .outputFluids(Ethylene.getFluid(250)) .outputFluids(Methane.getFluid(1250)) .duration(120).EUt(VA[MV]).save(provider); @@ -147,7 +147,7 @@ private static void distillationRecipes(RecipeOutput provider) { DISTILLATION_RECIPES.recipeBuilder("distill_steam_cracked_propene") .inputFluids(SteamCrackedPropene.getFluid(1000)) - .chancedOutput(dust, Carbon, 5000, 0) + .chancedOutput(dust, Carbon, 5000) .outputFluids(Ethylene.getFluid(1000)) .outputFluids(Methane.getFluid(500)) .duration(120).EUt(VA[MV]).save(provider); @@ -160,7 +160,7 @@ private static void distillationRecipes(RecipeOutput provider) { DISTILLATION_RECIPES.recipeBuilder("distill_steam_cracked_propane") .inputFluids(SteamCrackedPropane.getFluid(1000)) - .chancedOutput(dust, Carbon, 2500, 0) + .chancedOutput(dust, Carbon, 2500) .outputFluids(Ethylene.getFluid(750)) .outputFluids(Methane.getFluid(1250)) .duration(120).EUt(VA[MV]).save(provider); @@ -174,7 +174,7 @@ private static void distillationRecipes(RecipeOutput provider) { DISTILLATION_RECIPES.recipeBuilder("distill_steam_cracked_butane") .inputFluids(SteamCrackedButane.getFluid(1000)) - .chancedOutput(dust, Carbon, 2500, 0) + .chancedOutput(dust, Carbon, 2500) .outputFluids(Propane.getFluid(125)) .outputFluids(Ethane.getFluid(750)) .outputFluids(Ethylene.getFluid(750)) @@ -192,7 +192,7 @@ private static void distillationRecipes(RecipeOutput provider) { DISTILLATION_RECIPES.recipeBuilder("distill_steam_cracked_butene") .inputFluids(SteamCrackedButene.getFluid(1000)) - .chancedOutput(dust, Carbon, 2500, 0) + .chancedOutput(dust, Carbon, 2500) .outputFluids(Propene.getFluid(250)) .outputFluids(Ethylene.getFluid(1500)) .outputFluids(Methane.getFluid(250)) @@ -206,7 +206,7 @@ private static void distillationRecipes(RecipeOutput provider) { DISTILLATION_RECIPES.recipeBuilder("distill_steam_cracked_butadiene") .inputFluids(SteamCrackedButadiene.getFluid(1000)) - .chancedOutput(dust, Carbon, 5000, 0) + .chancedOutput(dust, Carbon, 5000) .outputFluids(Propene.getFluid(125)) .outputFluids(Ethylene.getFluid(250)) .outputFluids(Methane.getFluid(1125)) @@ -234,7 +234,7 @@ private static void distillationRecipes(RecipeOutput provider) { DISTILLATION_RECIPES.recipeBuilder("distill_lightly_steam_cracked_heavy_fuel") .inputFluids(LightlySteamCrackedHeavyFuel.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/9", 0) + .chancedOutput(dust, Carbon, "1/9") .outputFluids(LightFuel.getFluid(300)) .outputFluids(Naphtha.getFluid(50)) .outputFluids(Toluene.getFluid(25)) @@ -250,7 +250,7 @@ private static void distillationRecipes(RecipeOutput provider) { DISTILLATION_RECIPES.recipeBuilder("distill_severely_steam_cracked_heavy_fuel") .inputFluids(SeverelySteamCrackedHeavyFuel.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/3", 0) + .chancedOutput(dust, Carbon, "1/3") .outputFluids(LightFuel.getFluid(100)) .outputFluids(Naphtha.getFluid(125)) .outputFluids(Toluene.getFluid(80)) @@ -286,7 +286,7 @@ private static void distillationRecipes(RecipeOutput provider) { DISTILLATION_RECIPES.recipeBuilder("distill_lightly_steam_cracked_light_fuel") .inputFluids(LightlySteamCrackedLightFuel.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/9", 0) + .chancedOutput(dust, Carbon, "1/9") .outputFluids(HeavyFuel.getFluid(150)) .outputFluids(Naphtha.getFluid(400)) .outputFluids(Toluene.getFluid(40)) @@ -302,7 +302,7 @@ private static void distillationRecipes(RecipeOutput provider) { DISTILLATION_RECIPES.recipeBuilder("distill_severely_steam_cracked_light_fuel") .inputFluids(SeverelySteamCrackedLightFuel.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/3", 0) + .chancedOutput(dust, Carbon, "1/3") .outputFluids(HeavyFuel.getFluid(50)) .outputFluids(Naphtha.getFluid(100)) .outputFluids(Toluene.getFluid(30)) @@ -334,7 +334,7 @@ private static void distillationRecipes(RecipeOutput provider) { DISTILLATION_RECIPES.recipeBuilder("distill_lightly_steam_cracked_naphtha") .inputFluids(LightlySteamCrackedNaphtha.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/9", 0) + .chancedOutput(dust, Carbon, "1/9") .outputFluids(HeavyFuel.getFluid(75)) .outputFluids(LightFuel.getFluid(150)) .outputFluids(Toluene.getFluid(40)) @@ -350,7 +350,7 @@ private static void distillationRecipes(RecipeOutput provider) { DISTILLATION_RECIPES.recipeBuilder("distill_severely_steam_cracked_naphtha") .inputFluids(SeverelySteamCrackedNaphtha.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/3", 0) + .chancedOutput(dust, Carbon, "1/3") .outputFluids(HeavyFuel.getFluid(25)) .outputFluids(LightFuel.getFluid(50)) .outputFluids(Toluene.getFluid(20)) @@ -380,7 +380,7 @@ private static void distillationRecipes(RecipeOutput provider) { DISTILLATION_RECIPES.recipeBuilder("distill_lightly_steam_cracked_gas") .inputFluids(LightlySteamCrackedGas.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/9", 0) + .chancedOutput(dust, Carbon, "1/9") .outputFluids(Propene.getFluid(45)) .outputFluids(Ethane.getFluid(8)) .outputFluids(Ethylene.getFluid(85)) @@ -390,7 +390,7 @@ private static void distillationRecipes(RecipeOutput provider) { DISTILLATION_RECIPES.recipeBuilder("distill_severely_steam_cracked_gas") .inputFluids(SeverelySteamCrackedGas.getFluid(1000)) - .chancedOutput(dust, Carbon, "1/9", 0) + .chancedOutput(dust, Carbon, "1/9") .outputFluids(Propene.getFluid(8)) .outputFluids(Ethane.getFluid(45)) .outputFluids(Ethylene.getFluid(92)) diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ReactorRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ReactorRecipes.java index df32d38eb95..d8289d0264e 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ReactorRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/ReactorRecipes.java @@ -375,7 +375,7 @@ public static void init(RecipeOutput provider) { .circuitMeta(1) .inputItems(gem, Charcoal) .inputFluids(Oxygen.getFluid(1000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonMonoxide.getFluid(1000)) .duration(80).EUt(VA[ULV]).save(provider); @@ -383,7 +383,7 @@ public static void init(RecipeOutput provider) { .circuitMeta(1) .inputItems(gem, Coal) .inputFluids(Oxygen.getFluid(1000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonMonoxide.getFluid(1000)) .duration(80).EUt(VA[ULV]).save(provider); @@ -391,7 +391,7 @@ public static void init(RecipeOutput provider) { .circuitMeta(1) .inputItems(dust, Charcoal) .inputFluids(Oxygen.getFluid(1000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonMonoxide.getFluid(1000)) .duration(80).EUt(VA[ULV]).save(provider); @@ -400,7 +400,7 @@ public static void init(RecipeOutput provider) { .inputItems(dust, Coal) .circuitMeta(1) .inputFluids(Oxygen.getFluid(1000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonMonoxide.getFluid(1000)) .save(provider); @@ -445,7 +445,7 @@ public static void init(RecipeOutput provider) { .circuitMeta(2) .inputItems(gem, Charcoal) .inputFluids(Oxygen.getFluid(2000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonDioxide.getFluid(1000)) .duration(80).EUt(VA[ULV]).save(provider); @@ -453,7 +453,7 @@ public static void init(RecipeOutput provider) { .circuitMeta(2) .inputItems(gem, Coal) .inputFluids(Oxygen.getFluid(2000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonDioxide.getFluid(1000)) .duration(80).EUt(VA[ULV]).save(provider); @@ -461,7 +461,7 @@ public static void init(RecipeOutput provider) { .circuitMeta(2) .inputItems(dust, Charcoal) .inputFluids(Oxygen.getFluid(2000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonDioxide.getFluid(1000)) .duration(80).EUt(VA[ULV]).save(provider); @@ -469,7 +469,7 @@ public static void init(RecipeOutput provider) { .circuitMeta(2) .inputItems(dust, Coal) .inputFluids(Oxygen.getFluid(2000)) - .chancedOutput(dust, Ash, "1/9", 0) + .chancedOutput(dust, Ash, "1/9") .outputFluids(CarbonDioxide.getFluid(1000)) .duration(80).EUt(VA[ULV]).save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java index 6c0a3b15593..49c4684bc88 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/SeparationRecipes.java @@ -47,13 +47,13 @@ public static void init(RecipeOutput provider) { CENTRIFUGE_RECIPES.recipeBuilder("oilsands_ore_separation") .inputItems(ore, Oilsands) - .chancedOutput(new ItemStack(Blocks.SAND), 7500, 0) + .chancedOutput(new ItemStack(Blocks.SAND), 7500) .outputFluids(HeavyOil.getFluid(2000)) .duration(200).EUt(30).save(provider); CENTRIFUGE_RECIPES.recipeBuilder("oilsands_dust_separation") .inputItems(dust, Oilsands) - .chancedOutput(new ItemStack(Blocks.SAND), 7500, 0) + .chancedOutput(new ItemStack(Blocks.SAND), 7500) .outputFluids(HeavyOil.getFluid(2000)) .duration(200).EUt(30).save(provider); @@ -103,50 +103,50 @@ public static void init(RecipeOutput provider) { CENTRIFUGE_RECIPES.recipeBuilder("sticky_resin_separation").duration(400).EUt(5) .inputItems(STICKY_RESIN) .outputItems(dust, RawRubber, 3) - .chancedOutput(PLANT_BALL.asStack(), 1500, 0) + .chancedOutput(PLANT_BALL.asStack(), 1500) .outputFluids(Glue.getFluid(100)) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("rubber_log_separation").duration(200).EUt(5) .inputItems(GTBlocks.RUBBER_LOG.asStack()) - .chancedOutput(STICKY_RESIN.asStack(), 6400, 0) - .chancedOutput(PLANT_BALL.asStack(), 4000, 0) - .chancedOutput(dust, Carbon, 3000, 0) - .chancedOutput(dust, Wood, 3000, 0) + .chancedOutput(STICKY_RESIN.asStack(), 6400) + .chancedOutput(PLANT_BALL.asStack(), 4000) + .chancedOutput(dust, Carbon, 3000) + .chancedOutput(dust, Wood, 3000) .outputFluids(Methane.getFluid(60)) .save(provider); // TODO Other kinds of dirt? CENTRIFUGE_RECIPES.recipeBuilder("dirt_separation").duration(250).EUt(VA[LV]) .inputItems(Blocks.DIRT.asItem()) - .chancedOutput(PLANT_BALL.asStack(), 1400, 0) - .chancedOutput(new ItemStack(Blocks.SAND), 6000, 0) - .chancedOutput(dust, Clay, 550, 0) + .chancedOutput(PLANT_BALL.asStack(), 1400) + .chancedOutput(new ItemStack(Blocks.SAND), 6000) + .chancedOutput(dust, Clay, 550) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("grass_block_separation").duration(250).EUt(VA[LV]) .inputItems(Blocks.GRASS_BLOCK.asItem()) - .chancedOutput(PLANT_BALL.asStack(), 3500, 0) - .chancedOutput(new ItemStack(Blocks.SAND), 5500, 0) - .chancedOutput(dust, Clay, 550, 0) + .chancedOutput(PLANT_BALL.asStack(), 3500) + .chancedOutput(new ItemStack(Blocks.SAND), 5500) + .chancedOutput(dust, Clay, 550) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("mycelium_separation").duration(650).EUt(VA[LV]) .inputItems(new ItemStack(Blocks.MYCELIUM)) - .chancedOutput(new ItemStack(Blocks.RED_MUSHROOM), 2800, 0) - .chancedOutput(new ItemStack(Blocks.BROWN_MUSHROOM), 2800, 0) - .chancedOutput(new ItemStack(Blocks.SAND), 6200, 0) - .chancedOutput(dust, Clay, 550, 0) + .chancedOutput(new ItemStack(Blocks.RED_MUSHROOM), 2800) + .chancedOutput(new ItemStack(Blocks.BROWN_MUSHROOM), 2800) + .chancedOutput(new ItemStack(Blocks.SAND), 6200) + .chancedOutput(dust, Clay, 550) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("ash_separation").duration(240).EUt(VA[LV]) .inputItems(dust, Ash) - .chancedOutput(dust, Quicklime, 4950, 0) - .chancedOutput(dust, Potash, 1600, 0) - .chancedOutput(dust, Magnesia, 1500, 0) - .chancedOutput(dust, PhosphorusPentoxide, 60, 0) - .chancedOutput(dust, SodaAsh, 600, 0) - .chancedOutput(dust, Hematite, 275, 0) + .chancedOutput(dust, Quicklime, 4950) + .chancedOutput(dust, Potash, 1600) + .chancedOutput(dust, Magnesia, 1500) + .chancedOutput(dust, PhosphorusPentoxide, 60) + .chancedOutput(dust, SodaAsh, 600) + .chancedOutput(dust, Hematite, 275) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("dark_ash_separation").duration(250).EUt(6) @@ -168,65 +168,65 @@ public static void init(RecipeOutput provider) { CENTRIFUGE_RECIPES.recipeBuilder("uranium_238_separation").duration(800).EUt(320) .inputItems(dust, Uranium238) - .chancedOutput(dustTiny, Plutonium239, 280, 0) - .chancedOutput(dustTiny, Uranium235, 2300, 0) + .chancedOutput(dustTiny, Plutonium239, 280) + .chancedOutput(dustTiny, Uranium235, 2300) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("plutonium_239_separation").duration(1600).EUt(320) .inputItems(dust, Plutonium239) - .chancedOutput(dustTiny, Uranium238, 3400, 0) - .chancedOutput(dust, Plutonium241, 2500, 0) + .chancedOutput(dustTiny, Uranium238, 3400) + .chancedOutput(dust, Plutonium241, 2500) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("endstone_separation").duration(320).EUt(20) .inputItems(dust, Endstone) - .chancedOutput(new ItemStack(Blocks.SAND), 9000, 0) - .chancedOutput(dust, Tungstate, 445, 0) - .chancedOutput(dust, Platinum, 80, 0) + .chancedOutput(new ItemStack(Blocks.SAND), 9000) + .chancedOutput(dust, Tungstate, 445) + .chancedOutput(dust, Platinum, 80) .outputFluids(Helium.getFluid(120)) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("netherrack_separation").duration(160).EUt(20) .inputItems(dust, Netherrack) - .chancedOutput(dust, Redstone, 700, 0) - .chancedOutput(dust, Gold, 75, 0) - .chancedOutput(dust, Sulfur, 2500, 0) - .chancedOutput(dust, Coal, 700, 0) + .chancedOutput(dust, Redstone, 700) + .chancedOutput(dust, Gold, 75) + .chancedOutput(dust, Sulfur, 2500) + .chancedOutput(dust, Coal, 700) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("soul_sand_separation").duration(200).EUt(80) .inputItems(Blocks.SOUL_SAND.asItem()) - .chancedOutput(new ItemStack(Blocks.SAND), 9250, 0) - .chancedOutput(dust, Saltpeter, 2250, 0) - .chancedOutput(dust, Coal, 225, 0) + .chancedOutput(new ItemStack(Blocks.SAND), 9250) + .chancedOutput(dust, Saltpeter, 2250) + .chancedOutput(dust, Coal, 225) .outputFluids(Oil.getFluid(80)) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("lava_separation").duration(80).EUt(80) .inputFluids(Lava.getFluid(100)) - .chancedOutput(dust, SiliconDioxide, 1250, 0) - .chancedOutput(dust, Magnesia, 250, 0) - .chancedOutput(dust, Quicklime, 250, 0) - .chancedOutput(nugget, Gold, 250, 0) - .chancedOutput(dust, Sapphire, 315, 0) - .chancedOutput(dust, Tantalite, 125, 0) + .chancedOutput(dust, SiliconDioxide, 1250) + .chancedOutput(dust, Magnesia, 250) + .chancedOutput(dust, Quicklime, 250) + .chancedOutput(nugget, Gold, 250) + .chancedOutput(dust, Sapphire, 315) + .chancedOutput(dust, Tantalite, 125) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("rare_earth_separation").duration(64).EUt(20) .inputItems(dust, RareEarth) - .chancedOutput(dustSmall, Cadmium, 3500, 0) - .chancedOutput(dustSmall, Neodymium, 4500, 0) - .chancedOutput(dustSmall, Samarium, 3500, 0) - .chancedOutput(dustSmall, Cerium, 5500, 0) - .chancedOutput(dustSmall, Yttrium, 3500, 0) - .chancedOutput(dustSmall, Lanthanum, 2500, 0) + .chancedOutput(dustSmall, Cadmium, 3500) + .chancedOutput(dustSmall, Neodymium, 4500) + .chancedOutput(dustSmall, Samarium, 3500) + .chancedOutput(dustSmall, Cerium, 5500) + .chancedOutput(dustSmall, Yttrium, 3500) + .chancedOutput(dustSmall, Lanthanum, 2500) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("red_sand_separation").duration(50).EUt(VA[LV]) .inputItems(Blocks.RED_SAND.asItem()) - .chancedOutput(dust, Iron, 5000, 0) - .chancedOutput(dust, Diamond, 35, 0) - .chancedOutput(new ItemStack(Blocks.SAND), 8500, 0) + .chancedOutput(dust, Iron, 5000) + .chancedOutput(dust, Diamond, 35) + .chancedOutput(new ItemStack(Blocks.SAND), 8500) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("hydrogen_separation").duration(160).EUt(20) @@ -265,28 +265,28 @@ public static void init(RecipeOutput provider) { // Stone Dust CENTRIFUGE_RECIPES.recipeBuilder("stone_dust_separation").duration(480).EUt(VA[MV]) .inputItems(dust, Stone) - .chancedOutput(dust, Quartzite, 2500, 0) - .chancedOutput(dust, PotassiumFeldspar, 2500, 0) - .chancedOutput(dust, Marble, "2/9", 0) - .chancedOutput(dust, Biotite, "1/9", 0) - .chancedOutput(dust, MetalMixture, 925, 0) - .chancedOutput(dust, Sodalite, 650, 0) + .chancedOutput(dust, Quartzite, 2500) + .chancedOutput(dust, PotassiumFeldspar, 2500) + .chancedOutput(dust, Marble, "2/9") + .chancedOutput(dust, Biotite, "1/9") + .chancedOutput(dust, MetalMixture, 925) + .chancedOutput(dust, Sodalite, 650) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("metal_mixture_separation").duration(1000).EUt(900) .inputItems(dust, MetalMixture) - .chancedOutput(dust, Hematite, 2500, 0) - .chancedOutput(dust, Bauxite, 2500, 0) - .chancedOutput(dust, Pyrolusite, "2/9", 0) - .chancedOutput(dust, Barite, "1/9", 0) - .chancedOutput(dust, Chromite, 855, 0) - .chancedOutput(dust, Ilmenite, 575, 0) + .chancedOutput(dust, Hematite, 2500) + .chancedOutput(dust, Bauxite, 2500) + .chancedOutput(dust, Pyrolusite, "2/9") + .chancedOutput(dust, Barite, "1/9") + .chancedOutput(dust, Chromite, 855) + .chancedOutput(dust, Ilmenite, 575) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("quartz_sand_separation").duration(60).EUt(VA[LV]) .inputItems(dust, QuartzSand, 2) .outputItems(dust, Quartzite) - .chancedOutput(dust, CertusQuartz, 2500, 0) + .chancedOutput(dust, CertusQuartz, 2500) .save(provider); CENTRIFUGE_RECIPES.recipeBuilder("red_alloy_separation").duration(900).EUt(VA[LV]) @@ -337,7 +337,7 @@ public static void init(RecipeOutput provider) { .inputItems(dust, Sphalerite, 2) .outputItems(dust, Zinc) .outputItems(dust, Sulfur) - .chancedOutput(dust, Gallium, 750, 0) + .chancedOutput(dust, Gallium, 750) .duration(200).EUt(VA[LV]).save(provider); ELECTROLYZER_RECIPES.recipeBuilder("water_electrolysis") @@ -542,7 +542,7 @@ public static void init(RecipeOutput provider) { EXTRACTOR_RECIPES.recipeBuilder("wood_dust_extraction").duration(16).EUt(4) .inputItems(dust, Wood) - .chancedOutput(PLANT_BALL.asStack(), 225, 0) + .chancedOutput(PLANT_BALL.asStack(), 225) .outputFluids(Creosote.getFluid(5)) .save(provider); diff --git a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/TitaniumRecipes.java b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/TitaniumRecipes.java index 8b99b4ef5d9..1bbb8b62c7c 100644 --- a/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/TitaniumRecipes.java +++ b/src/main/java/com/gregtechceu/gtceu/data/recipe/serialized/chemistry/TitaniumRecipes.java @@ -137,8 +137,8 @@ private static void bauxiteProcess(RecipeOutput provider) { ELECTROMAGNETIC_SEPARATOR_RECIPES.recipeBuilder("bauxite_slag_separation") .inputItems(dust, BauxiteSlag) .outputItems(dust, Salt) - .chancedOutput(dust, Neodymium, 2000, 0) - .chancedOutput(dust, Chromium, 1000, 0) + .chancedOutput(dust, Neodymium, 2000) + .chancedOutput(dust, Chromium, 1000) .duration(50).EUt(VA[MV]).save(provider); // Bauxite Sludge -> Calcite (looped) + Decalcified Bauxite Sludge @@ -153,11 +153,11 @@ private static void bauxiteProcess(RecipeOutput provider) { CENTRIFUGE_RECIPES.recipeBuilder("bauxite_sludge_centrifuge") .inputFluids(DecalcifiedBauxiteSludge.getFluid(250)) .outputItems(dust, Rutile, 2) - .chancedOutput(dust, Gallium, 5000, 0) - .chancedOutput(dust, Gallium, 3000, 0) - .chancedOutput(dust, Gallium, 1000, 0) - .chancedOutput(dust, SiliconDioxide, 9000, 0) - .chancedOutput(dust, Iron, 8000, 0) + .chancedOutput(dust, Gallium, 5000) + .chancedOutput(dust, Gallium, 3000) + .chancedOutput(dust, Gallium, 1000) + .chancedOutput(dust, SiliconDioxide, 9000) + .chancedOutput(dust, Iron, 8000) .outputFluids(Water.getFluid(250)) .duration(100).EUt(VA[MV]).save(provider); } @@ -166,9 +166,9 @@ private static void ilmeniteProcess(RecipeOutput provider) { // Byproduct separation for Ilmenite ELECTROMAGNETIC_SEPARATOR_RECIPES.recipeBuilder("ilmenite_separation") .inputItems(dust, IlmeniteSlag) - .chancedOutput(dust, Iron, 8000, 0) - .chancedOutput(dust, Tantalum, 2000, 0) - .chancedOutput(dust, Niobium, 500, 0) + .chancedOutput(dust, Iron, 8000) + .chancedOutput(dust, Tantalum, 200) + .chancedOutput(dust, Niobium, 50) .duration(50).EUt(VA[MV]).save(provider); } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java index 61ebeebf696..0b1fb653d3d 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/ae2/machine/MEOutputHatchPartMachine.java @@ -5,6 +5,7 @@ import com.gregtechceu.gtceu.api.machine.MetaMachine; import com.gregtechceu.gtceu.api.machine.trait.NotifiableFluidTank; import com.gregtechceu.gtceu.api.recipe.GTRecipe; +import com.gregtechceu.gtceu.api.recipe.ingredient.IntProviderFluidIngredient; import com.gregtechceu.gtceu.api.sync_system.annotations.SaveField; import com.gregtechceu.gtceu.api.transfer.fluid.CustomFluidTank; import com.gregtechceu.gtceu.integration.ae2.gui.AEKeyStorageSyncHandler; @@ -193,7 +194,16 @@ public List handleRecipeInner(IO io, GTRecipe recipe, List continue; } - var fluids = ingredient.getFluids(); + FluidStack[] fluids; + if (ingredient.ingredient() instanceof IntProviderFluidIngredient provider) { + if (simulate) { + fluids = new FluidStack[] { provider.getMaxSizeStack() }; + } else { + fluids = provider.getStacks(); + } + } else { + fluids = ingredient.getFluids(); + } if (fluids.length == 0 || fluids[0].isEmpty()) { it.remove(); continue; diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/ParallelProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/ParallelProvider.java index 63ecc9a3358..2fac0cb9e37 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/ParallelProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/ParallelProvider.java @@ -31,10 +31,10 @@ protected CompoundTag write(MetaMachine machine) { } else if (machine instanceof MultiblockControllerMachine controller) { if (controller instanceof IRecipeLogicMachine rlm && rlm.getRecipeLogic().isActive() && - rlm.getRecipeLogic().getLastRecipe() != null) { - compoundTag.putInt("parallel", rlm.getRecipeLogic().getLastRecipe().parallels); - compoundTag.putInt("batch", rlm.getRecipeLogic().getLastRecipe().batchParallels); - compoundTag.putInt("subtickParallel", rlm.getRecipeLogic().getLastRecipe().subtickParallels); + rlm.getRecipeLogic().getLastDisplayedRecipe() != null) { + compoundTag.putInt("parallel", rlm.getRecipeLogic().getLastDisplayedRecipe().parallels); + compoundTag.putInt("batch", rlm.getRecipeLogic().getLastDisplayedRecipe().batchParallels); + compoundTag.putInt("subtickParallel", rlm.getRecipeLogic().getLastDisplayedRecipe().subtickParallels); compoundTag.putBoolean("exact", true); } else { controller.getParallelHatch() diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeLogicProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeLogicProvider.java index 0868ace35ac..2ba708b77ba 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeLogicProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeLogicProvider.java @@ -37,7 +37,7 @@ protected CompoundTag write(RecipeLogic capability) { var data = new CompoundTag(); data.putBoolean("Working", capability.isWorking()); var recipeInfo = new CompoundTag(); - var recipe = capability.getLastRecipe(); + var recipe = capability.getLastDisplayedRecipe(); if (recipe != null) { var EUt = RecipeHelper.getRealEUtWithIO(recipe); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java index d72525c425e..93acedd93c0 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/jade/provider/RecipeOutputProvider.java @@ -57,13 +57,10 @@ protected CompoundTag write(RecipeLogic recipeLogic) { return data; } data.putBoolean("Working", recipeLogic.isWorking()); - GTRecipe recipe = recipeLogic.getLastRecipe(); + GTRecipe recipe = recipeLogic.getLastDisplayedRecipe(); if (recipe == null) { return data; } - int recipeTier = RecipeHelper.getPreOCRecipeEuTier(recipe); - int chanceTier = recipeTier + recipe.ocLevel; - var function = recipe.getType().getChanceFunction(); var itemContents = recipe.getOutputContents(ItemRecipeCapability.CAP); var fluidContents = recipe.getOutputContents(FluidRecipeCapability.CAP); int runs = recipe.getTotalRuns(); @@ -76,12 +73,10 @@ protected CompoundTag write(RecipeLogic recipeLogic) { CompoundTag itemTag; SizedIngredient content = ItemRecipeCapability.CAP.of(item.content()); if (content.ingredient().getCustomIngredient() instanceof IntProviderIngredient provider) { - // don't roll for output but do copy for chance and batch IntProviderIngredient chanced = provider; if (item.chance() < item.maxChance()) { - double countD = (double) runs * - function.getBoostedChance(item, recipeTier, chanceTier) / item.maxChance(); + double countD = ((double) runs * item.chance()) / item.maxChance(); chanced = ItemRecipeCapability.CAP.copyWithModifier(provider, ContentModifier.multiplier(countD)); } @@ -96,8 +91,7 @@ protected CompoundTag write(RecipeLogic recipeLogic) { .getOrThrow(); if (item.chance() < item.maxChance()) { int count = stack.getCount(); - double countD = (double) count * runs * - function.getBoostedChance(item, recipeTier, chanceTier) / item.maxChance(); + double countD = ((double) runs * item.chance()) / item.maxChance(); count = Math.max(1, (int) Math.round(countD)); itemTag.putInt("Count", count); } @@ -119,8 +113,7 @@ protected CompoundTag write(RecipeLogic recipeLogic) { .map(tag -> (CompoundTag) tag) .getOrThrow(); if (fluid.chance() < fluid.maxChance()) { - double countD = (double) runs * - function.getBoostedChance(fluid, recipeTier, chanceTier) / fluid.maxChance(); + double countD = ((double) runs * fluid.chance()) / fluid.maxChance(); provider = FluidRecipeCapability.CAP.copyWithModifier(provider, ContentModifier.multiplier(countD)); } @@ -134,14 +127,8 @@ protected CompoundTag write(RecipeLogic recipeLogic) { .map(tag -> (CompoundTag) tag) .getOrThrow(); if (fluid.chance() < fluid.maxChance()) { - // <<<<<<< HEAD int amount = stack.getAmount(); - double amountD = (double) amount * runs * - // ======= - // int amount = stacks[0].getAmount(); - // double amountD = (double) amount * runs * - // >>>>>>> v.7.2.0-1.20.1 - function.getBoostedChance(fluid, recipeTier, chanceTier) / fluid.maxChance(); + double amountD = ((double) runs * fluid.chance()) / fluid.maxChance(); amount = Math.max(1, (int) Math.round(amountD)); fluidTag.putInt("Amount", amount); } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java index 249cb2a047b..921e58571b9 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/GTRecipeSchema.java @@ -93,8 +93,6 @@ class GTKubeRecipe extends KubeRecipe { public int chance = ChanceLogic.getMaxChancedValue(); @Setter public int maxChance = ChanceLogic.getMaxChancedValue(); - @Setter - public int tierChanceBoost = 0; @Getter private ResourceLocation idWithoutType; @Setter @@ -131,7 +129,7 @@ public GTKubeRecipe input(RecipeCapability capability, Object... obj) { if (getValue(key) == null) setValue(key, new CapabilityMap()); CapabilityMap map = getValue(key); for (Object object : obj) { - map.add(capability, new Content(object, chance, maxChance, tierChanceBoost)); + map.add(capability, new Content(object, chance, maxChance)); } save(); return this; @@ -142,7 +140,7 @@ public GTKubeRecipe output(RecipeCapability capability, Object... obj) { if (getValue(key) == null) setValue(key, new CapabilityMap()); CapabilityMap map = getValue(key); for (Object object : obj) { - map.add(capability, new Content(object, chance, maxChance, tierChanceBoost)); + map.add(capability, new Content(object, chance, maxChance)); } save(); return this; @@ -435,7 +433,7 @@ public GTKubeRecipe circuit(int configuration) { return notConsumableItem(new SizedIngredient(IntCircuitIngredient.circuit(configuration), 1)); } - public GTKubeRecipe chancedInput(SizedIngredient stack, int chance, int tierChanceBoost) { + public GTKubeRecipe chancedInput(SizedIngredient stack, int chance) { validateItems("chanced input", stack); if (0 >= chance || chance > ChanceLogic.getMaxChancedValue()) { @@ -444,33 +442,26 @@ public GTKubeRecipe chancedInput(SizedIngredient stack, int chance, int tierChan ChanceLogic.getMaxChancedValue(), chance, id)); } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; inputItems(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTKubeRecipe chancedFluidInput(SizedFluidIngredient stack, int chance, - int tierChanceBoost) { + public GTKubeRecipe chancedFluidInput(SizedFluidIngredient stack, int chance) { if (0 >= chance || chance > ChanceLogic.getMaxChancedValue()) { throw new KubeRuntimeException( String.format("Chance cannot be less or equal to 0 or more than %s, Actual: %s, id: %s", ChanceLogic.getMaxChancedValue(), chance, id)); } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; inputFluids(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTKubeRecipe chancedOutput(SizedIngredient stack, int chance, int tierChanceBoost) { + public GTKubeRecipe chancedOutput(SizedIngredient stack, int chance) { validateItems("chanced output", stack); if (0 >= chance || chance > ChanceLogic.getMaxChancedValue()) { @@ -479,25 +470,22 @@ public GTKubeRecipe chancedOutput(SizedIngredient stack, int chance, int tierCha ChanceLogic.getMaxChancedValue(), chance, id)); } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; outputItems(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTKubeRecipe chancedOutput(TagPrefix tag, Material mat, int chance, int tierChanceBoost) { - return chancedOutput(tag, mat, 1, chance, tierChanceBoost); + public GTKubeRecipe chancedOutput(TagPrefix tag, Material mat, int chance) { + return chancedOutput(tag, mat, 1, chance); } - public GTKubeRecipe chancedOutput(TagPrefix tag, Material mat, int count, int chance, int tierChanceBoost) { + public GTKubeRecipe chancedOutput(TagPrefix tag, Material mat, int count, int chance) { return chancedOutput(SizedIngredient.of(ChemicalHelper.get(tag, mat).getItem(), count), - chance, tierChanceBoost); + chance); } - public GTKubeRecipe chancedOutput(SizedIngredient stack, String fraction, int tierChanceBoost) { + public GTKubeRecipe chancedOutput(SizedIngredient stack, String fraction) { validateItems("chanced output", stack); String[] split = fraction.split("/"); @@ -518,7 +506,7 @@ public GTKubeRecipe chancedOutput(SizedIngredient stack, String fraction, int ti "Fraction or number was not parsed correctly! Expected format is \"1/3\" or \"1000\". Actual: \"%s\".", fraction)); } - return chancedOutput(stack, chance, tierChanceBoost); + return chancedOutput(stack, chance); } try { chance = Integer.parseInt(split[0]); @@ -546,29 +534,24 @@ public GTKubeRecipe chancedOutput(SizedIngredient stack, String fraction, int ti int lastChance = this.chance; int lastMaxChance = this.maxChance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; this.maxChance = maxChance; - this.tierChanceBoost = tierChanceBoost; outputItems(stack); this.chance = lastChance; this.maxChance = lastMaxChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTKubeRecipe chancedOutput(TagPrefix prefix, Material material, int count, String fraction, - int tierChanceBoost) { - return chancedOutput(SizedIngredient.of(ChemicalHelper.get(prefix, material).getItem(), count), fraction, - tierChanceBoost); + public GTKubeRecipe chancedOutput(TagPrefix prefix, Material material, int count, String fraction) { + return chancedOutput(SizedIngredient.of(ChemicalHelper.get(prefix, material).getItem(), count), fraction); } - public GTKubeRecipe chancedOutput(TagPrefix prefix, Material material, String fraction, int tierChanceBoost) { - return chancedOutput(prefix, material, 1, fraction, tierChanceBoost); + public GTKubeRecipe chancedOutput(TagPrefix prefix, Material material, String fraction) { + return chancedOutput(prefix, material, 1, fraction); } - public GTKubeRecipe chancedFluidOutput(SizedFluidIngredient stack, int chance, int tierChanceBoost) { + public GTKubeRecipe chancedFluidOutput(SizedFluidIngredient stack, int chance) { validateFluids("chanced output", stack); if (0 >= chance || chance > ChanceLogic.getMaxChancedValue()) { @@ -577,16 +560,13 @@ public GTKubeRecipe chancedFluidOutput(SizedFluidIngredient stack, int chance, i ChanceLogic.getMaxChancedValue(), chance, id)); } int lastChance = this.chance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; - this.tierChanceBoost = tierChanceBoost; outputFluids(stack); this.chance = lastChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } - public GTKubeRecipe chancedFluidOutput(SizedFluidIngredient stack, String fraction, int tierChanceBoost) { + public GTKubeRecipe chancedFluidOutput(SizedFluidIngredient stack, String fraction) { validateFluids("chanced output", stack); if (stack.amount() == 0) { return this; @@ -610,7 +590,7 @@ public GTKubeRecipe chancedFluidOutput(SizedFluidIngredient stack, String fracti "Fraction or number was not parsed correctly! Expected format is \"1/3\" or \"1000\". Actual: \"%s\".", fraction)); } - return chancedFluidOutput(stack, chance, tierChanceBoost); + return chancedFluidOutput(stack, chance); } try { @@ -639,14 +619,11 @@ public GTKubeRecipe chancedFluidOutput(SizedFluidIngredient stack, String fracti int lastChance = this.chance; int lastMaxChance = this.maxChance; - int lastTierChanceBoost = this.tierChanceBoost; this.chance = chance; this.maxChance = maxChance; - this.tierChanceBoost = tierChanceBoost; outputFluids(stack); this.chance = lastChance; this.maxChance = lastMaxChance; - this.tierChanceBoost = lastTierChanceBoost; return this; } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/ContentJS.java b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/ContentJS.java index 957bbe5d164..6794360cea2 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/ContentJS.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/kjs/recipe/components/ContentJS.java @@ -39,7 +39,7 @@ public Content replace(RecipeScriptContext cx, Content original, ReplacementMatc return new Content( baseComponent.instance().replace(cx, baseComponent.instance().wrap(cx, original.chance()), match, with), - original.chance(), original.maxChance(), original.tierChanceBoost()); + original.chance(), original.maxChance()); } @Override diff --git a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/emi/recipe/GTEmiRecipe.java b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/emi/recipe/GTEmiRecipe.java index d1c62354fec..0d29194f93d 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/emi/recipe/GTEmiRecipe.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/emi/recipe/GTEmiRecipe.java @@ -3,7 +3,6 @@ import com.gregtechceu.gtceu.api.capability.recipe.FluidRecipeCapability; import com.gregtechceu.gtceu.api.capability.recipe.ItemRecipeCapability; import com.gregtechceu.gtceu.api.recipe.GTRecipe; -import com.gregtechceu.gtceu.api.recipe.RecipeHelper; import com.gregtechceu.gtceu.api.recipe.gui.GTRecipeViewerWidget; import brachy.modularui.integration.emi.EmiStackConverter; @@ -39,10 +38,7 @@ public List getInputs() { var fluids = recipe.getInputContents(FluidRecipeCapability.CAP); for (var itemContent : items) { - float chance = (float) recipe.recipeType.getChanceFunction() - .getBoostedChance(itemContent, RecipeHelper.getRecipeEUtTier(recipe), - RecipeHelper.getRecipeEUtTier(recipe)) / - itemContent.maxChance(); + float chance = (float) itemContent.chance() / itemContent.maxChance(); var mapped = ItemRecipeCapability .mapIngredientToEntryList(ItemRecipeCapability.CAP.of(itemContent.content())); @@ -51,10 +47,7 @@ public List getInputs() { } for (var fluidContent : fluids) { - float chance = (float) recipe.recipeType.getChanceFunction() - .getBoostedChance(fluidContent, RecipeHelper.getRecipeEUtTier(recipe), - RecipeHelper.getRecipeEUtTier(recipe)) / - fluidContent.maxChance(); + float chance = (float) fluidContent.chance() / fluidContent.maxChance(); var mapped = FluidRecipeCapability .mapIngredientToEntryList(FluidRecipeCapability.CAP.of(fluidContent.content())); @@ -73,10 +66,7 @@ public List getOutputs() { var fluids = recipe.getOutputContents(FluidRecipeCapability.CAP); for (var itemContent : items) { - float chance = (float) recipe.recipeType.getChanceFunction() - .getBoostedChance(itemContent, RecipeHelper.getRecipeEUtTier(recipe), - RecipeHelper.getRecipeEUtTier(recipe)) / - itemContent.maxChance(); + float chance = (float) itemContent.chance() / itemContent.maxChance(); var mapped = ItemRecipeCapability .mapIngredientToEntryList(ItemRecipeCapability.CAP.of(itemContent.content())); @@ -85,10 +75,7 @@ public List getOutputs() { } for (var fluidContent : fluids) { - float chance = (float) recipe.recipeType.getChanceFunction() - .getBoostedChance(fluidContent, RecipeHelper.getRecipeEUtTier(recipe), - RecipeHelper.getRecipeEUtTier(recipe)) / - fluidContent.maxChance(); + float chance = (float) fluidContent.chance() / fluidContent.maxChance(); var mapped = FluidRecipeCapability .mapIngredientToEntryList(FluidRecipeCapability.CAP.of(fluidContent.content())); diff --git a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/GTOreByProduct.java b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/GTOreByProduct.java index ee1d45259ec..a6ad2e50b96 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/GTOreByProduct.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/GTOreByProduct.java @@ -185,22 +185,22 @@ public GTOreByProduct(Material material) { } else { addToOutputs(byproducts[0], TagPrefix.dust, 1); } - addChance(1400, 0); + addChance(1400); // macerate crushed -> impure addToOutputs(material, TagPrefix.dustImpure, 1); addToOutputs(byproducts[0], TagPrefix.dust, byproductMultiplier); - addChance(1400, 0); + addChance(1400); // centrifuge impure -> dust addToOutputs(material, TagPrefix.dust, 1); addToOutputs(byproducts[0], TagPrefix.dust, 1); - addChance(1111, 0); + addChance(1111); // ore wash crushed -> crushed purified addToOutputs(material, TagPrefix.crushedPurified, 1); addToOutputs(byproducts[0], TagPrefix.dust, 1); - addChance(3333, 0); + addChance(3333); FluidTagList tagList = new FluidTagList(); tagList.add(GTMaterials.Water.getFluidTag(), 1000, DataComponentPatch.EMPTY); tagList.add(GTMaterials.DistilledWater.getFluidTag(), 100, DataComponentPatch.EMPTY); @@ -209,22 +209,22 @@ public GTOreByProduct(Material material) { // TC crushed/crushed purified -> centrifuged addToOutputs(material, TagPrefix.crushedRefined, 1); addToOutputs(byproducts[1], TagPrefix.dust, byproductMultiplier); - addChance(3333, 0); + addChance(3333); // macerate centrifuged -> dust addToOutputs(material, TagPrefix.dust, 1); addToOutputs(byproducts[2], TagPrefix.dust, 1); - addChance(1400, 0); + addChance(1400); // macerate crushed purified -> purified addToOutputs(material, TagPrefix.dustPure, 1); addToOutputs(byproducts[1], TagPrefix.dust, 1); - addChance(1400, 0); + addChance(1400); // centrifuge purified -> dust addToOutputs(material, TagPrefix.dust, 1); addToOutputs(byproducts[1], TagPrefix.dust, 1); - addChance(1111, 0); + addChance(1111); // cauldron/simple washer addToOutputs(material, TagPrefix.crushed, 1); @@ -240,7 +240,7 @@ public GTOreByProduct(Material material) { if (hasChemBath) { addToOutputs(material, TagPrefix.crushedPurified, 1); addToOutputs(byproducts[3], TagPrefix.dust, byproductMultiplier); - addChance(7000, 0); + addChance(7000); fluidInputs.add(FluidTagList.of(washedIn.first().getFluidTag(), washedIn.secondInt(), DataComponentPatch.EMPTY)); } else { @@ -259,9 +259,9 @@ public GTOreByProduct(Material material) { addToOutputs(material, TagPrefix.dust, 1); addToOutputs(separatedInto.getFirst(), TagPrefix.dust, 1); - addChance(1000, 0); + addChance(1000); addToOutputs(separatedStack2); - addChance(prefix == TagPrefix.dust ? 500 : 2000, 0); + addChance(prefix == TagPrefix.dust ? 500 : 2000); } else { addEmptyOutputs(3); } @@ -273,23 +273,23 @@ public GTOreByProduct(Material material) { ItemStack chippedStack = ChemicalHelper.get(TagPrefix.gemChipped, material); addToOutputs(material, TagPrefix.gemExquisite, 1); - addGemChance(300, 0, 500, 0, highOutput); + addGemChance(300, 500, highOutput); addToOutputs(material, TagPrefix.gemFlawless, 1); - addGemChance(1000, 0, 1500, 0, highOutput); + addGemChance(1000, 1500, highOutput); addToOutputs(material, TagPrefix.gem, 1); - addGemChance(3500, 0, 5000, 0, highOutput); + addGemChance(3500, 5000, highOutput); addToOutputs(material, TagPrefix.dustPure, 1); - addGemChance(5000, 0, 2500, 0, highOutput); + addGemChance(5000, 2500, highOutput); if (!flawedStack.isEmpty()) { addToOutputs(flawedStack); - addGemChance(2500, 0, 2000, 0, highOutput); + addGemChance(2500, 2000, highOutput); } else { addEmptyOutputs(1); } if (!chippedStack.isEmpty()) { addToOutputs(chippedStack); - addGemChance(3500, 0, 3000, 0, highOutput); + addGemChance(3500, 3000, highOutput); } else { addEmptyOutputs(1); } @@ -303,15 +303,8 @@ public Consumer getTooltip(int slotIndex) { if (chances.containsKey(slotIndex)) { Content entry = chances.get(slotIndex); float chance = 100 * (float) entry.chance() / entry.maxChance(); - if (entry.tierChanceBoost() != 0) { - float boost = entry.tierChanceBoost() / 100.0f; - tooltip.addLine(FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_base", chance)); - tooltip.addLine( - FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_tier_boost_plus", boost)); - } else { - tooltip.addLine( - FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_no_boost", chance)); - } + tooltip.addLine( + FormattingUtil.formatPercentage2Places("gtceu.gui.content.chance_no_boost", chance)); } }; } @@ -355,18 +348,18 @@ private void addToInputs(ItemStack stack) { itemInputs.add(ItemStackList.of(stack)); } - private void addChance(int base, int tier) { + private void addChance(int base) { // this is solely for the chance overlay and tooltip, neither of which care about the ItemStack chances.put(currentSlot - 1, - new Content(ItemStack.EMPTY, base, ChanceLogic.getMaxChancedValue(), tier)); + new Content(ItemStack.EMPTY, base, ChanceLogic.getMaxChancedValue())); } // make the code less :weary: - private void addGemChance(int baseLow, int tierLow, int baseHigh, int tierHigh, boolean high) { + private void addGemChance(int baseLow, int baseHigh, boolean high) { if (high) { - addChance(baseHigh, tierHigh); + addChance(baseHigh); } else { - addChance(baseLow, tierLow); + addChance(baseLow); } } } diff --git a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/OreProcessingRecipeWidget.java b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/OreProcessingRecipeWidget.java index bc63f722a91..4e7c7f68f6f 100644 --- a/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/OreProcessingRecipeWidget.java +++ b/src/main/java/com/gregtechceu/gtceu/integration/recipeviewer/widgets/OreProcessingRecipeWidget.java @@ -128,7 +128,7 @@ public void setRecipe(GTOreByProduct recipeWrapper) { Content chance = recipeWrapper.getChance(i / 2 + itemInputs.size()); IDrawable overlay = null; if (chance != null) { - overlay = new ContentOverlay(chance, false, 0, 0, null); + overlay = new ContentOverlay(chance, false); } if (itemOutputs.get(slotIndex).isEmpty()) { continue; diff --git a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java index 0366900c204..beafefbae0e 100644 --- a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java +++ b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderFluidIngredientTest.java @@ -281,11 +281,10 @@ public static void singleblockRangedFluidOutputSabotaged(GameTestHelper helper) NotifiableFluidTank fluidIn = machine.importFluids; NotifiableFluidTank fluidOut = machine.exportFluids; - int runs = 7; - fluidIn.setFluidInTank(0, CR_OUT.copyWithAmount(runs)); + fluidIn.setFluidInTank(0, CR_OUT.copyWithAmount(REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each roll independently - int[] addedRolls = new int[runs]; + int[] addedRolls = new int[REPLICAS]; helper.runAfterDelay(2, () -> { if (machine.getRecipeLogic().getLastRecipe().getOutputContents(FluidRecipeCapability.CAP).get(0) @@ -306,29 +305,29 @@ public static void singleblockRangedFluidOutputSabotaged(GameTestHelper helper) "Recipe logic did not contain a Output!"); } }); - for (int i = 0; i < runs; i++) { + for (int i = 0; i < REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(2 * i + 3, () -> { addedRolls[finalI] = (int) fluidOut.getTotalContentAmount(); }); } // check the results of all rolls together - helper.runAfterDelay(runs * 2 + 1, () -> { + helper.runAfterDelay(REPLICAS * 2 + 1, () -> { FluidStack results = fluidOut.getFluidInTank(0); - helper.assertFalse((results.getAmount() == runs * 0), - "Sabotaged Singleblock Ranged Fluid Output rolled min value on every roll! " + + helper.assertFalse((results.getAmount() == REPLICAS * 0), + "Sabotaged Singleblock CR rolled min value on every roll! " + "This is the failure this sabotage was intended to induce."); - helper.assertFalse((results.getAmount() == runs * 9), + helper.assertFalse((results.getAmount() == REPLICAS * 9), "Sabotaged Singleblock CR rolled max value on every roll (how??)"); - helper.assertTrue(TestUtils.isFluidWithinRange(results, runs, runs * 9), + helper.assertTrue(TestUtils.isFluidWithinRange(results, REPLICAS, REPLICAS * 9), "Sabotaged Singleblock CR didn't produce correct number of fluids, produced [" + - results.getAmount() + "] not [" + runs + "-" + (runs * 9) + "]"); + results.getAmount() + "] not [" + REPLICAS + "-" + (REPLICAS * 9) + "]"); // check if all the rolls were equal, but not min/max - int[] rolls = new int[runs]; + int[] rolls = new int[REPLICAS]; rolls[0] = addedRolls[0]; boolean allEqual = false; - for (int i = 1; i < runs; i++) { + for (int i = 1; i < REPLICAS; i++) { rolls[i] = addedRolls[i] - addedRolls[i - 1]; if (rolls[i] == rolls[i - 1]) { allEqual = true; @@ -374,6 +373,56 @@ public static void singleblockRangedFluidInputFailure(GameTestHelper helper) { }); } + // Test for output preroll on singleblock machine with ranged fluid output + @GameTest(template = "singleblock_charged_cr", batch = "RangedFluidIngredients") + public static void singleblockRangedFluidOutputPreroll(GameTestHelper helper) { + SimpleTieredMachine machine = (SimpleTieredMachine) getMetaMachine( + helper.getBlockEntity(new BlockPos(0, 1, 0))); + + machine.setRecipeType(CR_RECIPE_TYPE); + NotifiableItemStackHandler itemIn = machine.importItems; + NotifiableFluidTank fluidIn = machine.importFluids; + NotifiableFluidTank fluidOut = machine.exportFluids; + + fluidIn.setFluidInTank(0, CR_OUT.copyWithAmount(REPLICAS)); + // 1t to turn on, 2t per recipe run + // get the result of each preroll independently + int[] prerolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { + final int finalI = i; // lambda preserve you + helper.runAfterDelay(2 * i + 1, () -> { + helper.assertFalse(machine.recipeLogic.getLastRecipe() == null, + "Singleblock fluid CR Preroll was not running a recipe when preroll was checked!"); + var outputPrerolls = machine.recipeLogic.getLastRecipe().outputs.get(FluidRecipeCapability.CAP); + helper.assertFalse(outputPrerolls.size() == 0, + "Singleblock fluid CR Preroll's recipe output contained no fluids!"); + prerolls[finalI] = ((IRangedIngredient) (outputPrerolls.get(0).content())).getAmount();; + }); + } + // get the result of each roll independently + int[] addedRolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { + final int finalI = i; // lambda preserve you + helper.runAfterDelay(2 * i + 3, () -> { + addedRolls[finalI] = fluidOut.getFluidInTank(0).getAmount(); + }); + } + // check the results of all rolls together + helper.runAfterDelay(REPLICAS * 2 + 10, () -> { + // check if all the rolls were equal, but not min/max + int[] rolls = new int[REPLICAS]; + rolls[0] = addedRolls[0]; + helper.assertFalse(prerolls[0] != rolls[0], "Singleblock fluid CR Preroll failed on run 0"); + + for (int i = 1; i < REPLICAS; i++) { + rolls[i] = addedRolls[i] - addedRolls[i - 1]; + helper.assertFalse(prerolls[i] != rolls[i], + "Singleblock fluid CR Preroll failed on run [" + i + "]"); + } + helper.succeed(); + }); + } + // Test for singleblock machine with ranged fluid input @TestHolder @GameTest(template = "singleblock_charged_cr", batch = "RangedFluidIngredients") @@ -386,26 +435,25 @@ public static void singleblockRangedFluidInput(GameTestHelper helper) { NotifiableFluidTank fluidIn = machine.importFluids; NotifiableFluidTank fluidOut = machine.exportFluids; - int runs = 7; fluidIn.setFluidInTank(0, CR_IN.copyWithAmount(64)); - itemIn.setStackInSlot(0, COBBLE.copyWithCount(runs)); + itemIn.setStackInSlot(0, COBBLE.copyWithCount(REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each roll independently - int[] addedRolls = new int[runs]; - for (int i = 0; i < runs; i++) { + int[] addedRolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(2 * i + 1, () -> { addedRolls[finalI] = fluidIn.getFluidInTank(0).getAmount(); }); } // check the results of all rolls together - helper.runAfterDelay(runs * 2 + 2, () -> { + helper.runAfterDelay(REPLICAS * 2 + 2, () -> { FluidStack results = fluidIn.getFluidInTank(0); - int upperLimit = 64 - (runs * 0); - int lowerLimit = 64 - (runs * 9); - helper.assertTrue(TestUtils.isFluidStackEqual(fluidOut.getFluidInTank(0), REDSTONE.copyWithAmount(runs)), + int upperLimit = 64 - (REPLICAS * 0); + int lowerLimit = 64 - (REPLICAS * 9); + helper.assertTrue(TestUtils.isFluidStackEqual(fluidOut.getFluidInTank(0), REDSTONE.copyWithAmount(REPLICAS)), "Singleblock CR didn't complete correct number of recipes, completed [" + - fluidOut.getFluidInTank(0).getAmount() + "] not [" + runs + "]"); + fluidOut.getFluidInTank(0).getAmount() + "] not [" + REPLICAS + "]"); helper.assertTrue(TestUtils.isFluidWithinRange(results, lowerLimit, upperLimit), "Singleblock CR didn't consume correct number of fluids, consumed [" + (64 - results.getAmount()) + "] not [" + lowerLimit + "-" + upperLimit + "]"); @@ -415,10 +463,10 @@ public static void singleblockRangedFluidInput(GameTestHelper helper) { "Singleblock CR rolled min value on every roll"); // check if all the rolls were equal, but not min/max - int[] rolls = new int[runs]; + int[] rolls = new int[REPLICAS]; rolls[0] = 64 - addedRolls[0]; boolean allEqual = false; - for (int i = 1; i < runs; i++) { + for (int i = 1; i < REPLICAS; i++) { rolls[i] = addedRolls[i - 1] - addedRolls[i]; if (rolls[i] == rolls[i - 1]) { allEqual = true; @@ -444,36 +492,35 @@ public static void singleblockRangedFluidOutput(GameTestHelper helper) { NotifiableFluidTank fluidIn = machine.importFluids; NotifiableFluidTank fluidOut = machine.exportFluids; - int runs = 7; - fluidIn.setFluidInTank(0, CR_OUT.copyWithAmount(runs)); + fluidIn.setFluidInTank(0, CR_OUT.copyWithAmount(REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each roll independently - int[] addedRolls = new int[runs]; - for (int i = 0; i < runs; i++) { + int[] addedRolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(2 * i + 3, () -> { addedRolls[finalI] = fluidOut.getFluidInTank(0).getAmount(); }); } // check the results of all rolls together - helper.runAfterDelay(runs * 2 + 1, () -> { + helper.runAfterDelay(REPLICAS * 2 + 1, () -> { helper.assertTrue(fluidIn.getFluidInTank(0).isEmpty(), "Singleblock CR didn't complete correct number of recipes, completed [" + - fluidIn.getFluidInTank(0).getAmount() + "] not [" + runs + "]"); + fluidIn.getFluidInTank(0).getAmount() + "] not [" + REPLICAS + "]"); FluidStack results = fluidOut.getFluidInTank(0); - helper.assertTrue(TestUtils.isFluidWithinRange(results, runs, runs * 9), + helper.assertTrue(TestUtils.isFluidWithinRange(results, REPLICAS, REPLICAS * 9), "Singleblock CR didn't produce correct number of fluids, produced [" + - results.getAmount() + "] not [" + runs + "-" + (runs * 9) + "]"); - helper.assertFalse((results.getAmount() == runs * 9), + results.getAmount() + "] not [" + REPLICAS + "-" + (REPLICAS * 9) + "]"); + helper.assertFalse((results.getAmount() == REPLICAS * 9), "Singleblock CR rolled max value on every roll"); - helper.assertFalse((results.getAmount() == runs * 0), + helper.assertFalse((results.getAmount() == REPLICAS * 0), "Singleblock CR rolled min value on every roll"); // check if all the rolls were equal, but not min/max - int[] rolls = new int[runs]; + int[] rolls = new int[REPLICAS]; rolls[0] = addedRolls[0]; boolean allEqual = false; - for (int i = 1; i < runs; i++) { + for (int i = 1; i < REPLICAS; i++) { rolls[i] = addedRolls[i] - addedRolls[i - 1]; if (rolls[i] == rolls[i - 1]) { allEqual = true; @@ -497,26 +544,25 @@ public static void multiblockLCRRangedFluidInput(GameTestHelper helper) { NotifiableFluidTank fluidIn = busHolder.inputHatch1.tank; NotifiableFluidTank fluidOut = busHolder.outputHatch1.tank; - int runs = 7; fluidIn.setFluidInTank(0, LCR_IN.copyWithAmount(64)); - fluidIn.setFluidInTank(1, RUBBER.copyWithAmount(runs)); + fluidIn.setFluidInTank(1, RUBBER.copyWithAmount(REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each roll independently - int[] addedRolls = new int[runs]; - for (int i = 0; i < runs; i++) { + int[] addedRolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(2 * i + 1, () -> { addedRolls[finalI] = fluidIn.getFluidInTank(0).getAmount(); }); } // check the results of all rolls together - helper.runAfterDelay(runs * 2 + 2, () -> { + helper.runAfterDelay(REPLICAS * 2 + 2, () -> { FluidStack results = fluidIn.getFluidInTank(0); - int upperLimit = 64 - (runs * 0); - int lowerLimit = 64 - (runs * 9); - helper.assertTrue(TestUtils.isFluidStackEqual(fluidOut.getFluidInTank(0), REDSTONE.copyWithAmount(runs)), + int upperLimit = 64 - (REPLICAS * 0); + int lowerLimit = 64 - (REPLICAS * 9); + helper.assertTrue(TestUtils.isFluidStackEqual(fluidOut.getFluidInTank(0), REDSTONE.copyWithAmount(REPLICAS)), "LCR didn't complete correct number of recipes, completed [" + - fluidOut.getFluidInTank(0).getAmount() + "] not [" + runs + "]"); + fluidOut.getFluidInTank(0).getAmount() + "] not [" + REPLICAS + "]"); helper.assertTrue(TestUtils.isFluidWithinRange(results, lowerLimit, upperLimit), "LCR didn't consume correct number of fluids, consumed [" + (64 - results.getAmount()) + "] not [" + lowerLimit + "-" + upperLimit + "]"); @@ -526,10 +572,10 @@ public static void multiblockLCRRangedFluidInput(GameTestHelper helper) { "LCR rolled min value on every roll"); // check if all the rolls were equal, but not min/max - int[] rolls = new int[runs]; + int[] rolls = new int[REPLICAS]; rolls[0] = 64 - addedRolls[0]; boolean allEqual = false; - for (int i = 1; i < runs; i++) { + for (int i = 1; i < REPLICAS; i++) { rolls[i] = addedRolls[i - 1] - addedRolls[i]; if (rolls[i] == rolls[i - 1]) { allEqual = true; @@ -553,36 +599,35 @@ public static void multiblockLCRRangedFluidOutput(GameTestHelper helper) { final NotifiableFluidTank fluidIn = busHolder.inputHatch1.tank; final NotifiableFluidTank fluidOut = busHolder.outputHatch1.tank; - int runs = 7; - fluidIn.setFluidInTank(0, LCR_OUT.copyWithAmount(runs)); + fluidIn.setFluidInTank(0, LCR_OUT.copyWithAmount(REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each roll independently - int[] addedRolls = new int[runs]; - for (int i = 0; i < runs; i++) { + int[] addedRolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(2 * i + 3, () -> { addedRolls[finalI] = fluidOut.getFluidInTank(0).getAmount(); }); } // check the results of all rolls together - helper.runAfterDelay(runs * 2 + 1, () -> { + helper.runAfterDelay(REPLICAS * 2 + 1, () -> { helper.assertTrue(fluidIn.getFluidInTank(0).isEmpty(), "LCR didn't complete correct number of recipes, completed [" + - fluidIn.getFluidInTank(0).getAmount() + "] not [" + runs + "]"); + fluidIn.getFluidInTank(0).getAmount() + "] not [" + REPLICAS + "]"); FluidStack results = fluidOut.getFluidInTank(0); - helper.assertTrue(TestUtils.isFluidWithinRange(results, runs, runs * 9), + helper.assertTrue(TestUtils.isFluidWithinRange(results, REPLICAS, REPLICAS * 9), "LCR didn't produce correct number of fluids, produced [" + - results.getAmount() + "] not [" + runs + "-" + (runs * 9) + "]"); - helper.assertFalse((results.getAmount() == runs * 9), + results.getAmount() + "] not [" + REPLICAS + "-" + (REPLICAS * 9) + "]"); + helper.assertFalse((results.getAmount() == REPLICAS * 9), "LCR rolled max value on every roll"); - helper.assertFalse((results.getAmount() == runs * 0), + helper.assertFalse((results.getAmount() == REPLICAS * 0), "LCR rolled min value on every roll"); // check if all the rolls were equal, but not min/max - int[] rolls = new int[runs]; + int[] rolls = new int[REPLICAS]; rolls[0] = addedRolls[0]; boolean allEqual = false; - for (int i = 1; i < runs; i++) { + for (int i = 1; i < REPLICAS; i++) { rolls[i] = addedRolls[i] - addedRolls[i - 1]; if (rolls[i] == rolls[i - 1]) { allEqual = true; @@ -1055,4 +1100,61 @@ public static void multiblockLCentRangedFluidOutput16ParallelBatched(GameTestHel helper.succeed(); }); } + + // test for multiblock machine with 16x Parallels with ranged fluid output preroll + @GameTest(template = "large_centrifuge_zpm_batch_parallel16", + batch = "RangedFluidIngredients", + timeoutTicks = 2000) + public static void multiblockLCentRangedFluidOutputPreroll16ParallelBatched(GameTestHelper helper) { + BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); + + final NotifiableFluidTank fluidIn = busHolder.inputHatch1.tank; + final NotifiableFluidTank fluidOut = busHolder.outputHatch1.tank; + + int batches = 16; + int parallels = 16; + busHolder.controller.setBatchEnabled(true); + busHolder.parallelHatch.setCurrentParallel(parallels); + + fluidIn.setFluidInTank(0, LCENT_OUT.copyWithAmount(batches * parallels)); + + // 1t to turn on, 64t per recipe run, 10t buffer for sanity + int[] prerolls = new int[MULTI_REPLICAS]; + for (int i = 0; i < MULTI_REPLICAS; i++) { + final int finalI = i; // lambda preserve you + helper.runAfterDelay(75 * finalI + 20, () -> { + helper.assertFalse(busHolder.controller.recipeLogic.getLastRecipe() == null, + "Multiblock LCent fluid Preroll was not running a recipe when preroll was checked!"); + var outputPrerolls = busHolder.controller.recipeLogic.getLastRecipe().outputs + .get(FluidRecipeCapability.CAP); + helper.assertFalse(outputPrerolls.size() == 0, + "Multiblock LCent fluid Preroll's recipe output contained no fluids!"); + prerolls[finalI] = ((IRangedIngredient) (outputPrerolls.get(0).content())).getAmount();; + }); + } + // check the results of all rolls together + // repeat recipe MULTI_REPLICAS times + int[] addedRolls = new int[MULTI_REPLICAS]; + for (int i = 1; i <= MULTI_REPLICAS; i++) { + final int finalI = i; // lambda preserve you + helper.runAfterDelay(75 * finalI, () -> { + addedRolls[finalI - 1] = fluidOut.getFluidInTank(0).getAmount(); + // reset for a rerun + fluidIn.setFluidInTank(0, LCENT_OUT.copyWithAmount(batches * parallels)); + }); + } + + helper.runAfterDelay(1 + 75 * MULTI_REPLICAS, () -> { + int[] rolls = new int[MULTI_REPLICAS]; + rolls[0] = addedRolls[0]; + helper.assertFalse(prerolls[0] != rolls[0], "Multiblock LCent fluid Preroll failed on run 0"); + + for (int i = 1; i < MULTI_REPLICAS; i++) { + rolls[i] = addedRolls[i] - addedRolls[i - 1]; + helper.assertFalse(prerolls[i] != rolls[i], + "Multiblock LCent fluid Preroll failed on run [" + i + "]"); + } + helper.succeed(); + }); + } } diff --git a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java index 63008ce30e4..d0e7d782b1d 100644 --- a/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java +++ b/src/test/java/com/gregtechceu/gtceu/api/recipe/ingredient/IntProviderIngredientTest.java @@ -275,11 +275,10 @@ public static void singleblockRangedItemOutputSabotaged(GameTestHelper helper) { NotifiableItemStackHandler itemIn = machine.importItems; NotifiableItemStackHandler itemOut = machine.exportItems; - int runs = 7; - itemIn.setStackInSlot(0, CR_OUT.copyWithCount(runs)); + itemIn.setStackInSlot(0, CR_OUT.copyWithCount(REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each roll independently - int[] addedRolls = new int[runs]; + int[] addedRolls = new int[REPLICAS]; helper.runAfterDelay(2, () -> { if (machine.getRecipeLogic().getLastRecipe().getOutputContents(ItemRecipeCapability.CAP).get(0) @@ -300,30 +299,30 @@ public static void singleblockRangedItemOutputSabotaged(GameTestHelper helper) { "Recipe logic did not contain a Output!"); } }); - for (int i = 0; i < runs; i++) { + for (int i = 0; i < REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(2 * i + 3, () -> { addedRolls[finalI] = itemOut.getStackInSlot(0).getCount(); }); } // check the results of all rolls together - helper.runAfterDelay(runs * 2 + 1, () -> { + helper.runAfterDelay(REPLICAS * 2 + 1, () -> { ItemStack results = itemOut.getStackInSlot(0); - helper.assertFalse((results.getCount() == runs * 0), - "Sabotaged Singleblock Ranged Item Output rolled min value on every roll! " + + helper.assertFalse((results.getCount() == REPLICAS * 0), + "Sabotaged Singleblock CR rolled min value on every roll! " + "This is the failure this sabotage was intended to induce."); - helper.assertFalse((results.getCount() == runs * 9), + helper.assertFalse((results.getCount() == REPLICAS * 9), "Sabotaged Singleblock CR rolled max value on every roll (how??)"); - helper.assertTrue(TestUtils.isItemWithinRange(results, runs, runs * 9), + helper.assertTrue(TestUtils.isItemWithinRange(results, REPLICAS, REPLICAS * 9), "Sabotaged Singleblock CR didn't produce correct number of items, produced [" + - results.getCount() + "] not [" + runs + "-" + (runs * 9) + "]"); + results.getCount() + "] not [" + REPLICAS + "-" + (REPLICAS * 9) + "]"); // check if all the rolls were equal, but not min/max - int[] rolls = new int[runs]; + int[] rolls = new int[REPLICAS]; rolls[0] = addedRolls[0]; boolean allEqual = false; - for (int i = 1; i < runs; i++) { + for (int i = 1; i < REPLICAS; i++) { rolls[i] = addedRolls[i] - addedRolls[i - 1]; if (rolls[i] == rolls[i - 1]) { allEqual = true; @@ -368,6 +367,54 @@ public static void singleblockRangedItemInputFailure(GameTestHelper helper) { }); } + // Test for output preroll on singleblock machine with ranged item output + @GameTest(template = "singleblock_charged_cr", batch = "RangedIngredients") + public static void singleblockRangedItemOutputPreroll(GameTestHelper helper) { + SimpleTieredMachine machine = (SimpleTieredMachine) getMetaMachine( + helper.getBlockEntity(new BlockPos(0, 1, 0))); + + machine.setRecipeType(CR_RECIPE_TYPE); + NotifiableItemStackHandler itemIn = machine.importItems; + NotifiableItemStackHandler itemOut = machine.exportItems; + + itemIn.setStackInSlot(0, CR_OUT.copyWithCount(REPLICAS)); + // 1t to turn on, 2t per recipe run + // get the result of each preroll independently + int[] prerolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { + final int finalI = i; // lambda preserve you + helper.runAfterDelay(2 * i + 1, () -> { + helper.assertFalse(machine.recipeLogic.getLastRecipe() == null, + "Singleblock item CR Preroll was not running a recipe when preroll was checked!"); + var outputPrerolls = machine.recipeLogic.getLastRecipe().outputs.get(ItemRecipeCapability.CAP); + helper.assertFalse(outputPrerolls.size() == 0, + "Singleblock item CR Preroll's recipe output contained no items!"); + prerolls[finalI] = ((IRangedIngredient) (outputPrerolls.get(0).content())).getAmount();; + }); + } + // get the result of each roll independently + int[] addedRolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { + final int finalI = i; // lambda preserve you + helper.runAfterDelay(2 * i + 3, () -> { + addedRolls[finalI] = itemOut.getStackInSlot(0).getCount(); + }); + } + // check the results of all rolls together + helper.runAfterDelay(REPLICAS * 2 + 10, () -> { + // check if all the rolls matched their preroll + int[] rolls = new int[REPLICAS]; + rolls[0] = addedRolls[0]; + helper.assertFalse(prerolls[0] != rolls[0], "Singleblock item CR Preroll failed on run 0"); + for (int i = 1; i < REPLICAS; i++) { + rolls[i] = addedRolls[i] - addedRolls[i - 1]; + helper.assertFalse(prerolls[i] != rolls[i], + "Singleblock CR Preroll failed on run [" + i + "]"); + } + helper.succeed(); + }); + } + // Test for singleblock machine with ranged item input @TestHolder() @GameTest(template = "singleblock_charged_cr", batch = "RangedIngredients") @@ -379,26 +426,25 @@ public static void singleblockRangedItemInput(GameTestHelper helper) { NotifiableItemStackHandler itemIn = machine.importItems; NotifiableItemStackHandler itemOut = machine.exportItems; - int runs = 7; itemIn.setStackInSlot(0, CR_IN.copyWithCount(64)); - itemIn.setStackInSlot(1, COBBLE.copyWithCount(runs)); + itemIn.setStackInSlot(1, COBBLE.copyWithCount(REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each roll independently - int[] addedRolls = new int[runs]; - for (int i = 0; i < runs; i++) { + int[] addedRolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(2 * i + 1, () -> { addedRolls[finalI] = itemIn.getStackInSlot(0).getCount(); }); } // check the results of all rolls together - helper.runAfterDelay(runs * 2 + 1, () -> { + helper.runAfterDelay(REPLICAS * 2 + 1, () -> { ItemStack results = itemIn.getStackInSlot(0); - int upperLimit = 64 - (runs * 0); - int lowerLimit = 64 - (runs * 9); - helper.assertTrue(TestUtils.isItemStackEqual(itemOut.getStackInSlot(0), STONE.copyWithCount(runs)), + int upperLimit = 64 - (REPLICAS * 0); + int lowerLimit = 64 - (REPLICAS * 9); + helper.assertTrue(TestUtils.isItemStackEqual(itemOut.getStackInSlot(0), STONE.copyWithCount(REPLICAS)), "Singleblock CR didn't complete correct number of recipes, completed [" + - itemOut.getStackInSlot(0).getCount() + "] not [" + runs + "]"); + itemOut.getStackInSlot(0).getCount() + "] not [" + REPLICAS + "]"); helper.assertTrue(TestUtils.isItemWithinRange(results, lowerLimit, upperLimit), "Singleblock CR didn't consume correct number of items, consumed [" + (64 - results.getCount()) + "] not [" + lowerLimit + "-" + upperLimit + "]"); @@ -408,10 +454,10 @@ public static void singleblockRangedItemInput(GameTestHelper helper) { "Singleblock CR rolled min value on every roll"); // check if all the rolls were equal, but not min/max - int[] rolls = new int[runs]; + int[] rolls = new int[REPLICAS]; rolls[0] = 64 - addedRolls[0]; boolean allEqual = false; - for (int i = 1; i < runs; i++) { + for (int i = 1; i < REPLICAS; i++) { rolls[i] = addedRolls[i - 1] - addedRolls[i]; if (rolls[i] == rolls[i - 1]) { allEqual = true; @@ -437,36 +483,35 @@ public static void singleblockRangedItemOutput(GameTestHelper helper) { NotifiableItemStackHandler itemIn = machine.importItems; NotifiableItemStackHandler itemOut = machine.exportItems; - int runs = 7; - itemIn.setStackInSlot(0, CR_OUT.copyWithCount(runs)); + itemIn.setStackInSlot(0, CR_OUT.copyWithCount(REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each roll independently - int[] addedRolls = new int[runs]; - for (int i = 0; i < runs; i++) { + int[] addedRolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(2 * i + 3, () -> { addedRolls[finalI] = itemOut.getStackInSlot(0).getCount(); }); } // check the results of all rolls together - helper.runAfterDelay(runs * 2 + 1, () -> { + helper.runAfterDelay(REPLICAS * 2 + 1, () -> { helper.assertTrue(itemIn.getStackInSlot(0).isEmpty(), "Singleblock CR didn't complete correct number of recipes, completed [" + - itemIn.getStackInSlot(0).getCount() + "] not [" + runs + "]"); + itemIn.getStackInSlot(0).getCount() + "] not [" + REPLICAS + "]"); ItemStack results = itemOut.getStackInSlot(0); - helper.assertTrue(TestUtils.isItemWithinRange(results, runs, runs * 9), + helper.assertTrue(TestUtils.isItemWithinRange(results, REPLICAS, REPLICAS * 9), "Singleblock CR didn't produce correct number of items, produced [" + - results.getCount() + "] not [" + runs + "-" + (runs * 9) + "]"); - helper.assertFalse((results.getCount() == runs * 9), + results.getCount() + "] not [" + REPLICAS + "-" + (REPLICAS * 9) + "]"); + helper.assertFalse((results.getCount() == REPLICAS * 9), "Singleblock CR rolled max value on every roll"); - helper.assertFalse((results.getCount() == runs * 0), + helper.assertFalse((results.getCount() == REPLICAS * 0), "Singleblock CR rolled min value on every roll"); // check if all the rolls were equal, but not min/max - int[] rolls = new int[runs]; + int[] rolls = new int[REPLICAS]; rolls[0] = addedRolls[0]; boolean allEqual = false; - for (int i = 1; i < runs; i++) { + for (int i = 1; i < REPLICAS; i++) { rolls[i] = addedRolls[i] - addedRolls[i - 1]; if (rolls[i] == rolls[i - 1]) { allEqual = true; @@ -490,26 +535,25 @@ public static void multiblockLCRRangedItemInput(GameTestHelper helper) { NotifiableItemStackHandler itemIn = busHolder.inputBus1.getInventory(); NotifiableItemStackHandler itemOut = busHolder.outputBus1.getInventory(); - int runs = 7; itemIn.setStackInSlot(0, LCR_IN.copyWithCount(64)); - itemIn.setStackInSlot(1, COBBLE.copyWithCount(runs)); + itemIn.setStackInSlot(1, COBBLE.copyWithCount(REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each roll independently - int[] addedRolls = new int[runs]; - for (int i = 0; i < runs; i++) { + int[] addedRolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(2 * i + 1, () -> { addedRolls[finalI] = itemIn.getStackInSlot(0).getCount(); }); } // check the results of all rolls together - helper.runAfterDelay(runs * 2 + 1, () -> { + helper.runAfterDelay(REPLICAS * 2 + 1, () -> { ItemStack results = itemIn.getStackInSlot(0); - int upperLimit = 64 - (runs * 0); - int lowerLimit = 64 - (runs * 9); - helper.assertTrue(TestUtils.isItemStackEqual(itemOut.getStackInSlot(0), STONE.copyWithCount(runs)), + int upperLimit = 64 - (REPLICAS * 0); + int lowerLimit = 64 - (REPLICAS * 9); + helper.assertTrue(TestUtils.isItemStackEqual(itemOut.getStackInSlot(0), STONE.copyWithCount(REPLICAS)), "LCR didn't complete correct number of recipes, completed [" + - itemOut.getStackInSlot(0).getCount() + "] not [" + runs + "]"); + itemOut.getStackInSlot(0).getCount() + "] not [" + REPLICAS + "]"); helper.assertTrue(TestUtils.isItemWithinRange(results, lowerLimit, upperLimit), "LCR didn't consume correct number of items, consumed [" + (64 - results.getCount()) + "] not [" + lowerLimit + "-" + upperLimit + "]"); @@ -519,10 +563,10 @@ public static void multiblockLCRRangedItemInput(GameTestHelper helper) { "LCR rolled min value on every roll"); // check if all the rolls were equal, but not min/max - int[] rolls = new int[runs]; + int[] rolls = new int[REPLICAS]; rolls[0] = 64 - addedRolls[0]; boolean allEqual = false; - for (int i = 1; i < runs; i++) { + for (int i = 1; i < REPLICAS; i++) { rolls[i] = addedRolls[i - 1] - addedRolls[i]; if (rolls[i] == rolls[i - 1]) { allEqual = true; @@ -546,36 +590,35 @@ public static void multiblockLCRRangedItemOutput(GameTestHelper helper) { NotifiableItemStackHandler itemIn = busHolder.inputBus1.getInventory(); NotifiableItemStackHandler itemOut = busHolder.outputBus1.getInventory(); - int runs = 7; - itemIn.setStackInSlot(0, LCR_OUT.copyWithCount(runs)); + itemIn.setStackInSlot(0, LCR_OUT.copyWithCount(REPLICAS)); // 1t to turn on, 2t per recipe run // get the result of each roll independently - int[] addedRolls = new int[runs]; - for (int i = 0; i < runs; i++) { + int[] addedRolls = new int[REPLICAS]; + for (int i = 0; i < REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(2 * i + 3, () -> { addedRolls[finalI] = itemOut.getStackInSlot(0).getCount(); }); } // check the results of all rolls together - helper.runAfterDelay(runs * 2 + 1, () -> { + helper.runAfterDelay(REPLICAS * 2 + 1, () -> { helper.assertTrue(itemIn.getStackInSlot(0).isEmpty(), "LCR didn't complete correct number of recipes, completed [" + - itemIn.getStackInSlot(0).getCount() + "] not [" + runs + "]"); + itemIn.getStackInSlot(0).getCount() + "] not [" + REPLICAS + "]"); ItemStack results = itemOut.getStackInSlot(0); - helper.assertTrue(TestUtils.isItemWithinRange(results, runs, runs * 9), + helper.assertTrue(TestUtils.isItemWithinRange(results, REPLICAS, REPLICAS * 9), "LCR didn't produce correct number of items, produced [" + - results.getCount() + "] not [" + runs + "-" + (runs * 9) + "]"); - helper.assertFalse((results.getCount() == runs * 9), + results.getCount() + "] not [" + REPLICAS + "-" + (REPLICAS * 9) + "]"); + helper.assertFalse((results.getCount() == REPLICAS * 9), "LCR rolled max value on every roll"); - helper.assertFalse((results.getCount() == runs * 0), + helper.assertFalse((results.getCount() == REPLICAS * 0), "LCR rolled min value on every roll"); // check if all the rolls were equal, but not min/max - int[] rolls = new int[runs]; + int[] rolls = new int[REPLICAS]; rolls[0] = addedRolls[0]; boolean allEqual = false; - for (int i = 1; i < runs; i++) { + for (int i = 1; i < REPLICAS; i++) { rolls[i] = addedRolls[i] - addedRolls[i - 1]; if (rolls[i] == rolls[i - 1]) { allEqual = true; @@ -997,7 +1040,7 @@ public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelp // 16 parallels // check the results of all rolls together // repeat recipe MULTI_REPLICAS times - int[] addedRolls = new int[MULTI_REPLICAS]; + int[] rolls = new int[MULTI_REPLICAS]; for (int i = 1; i <= MULTI_REPLICAS; i++) { final int finalI = i; // lambda preserve you helper.runAfterDelay(75 * finalI, () -> { @@ -1015,7 +1058,7 @@ public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelp "Batched Parallel LCent didn't produce correct number of items, produced [" + resultCount + "] not [" + lowerLimit + "-" + upperLimit + "]"); - addedRolls[finalI - 1] = resultCount; + rolls[finalI - 1] = resultCount; // reset for a rerun for (int j = 0; j < batches; j++) { @@ -1031,9 +1074,7 @@ public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelp helper.runAfterDelay(1 + 75 * MULTI_REPLICAS, () -> { // check if each roll was a multiple of run count boolean sus = false; - int[] rolls = new int[MULTI_REPLICAS]; - rolls[0] = addedRolls[0]; if (TestUtils.isStackSizeExactlyEvenMultiple(rolls[0], batches, parallels, 1)) { sus = true; GTCEu.LOGGER.warn("Batched Parallel LCent ranged item output test iteration " + 1 + " produced [" + @@ -1041,7 +1082,6 @@ public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelp "). If this message only appears once, this is likely a false positive."); } for (int i = 1; i < MULTI_REPLICAS; i++) { - rolls[i] = addedRolls[i] - addedRolls[i - 1]; if (TestUtils.isStackSizeExactlyEvenMultiple(rolls[i], batches, parallels, 1)) { sus = true; GTCEu.LOGGER.warn("Batched Parallel LCent ranged item output test iteration " + (i + 1) + @@ -1059,4 +1099,70 @@ public static void multiblockLCentRangedItemOutput16ParallelBatched(GameTestHelp helper.succeed(); }); } + + // test for multiblock machine with 16x Parallels with ranged item output + @GameTest(template = "large_centrifuge_zpm_batch_parallel16", + batch = "RangedIngredients", + timeoutTicks = 2000) + public static void multiblockLCentRangedItemOutputPreroll16ParallelBatched(GameTestHelper helper) { + BusHolderBatchParallel busHolder = getBussesAndFormLCENT(helper); + + NotifiableItemStackHandler itemIn = busHolder.inputBus1.getInventory(); + NotifiableItemStackHandler itemOut = busHolder.outputBus1.getInventory(); + + int batches = 16; + int parallels = 16; + busHolder.controller.setBatchEnabled(true); + busHolder.parallelHatch.setCurrentParallel(parallels); + + for (int j = 0; j < batches; j++) { + itemIn.setStackInSlot(j, LCENT_OUT.copyWithCount(16)); + } + + // 1t to turn on, 64t per recipe run, 10t buffer for sanity + // 16 parallels + int[] prerolls = new int[MULTI_REPLICAS]; + for (int i = 0; i < MULTI_REPLICAS; i++) { + final int finalI = i; // lambda preserve you + helper.runAfterDelay(75 * finalI + 20, () -> { + helper.assertFalse(busHolder.controller.recipeLogic.getLastRecipe() == null, + "Multiblock LCent item Preroll was not running a recipe when preroll was checked!"); + var outputPrerolls = busHolder.controller.recipeLogic.getLastRecipe().outputs + .get(ItemRecipeCapability.CAP); + helper.assertFalse(outputPrerolls.size() == 0, + "Multiblock LCent item Preroll's recipe output contained no items!"); + prerolls[finalI] = ((IRangedIngredient) (outputPrerolls.get(0).content())).getAmount();; + }); + } + // check the results of all rolls together + // repeat recipe MULTI_REPLICAS times + int[] rolls = new int[MULTI_REPLICAS]; + for (int i = 1; i <= MULTI_REPLICAS; i++) { + final int finalI = i; // lambda preserve you + helper.runAfterDelay(75 * finalI, () -> { + int resultCount = (int) Math.round(itemOut.getTotalContentAmount()); + rolls[finalI - 1] = resultCount; + + // reset for a rerun + for (int j = 0; j < batches; j++) { + itemIn.setStackInSlot(j, LCENT_OUT.copyWithCount(16)); + } + // Don't overflow the output bus + for (int j = 0; j < itemOut.getSize(); j++) { + itemOut.setStackInSlot(j, ItemStack.EMPTY); + } + }); + } + + helper.runAfterDelay(1 + 75 * MULTI_REPLICAS, () -> { + + helper.assertFalse(prerolls[0] != rolls[0], "Multiblock LCent item Preroll failed on run 0"); + + for (int i = 1; i < REPLICAS; i++) { + helper.assertFalse(prerolls[i] != rolls[i], + "Multiblock LCent item Preroll failed on run [" + i + "]"); + } + helper.succeed(); + }); + } }