Skip to content

Commit

Permalink
Extract method TinkerSmeltery::addMetalPatternCastingTableRecipe
Browse files Browse the repository at this point in the history
  • Loading branch information
YannickMG committed Jan 20, 2025
1 parent 97ce788 commit 0f4eb09
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 78 deletions.
86 changes: 26 additions & 60 deletions src/main/java/tconstruct/smeltery/TinkerSmeltery.java
Original file line number Diff line number Diff line change
Expand Up @@ -1011,18 +1011,7 @@ private void addRecipesForTableCasting() {

// Gem
ItemStack emerald = new ItemStack(Items.emerald);
tableCasting.addCastingRecipe(
gemcast,
new FluidStack(TinkerSmeltery.moltenAlubrassFluid, TConstruct.ingotLiquidValue),
emerald,
80);
if (!PHConstruct.removeGoldCastRecipes) {
tableCasting.addCastingRecipe(
gemcast,
new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
emerald,
80);
}
addMetalPatternCastingTableRecipe(tableCasting, gemcast, emerald, 80);

// Ingots
tableCasting.addCastingRecipe(
Expand Down Expand Up @@ -1146,16 +1135,10 @@ private void addRecipesForTableCasting() {
ItemStack clay_cast = new ItemStack(TinkerSmeltery.clayPattern, 1, iter + 1);

// Create metal casts from any existing part that could be melted
ItemStack part = new ItemStack(TinkerTools.patternOutputs[iter], 1, Short.MAX_VALUE);
tableCasting.addCastingRecipe(
addMetalPatternCastingTableRecipe(
tableCasting,
cast,
new FluidStack(TinkerSmeltery.moltenAlubrassFluid, TConstruct.ingotLiquidValue),
part,
50);
if (!PHConstruct.removeGoldCastRecipes) tableCasting.addCastingRecipe(
cast,
new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
part,
new ItemStack(TinkerTools.patternOutputs[iter], 1, Short.MAX_VALUE),
50);

for (int iterTwo = 0; iterTwo < TinkerSmeltery.liquids.length; iterTwo++) {
Expand Down Expand Up @@ -1200,29 +1183,14 @@ private void addRecipesForTableCasting() {
ItemStack[] ingotShapes = { new ItemStack(Items.brick), new ItemStack(Items.netherbrick),
new ItemStack(TinkerTools.materials, 1, 2), new ItemStack(TinkerTools.materials, 1, 37) };
for (ItemStack ingotShape : ingotShapes) {
tableCasting.addCastingRecipe(
ingotcast,
new FluidStack(TinkerSmeltery.moltenAlubrassFluid, TConstruct.ingotLiquidValue),
ingotShape,
50);
if (!PHConstruct.removeGoldCastRecipes) tableCasting.addCastingRecipe(
ingotcast,
new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
ingotShape,
50);
addMetalPatternCastingTableRecipe(tableCasting, ingotcast, ingotShape, 50);
}

ItemStack fullguardCast = new ItemStack(TinkerSmeltery.metalPattern, 1, 22);
ItemStack anyFullguardPart = new ItemStack(TinkerTools.fullGuard, 1, Short.MAX_VALUE);
tableCasting.addCastingRecipe(
fullguardCast,
new FluidStack(TinkerSmeltery.moltenAlubrassFluid, TConstruct.ingotLiquidValue),
anyFullguardPart,
50);
if (!PHConstruct.removeGoldCastRecipes) tableCasting.addCastingRecipe(
addMetalPatternCastingTableRecipe(
tableCasting,
fullguardCast,
new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
anyFullguardPart,
new ItemStack(TinkerTools.fullGuard, 1, Short.MAX_VALUE),
50);

// Golden Food Stuff
Expand Down Expand Up @@ -1386,6 +1354,22 @@ private void addRecipesForTableCasting() {
}
}

public static void addMetalPatternCastingTableRecipe(LiquidCasting tableCasting, ItemStack pattern, ItemStack shape,
int delay) {
tableCasting.addCastingRecipe(
pattern,
new FluidStack(TinkerSmeltery.moltenAlubrassFluid, TConstruct.ingotLiquidValue),
shape,
delay);
if (!PHConstruct.removeGoldCastRecipes) {
tableCasting.addCastingRecipe(
pattern,
new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
shape,
delay);
}
}

protected void addRecipesForBasinCasting() {
LiquidCasting basinCasting = TConstructRegistry.getBasinCasting();
// Block Casting
Expand Down Expand Up @@ -1921,16 +1905,7 @@ private void registerIngotCasting(FluidType ft, String name) {
for (ItemStack ore : OreDictionary.getOres(name)) {
// Allow making ingot cast with this ingot
ItemStack ingot = new ItemStack(ore.getItem(), 1, ore.getItemDamage());
tableCasting.addCastingRecipe(
pattern,
new FluidStack(TinkerSmeltery.moltenAlubrassFluid, TConstruct.ingotLiquidValue),
ingot,
50);
if (!PHConstruct.removeGoldCastRecipes) tableCasting.addCastingRecipe(
pattern,
new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
ingot,
50);
addMetalPatternCastingTableRecipe(tableCasting, pattern, ingot, 50);

// Allow casting this ingot using a metal ingot cast
tableCasting.addCastingRecipe(ingot, new FluidStack(ft.fluid, TConstruct.ingotLiquidValue), pattern, 80);
Expand All @@ -1951,16 +1926,7 @@ private void registerNuggetCasting(FluidType ft, String name) {
}
// Allow making nugget cast with this ingot
ItemStack nugget = new ItemStack(ore.getItem(), 1, ore.getItemDamage());
tableCasting.addCastingRecipe(
pattern,
new FluidStack(TinkerSmeltery.moltenAlubrassFluid, TConstruct.ingotLiquidValue),
nugget,
50);
if (!PHConstruct.removeGoldCastRecipes) tableCasting.addCastingRecipe(
pattern,
new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
nugget,
50);
addMetalPatternCastingTableRecipe(tableCasting, pattern, nugget, 50);

// Allow casting this nugget using a metal ingot cast
tableCasting.addCastingRecipe(nugget, new FluidStack(ft.fluid, TConstruct.nuggetLiquidValue), pattern, 40);
Expand Down
24 changes: 6 additions & 18 deletions src/main/java/tconstruct/weaponry/TinkerWeaponry.java
Original file line number Diff line number Diff line change
Expand Up @@ -274,16 +274,10 @@ private void addPartRecipies() {
ItemStack cast = new ItemStack(metalPattern, 1, i);
ItemStack clay_cast = new ItemStack(clayPattern, 1, i);

ItemStack part = new ItemStack(patternOutputs[i], 1, Short.MAX_VALUE);
tableCasting.addCastingRecipe(
cast,
new FluidStack(TinkerSmeltery.moltenAlubrassFluid, TConstruct.ingotLiquidValue),
part,
50);
if (!PHConstruct.removeGoldCastRecipes) tableCasting.addCastingRecipe(
TinkerSmeltery.addMetalPatternCastingTableRecipe(
tableCasting,
cast,
new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
part,
new ItemStack(patternOutputs[i], 1, Short.MAX_VALUE),
50);

for (int iterTwo = 0; iterTwo < TinkerSmeltery.liquids.length; iterTwo++) {
Expand Down Expand Up @@ -311,16 +305,10 @@ private void addPartRecipies() {
ItemStack cast = new ItemStack(TinkerSmeltery.metalPattern, 1, 25);
ItemStack clay_cast = new ItemStack(TinkerSmeltery.clayPattern, 1, 25);

ItemStack arrowHead = new ItemStack(arrowhead, 1, Short.MAX_VALUE);
tableCasting.addCastingRecipe(
cast,
new FluidStack(TinkerSmeltery.moltenAlubrassFluid, TConstruct.ingotLiquidValue),
arrowHead,
50);
if (!PHConstruct.removeGoldCastRecipes) tableCasting.addCastingRecipe(
TinkerSmeltery.addMetalPatternCastingTableRecipe(
tableCasting,
cast,
new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
arrowHead,
new ItemStack(arrowhead, 1, Short.MAX_VALUE),
50);

for (int iterTwo = 0; iterTwo < TinkerSmeltery.liquids.length; iterTwo++) {
Expand Down

0 comments on commit 0f4eb09

Please sign in to comment.