Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
b96bf1c
rebase
DilithiumThoride Aug 9, 2025
d2677d4
initial commit
DilithiumThoride Aug 19, 2025
278d1a3
failure?
DilithiumThoride Aug 20, 2025
f39a27c
Singleblock test cases
DilithiumThoride Aug 20, 2025
8cc7d81
doesn't actually run the recipe
DilithiumThoride Aug 20, 2025
f7ede18
task failed successfully
DilithiumThoride Aug 20, 2025
273ecdf
multiblock tests part 1
DilithiumThoride Aug 22, 2025
f346a48
fix an error that InputSeparationTest throws
DilithiumThoride Aug 22, 2025
71960d6
replace TestUtils comments with javadoc
DilithiumThoride Aug 22, 2025
d01e809
multiblock ranged item test part 2: parallel in?
DilithiumThoride Aug 22, 2025
1ab55ff
this changes nothing
DilithiumThoride Aug 22, 2025
9229ccd
test 5/20
DilithiumThoride Aug 22, 2025
0810fce
ranged parallels output item
DilithiumThoride Aug 25, 2025
51ac8e0
ranges of 0
DilithiumThoride Sep 6, 2025
19b7aa1
Merge branch '1.20.1' into dt/ranged-inputs-tests
DilithiumThoride Sep 6, 2025
9e735ce
merge conflict resolve
DilithiumThoride Sep 6, 2025
9a78a58
Implemented Sabotaged Recipe Test
DilithiumThoride Sep 6, 2025
33df898
Merge branch '1.20.1' into dt/ranged-inputs-tests
DilithiumThoride Sep 6, 2025
c90244e
Merge remote-tracking branch 'origin/dt/ranged-inputs-tests' into dt/…
DilithiumThoride Sep 6, 2025
f4e2f75
spotless moment
DilithiumThoride Sep 6, 2025
671f369
"why am I doing this test"
DilithiumThoride Sep 6, 2025
3850715
add Batch Tests. Untested. Awaiting an onion.
DilithiumThoride Sep 6, 2025
e5826c8
Merge remote-tracking branch 'origin/1.20.1' into dt/ranged-inputs-tests
DilithiumThoride Sep 6, 2025
3f38312
i think the parallel logic has a problem
DilithiumThoride Sep 8, 2025
9012e0c
so apparently subtick overclocks exist and count as parallels
DilithiumThoride Sep 8, 2025
54ecae5
prepare for mass copypaste fluid conversion
DilithiumThoride Sep 8, 2025
b6bd44f
Mass copypaste fluid conversion
DilithiumThoride Sep 8, 2025
8c69b3d
Mass copypaste fluid conversion 2
DilithiumThoride Sep 9, 2025
4504f44
centralize recipe lists to try desperately to make LDLib stop being i…
DilithiumThoride Sep 9, 2025
5058036
Revert "centralize recipe lists to try desperately to make LDLib stop…
DilithiumThoride Sep 9, 2025
a728234
ldlib
DilithiumThoride Sep 9, 2025
3041371
Fluid tests disabled due to LDLib
DilithiumThoride Sep 10, 2025
bf7777a
Merge branch '1.20.1' into dt/ranged-inputs-tests
DilithiumThoride Sep 12, 2025
7cb3efd
Merge branch '1.20.1' into dt/ranged-inputs-tests
DilithiumThoride Sep 12, 2025
6683ba7
Merge branch '1.20.1' into dt/ranged-inputs-tests
jurrejelle Sep 14, 2025
9cc4f4f
Merge branch '1.20.1' into dt/ranged-inputs-tests
DilithiumThoride Sep 19, 2025
2a49e74
Alter test recipe creation to call main recipe registry to get slot c…
DilithiumThoride Sep 19, 2025
1151d73
Okay so all five Ranged Fluid Input tests fail but no others
DilithiumThoride Sep 19, 2025
ef1a5be
no
DilithiumThoride Sep 19, 2025
55c67d6
Merge branch '1.20.1' into dt/ranged-inputs-tests
DilithiumThoride Sep 24, 2025
c04b7ac
minor fixes before i make a new branch
DilithiumThoride Sep 24, 2025
8e259ad
Fix recipe search for Ranged Fluid Ingredients on 0 roll
DilithiumThoride Sep 25, 2025
1c05468
fix batch and parallel tests
DilithiumThoride Sep 25, 2025
ee9af11
spotless and remove todos
DilithiumThoride Sep 25, 2025
183d681
Revert and redo "Fix recipe search for Ranged Fluid Ingredients on 0 …
DilithiumThoride Sep 25, 2025
4aab71c
Do
DilithiumThoride Sep 25, 2025
bbcc071
add recipelookup tests
DilithiumThoride Sep 26, 2025
bc0f642
add basic recipe failure tests
DilithiumThoride Sep 26, 2025
c7dcf28
remove extraneous setupTicks and timeoutTicks
DilithiumThoride Oct 2, 2025
8be9f0a
add additional ranged ingredient base function tests
DilithiumThoride Oct 3, 2025
ab36f22
Something about .equals
DilithiumThoride Oct 3, 2025
7741436
modify IntProviderIngredient serializers to serialize sampledCount, a…
DilithiumThoride Oct 3, 2025
dd8436c
modify IntProviderFluidIngredient serializers to serialize sampledCou…
DilithiumThoride Oct 3, 2025
b8e62fb
spotlessApply is a literary device which
DilithiumThoride Oct 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)}
Expand All @@ -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:
* <ul>
Expand All @@ -175,6 +196,7 @@ public static IntProviderFluidIngredient of(FluidStack inner, int min, int max)
json.add("count_provider", IntProvider.CODEC.encodeStart(JsonOps.INSTANCE, countProvider)
.getOrThrow(false, GTCEu.LOGGER::error));
json.add("inner", inner.toJson());
json.addProperty("sampledCount", sampledCount);
return json;
}

Expand All @@ -192,8 +214,9 @@ public static IntProviderFluidIngredient fromJson(JsonElement json) {
JsonObject jsonObject = GsonHelper.convertToJsonObject(json, "ingredient");
IntProvider amount = IntProvider.CODEC.parse(JsonOps.INSTANCE, jsonObject.get("count_provider"))
.getOrThrow(false, GTCEu.LOGGER::error);
int sampledCount = jsonObject.getAsJsonPrimitive("sampledCount").getAsInt();
FluidIngredient inner = FluidIngredient.fromJson(jsonObject.get("inner"));
return new IntProviderFluidIngredient(inner, amount);
return new IntProviderFluidIngredient(inner, amount, sampledCount);
}

public CompoundTag toNBT() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ protected IntProviderIngredient(Ingredient inner, IntProvider countProvider) {
this.countProvider = countProvider;
}

protected IntProviderIngredient(Ingredient inner, IntProvider countProvider, int sampledCount) {
super(Stream.empty());
this.inner = inner;
this.countProvider = countProvider;
this.sampledCount = sampledCount;
}

/**
* @param inner {@link Ingredient}
* @param countProvider usually as {@link net.minecraft.util.valueproviders.UniformInt#of(int, int)}
Expand Down Expand Up @@ -92,7 +99,7 @@ public boolean test(@Nullable ItemStack stack) {
@Override
public ItemStack @NotNull [] getItems() {
if (itemStacks == null) {
int cachedCount = getSampledCount(GTValues.RNG);
int cachedCount = getSampledCount();
if (cachedCount == 0) {
return EMPTY_STACK_ARRAY;
}
Expand All @@ -117,6 +124,19 @@ public boolean test(@Nullable ItemStack stack) {
else return inner.getItems()[0].copyWithCount(countProvider.getMaxValue());
}

/**
* If this ingredient has not yet had its {@link IntProviderIngredient#sampledCount} rolled, rolls it and
* returns the roll.
* If it has, returns the existing roll.
* Passthrough method, invokes {@link IntProviderIngredient#getSampledCount(RandomSource)} using the threadsafe
* {@link GTValues#RNG}.
*
* @return the amount rolled
*/
public int getSampledCount() {
return getSampledCount(GTValues.RNG);
}

/**
* If this ingredient has not yet had its {@link IntProviderIngredient#sampledCount} rolled, rolls it and returns
* the roll.
Expand All @@ -139,6 +159,14 @@ public double getMidRoll() {
return ((countProvider.getMaxValue() + countProvider.getMinValue()) / 2.0);
}

/**
* Resets the random roll on this ingredient
*/
public void reroll() {
sampledCount = -1;
itemStacks = null;
}

@Override
public @NotNull IntList getStackingIds() {
return inner.getStackingIds();
Expand Down Expand Up @@ -182,31 +210,36 @@ public static IntProviderIngredient fromJson(JsonObject json) {
json.add("count_provider", IntProvider.CODEC.encodeStart(JsonOps.INSTANCE, countProvider)
.getOrThrow(false, GTCEu.LOGGER::error));
json.add("ingredient", inner.toJson());
json.addProperty("sampledCount", sampledCount);
return json;
}

public static final IIngredientSerializer<IntProviderIngredient> SERIALIZER = new IIngredientSerializer<>() {

@Override
public @NotNull IntProviderIngredient parse(FriendlyByteBuf buffer) {
IntProvider amount = IntProvider.CODEC.parse(NbtOps.INSTANCE, buffer.readNbt().get("provider"))
var nbt = buffer.readNbt();
IntProvider provider = IntProvider.CODEC.parse(NbtOps.INSTANCE, nbt.get("provider"))
.getOrThrow(false, GTCEu.LOGGER::error);
return new IntProviderIngredient(Ingredient.fromNetwork(buffer), amount);
int sampledCount = nbt.getInt("sampledCount");
return new IntProviderIngredient(Ingredient.fromNetwork(buffer), provider, sampledCount);
}

@Override
public @NotNull IntProviderIngredient parse(JsonObject json) {
IntProvider amount = IntProvider.CODEC.parse(JsonOps.INSTANCE, json.get("count_provider"))
IntProvider provider = IntProvider.CODEC.parse(JsonOps.INSTANCE, json.get("count_provider"))
.getOrThrow(false, GTCEu.LOGGER::error);
Ingredient inner = Ingredient.fromJson(json.get("ingredient"));
return new IntProviderIngredient(inner, amount);
int sampledCount = json.getAsJsonPrimitive("sampledCount").getAsInt();
return new IntProviderIngredient(inner, provider, sampledCount);
}

@Override
public void write(FriendlyByteBuf buffer, IntProviderIngredient ingredient) {
CompoundTag wrapper = new CompoundTag();
wrapper.put("provider", IntProvider.CODEC.encodeStart(NbtOps.INSTANCE, ingredient.countProvider)
.getOrThrow(false, GTCEu.LOGGER::error));
wrapper.putInt("sampledCount", ingredient.sampledCount);
buffer.writeNbt(wrapper);
ingredient.inner.toNetwork(buffer);
}
Expand Down
Loading