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 9167785133c..fcd388d88c2 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 lombok.Getter; import lombok.Setter; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Allows a {@link FluidIngredient} to be created with a ranged {@code amount}, which will be randomly rolled upon @@ -53,6 +54,13 @@ protected IntProviderFluidIngredient(FluidIngredient inner, IntProvider provider this.countProvider = provider; } + protected IntProviderFluidIngredient(FluidIngredient inner, IntProvider provider, int sampledCount) { + super(inner.values, provider.getMaxValue(), null); + this.inner = inner; + this.countProvider = provider; + this.sampledCount = sampledCount; + } + @Override public IntProviderFluidIngredient copy() { IntProviderFluidIngredient ipfi = new IntProviderFluidIngredient(this.inner, this.countProvider); @@ -150,6 +158,14 @@ public boolean isEmpty() { return inner.isEmpty(); } + /** + * Resets the random roll on this ingredient + */ + public void reroll() { + sampledCount = -1; + fluidStacks = null; + } + /** * @param inner {@link FluidIngredient} * @param provider usually as {@link UniformInt#of(int, int)} @@ -162,6 +178,11 @@ public static IntProviderFluidIngredient of(FluidStack inner, int min, int max) return IntProviderFluidIngredient.of(FluidIngredient.of(inner), UniformInt.of(min, max)); } + @Override + public boolean test(@Nullable FluidStack stack) { + return inner.test(stack); + } + /** * Properties: *