Skip to content

Commit

Permalink
Fix a couple cases of casting fluid to get the same result
Browse files Browse the repository at this point in the history
Wrought iron now requires plain iron as a base (no wrought from raw that means)
Tool casting now no longer matches if the input fluid produces the present material
Composite casting no longer matches if the material is unchanged, means we can turn wrought iron into oxidized iron and vice versa, but won't turn wrought iron into wrought iron
  • Loading branch information
KnightMiner committed May 19, 2024
1 parent 30f9366 commit 5fdfc97
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"amount": 250,
"tag": "mantle:water"
},
"input": "tconstruct:copper#default",
"input": "tconstruct:copper",
"output": "tconstruct:copper#oxidized",
"temperature": 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"amount": 250,
"tag": "mantle:water"
},
"input": "tconstruct:iron#default",
"input": "tconstruct:iron",
"output": "tconstruct:iron#oxidized",
"temperature": 1
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ public boolean matches(Fluid fluid) {

/** Checks if this recipe is valid for the given fluid and material */
public boolean matches(Fluid fluid, MaterialVariantId material) {
return matches(fluid) && (input == null || input.matchesVariant(material));
// disallow casting if the input material matches the output (including variant) to prevent wasted resources
return matches(fluid) && (input == null || input.matchesVariant(material)) && !output.sameVariant(material);
}

/** Gets the amount of fluid to cast this recipe */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ protected MaterialFluidRecipe getFluidRecipe(ICastingContainer inv) {
// the casting recipe needs to match our stat type to be valid
MaterialFluidRecipe casting = super.getFluidRecipe(inv);
// need to validate the stat type, since the super call will not check stat type
if (casting != MaterialFluidRecipe.EMPTY && requirements.get(indexToCheck).canUseMaterial(casting.getOutput().getId())) {
if (casting != MaterialFluidRecipe.EMPTY && !casting.getOutput().sameVariant(currentMaterial) && requirements.get(indexToCheck).canUseMaterial(casting.getOutput().getId())) {
cachedPartSwapping = casting;
return casting;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import slimeknights.tconstruct.fluids.TinkerFluids;
import slimeknights.tconstruct.library.data.recipe.IMaterialRecipeHelper;
import slimeknights.tconstruct.library.json.condition.TagDifferencePresentCondition;
import slimeknights.tconstruct.library.materials.definition.MaterialVariantId;
import slimeknights.tconstruct.library.recipe.FluidValues;
import slimeknights.tconstruct.library.recipe.casting.material.MaterialFluidRecipeBuilder;
import slimeknights.tconstruct.shared.TinkerCommons;
Expand Down Expand Up @@ -179,15 +178,15 @@ private void addMaterialSmeltery(Consumer<FinishedRecipe> consumer) {
materialComposite(consumer, MaterialIds.flint, MaterialIds.scorchedStone, TinkerFluids.magma, true, FluidValues.SLIMEBALL, folder);
materialComposite(consumer, MaterialIds.bone, MaterialIds.venombone, TinkerFluids.venom, false, FluidValues.SLIMEBALL, folder);
// decorative iron variant based on chain
materialComposite(consumer, MaterialIds.iron, MaterialIds.wroughtIron, TinkerFluids.moltenGlass, false, FluidValues.GLASS_PANE, folder);
materialComposite(consumer, MaterialIds.iron, MaterialIds.wroughtIron, TinkerFluids.moltenGlass, false, FluidValues.GLASS_PANE, folder);
// oxidize copper and iron via water, it does not rust iron because magic
MaterialFluidRecipeBuilder.material(MaterialIds.oxidizedIron)
.setInputId(MaterialVariantId.create(MaterialIds.iron, MaterialVariantId.DEFAULT_VARIANT))
.setInputId(MaterialIds.iron)
.setFluid(MantleTags.Fluids.WATER, FluidValues.BOTTLE)
.setTemperature(1)
.save(consumer, location(folder + "composite/iron_oxidized"));
MaterialFluidRecipeBuilder.material(MaterialIds.oxidizedCopper)
.setInputId(MaterialVariantId.create(MaterialIds.copper, MaterialVariantId.DEFAULT_VARIANT))
.setInputId(MaterialIds.copper)
.setFluid(MantleTags.Fluids.WATER, FluidValues.BOTTLE)
.setTemperature(1)
.save(consumer, location(folder + "composite/copper_oxidized"));
Expand Down

0 comments on commit 5fdfc97

Please sign in to comment.