Allow overriding AluminumBrass as the metal pattern material (#147)

This commit is contained in:
Yannick Marcotte-Gourde authored and GitHub committed 2025-01-21 16:18:00 -06:00
1 parent dd799e62b3
commit 0696b0fdfe
4 files changed
+68 -145

No files matched your search

@@ -1,6 +1,5 @@
package tconstruct.library;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -13,6 +12,7 @@ import net.minecraft.item.ItemStack;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import tconstruct.TConstruct;
import tconstruct.library.crafting.Detailing;
import tconstruct.library.crafting.LiquidCasting;
import tconstruct.library.crafting.ToolBuilder;
@@ -508,62 +508,16 @@ public class TConstructRegistry {
return null;
}
/*
* public static CustomMaterial getCustomMaterial(ItemStack input, ItemStack pattern) { for (CustomMaterial mat :
* customMaterials) { if (mat.matches(input, pattern)) return mat; } return null; }
*/
/*
* public static ItemStack craftBowString(ItemStack stack) { if (stack.stackSize < 3) return null; for
* (BowstringMaterial mat : bowstringMaterials) { if (stack.isItemEqual(mat.input)) return mat.craftingItem.copy();
* } return null; } public static BowstringMaterial getBowstringMaterial(ItemStack stack) { if (stack.stackSize < 3)
* return null; for (BowstringMaterial mat : bowstringMaterials) { if (stack.isItemEqual(mat.input)) return mat; }
* return null; }
*/
public static LiquidCasting getTableCasting() {
return instance.tableCasting();
}
LiquidCasting tableCasting() {
try {
Class<?> clazz = Class.forName("tconstruct.TConstruct");
Method method = clazz.getMethod("getTableCasting");
return (LiquidCasting) method.invoke(this);
} catch (Exception e) {
logger.warn("Could not find casting table recipes.");
return null;
}
return TConstruct.getTableCasting();
}
public static LiquidCasting getBasinCasting() {
return instance.basinCasting();
}
LiquidCasting basinCasting() {
try {
Class<?> clazz = Class.forName("tconstruct.TConstruct");
Method method = clazz.getMethod("getBasinCasting");
return (LiquidCasting) method.invoke(this);
} catch (Exception e) {
logger.warn("Could not find casting basin recipes.");
return null;
}
return TConstruct.getBasinCasting();
}
public static Detailing getChiselDetailing() {
return instance.chiselDetailing();
}
Detailing chiselDetailing() {
try {
Class<?> clazz = Class.forName("tconstruct.TConstruct");
Method method = clazz.getMethod("getChiselDetailing");
return (Detailing) method.invoke(this);
} catch (Exception e) {
logger.warn("Could not find chisel detailing recipes.");
return null;
}
return TConstruct.getChiselDetailing();
}
public static ArrayList<ActiveToolMod> activeModifiers = new ArrayList<>();
@@ -188,6 +188,7 @@ public class TinkerSmeltery {
public static Block speedBlock;
public static Fluid bloodFluid;
public static Block blood;
private static FluidType metalPatternFluidType;
@Handler
public void preInit(FMLPreInitializationEvent event) {
@@ -608,6 +609,7 @@ public class TinkerSmeltery {
@Handler
public void init(FMLInitializationEvent event) {
proxy.initialize();
loadMetalPatternMaterial();
craftingTableRecipes();
addRecipesForSmeltery();
addRecipesForTableCasting();
@@ -621,6 +623,10 @@ public class TinkerSmeltery {
modIntegration();
}
private static void loadMetalPatternMaterial() {
metalPatternFluidType = FluidType.getFluidType(PHConstruct.metalCastFluidTypeName);
}
private void craftingTableRecipes() {
String[] patSurround = { "###", "#m#", "###" };
@@ -1000,25 +1006,19 @@ public class TinkerSmeltery {
// Blank
tableCasting.addCastingRecipe(
new ItemStack(TinkerTools.blankPattern, 1, 1),
new FluidStack(TinkerSmeltery.moltenAlubrassFluid, TConstruct.ingotLiquidValue),
80);
tableCasting.addCastingRecipe(
gemcast,
new FluidStack(TinkerSmeltery.moltenAlubrassFluid, TConstruct.ingotLiquidValue),
new ItemStack(Items.emerald),
new FluidStack(metalPatternFluidType.fluid, TConstruct.ingotLiquidValue),
80);
if (!PHConstruct.removeGoldCastRecipes) {
tableCasting.addCastingRecipe(
new ItemStack(TinkerTools.blankPattern, 1, 2),
new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
80);
tableCasting.addCastingRecipe(
gemcast,
new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
new ItemStack(Items.emerald),
80);
}
// Gem
ItemStack emerald = new ItemStack(Items.emerald);
addMetalPatternCastingTableRecipe(tableCasting, gemcast, emerald, 80);
// Ingots
tableCasting.addCastingRecipe(
new ItemStack(TinkerTools.materials, 1, 2),
@@ -1140,17 +1140,11 @@ public class TinkerSmeltery {
ItemStack cast = new ItemStack(TinkerSmeltery.metalPattern, 1, iter + 1);
ItemStack clay_cast = new ItemStack(TinkerSmeltery.clayPattern, 1, iter + 1);
tableCasting.addCastingRecipe(
// Create metal casts from any existing part that could be melted
addMetalPatternCastingTableRecipe(
tableCasting,
cast,
new FluidStack(TinkerSmeltery.moltenAlubrassFluid, TConstruct.ingotLiquidValue),
new ItemStack(TinkerTools.patternOutputs[iter], 1, Short.MAX_VALUE),
false,
50);
if (!PHConstruct.removeGoldCastRecipes) tableCasting.addCastingRecipe(
cast,
new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
new ItemStack(TinkerTools.patternOutputs[iter], 1, Short.MAX_VALUE),
false,
50);
for (int iterTwo = 0; iterTwo < TinkerSmeltery.liquids.length; iterTwo++) {
@@ -1195,32 +1189,14 @@ public class TinkerSmeltery {
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,
false,
50);
if (!PHConstruct.removeGoldCastRecipes) tableCasting.addCastingRecipe(
ingotcast,
new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
ingotShape,
false,
50);
addMetalPatternCastingTableRecipe(tableCasting, ingotcast, ingotShape, 50);
}
ItemStack fullguardCast = new ItemStack(TinkerSmeltery.metalPattern, 1, 22);
tableCasting.addCastingRecipe(
addMetalPatternCastingTableRecipe(
tableCasting,
fullguardCast,
new FluidStack(TinkerSmeltery.moltenAlubrassFluid, TConstruct.ingotLiquidValue),
new ItemStack(TinkerTools.fullGuard, 1, Short.MAX_VALUE),
false,
50);
if (!PHConstruct.removeGoldCastRecipes) tableCasting.addCastingRecipe(
fullguardCast,
new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
new ItemStack(TinkerTools.fullGuard, 1, Short.MAX_VALUE),
false,
50);
// Golden Food Stuff
@@ -1384,6 +1360,22 @@ public class TinkerSmeltery {
}
}
public static void addMetalPatternCastingTableRecipe(LiquidCasting tableCasting, ItemStack pattern, ItemStack shape,
int delay) {
tableCasting.addCastingRecipe(
pattern,
new FluidStack(metalPatternFluidType.fluid, 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
@@ -1663,11 +1655,17 @@ public class TinkerSmeltery {
// Items
Smeltery.addMelting(
FluidType.getFluidType("AluminumBrass"),
metalPatternFluidType,
new ItemStack(TinkerTools.blankPattern, 4, 1),
-50,
TConstruct.ingotLiquidValue);
Smeltery.addMelting(gold, new ItemStack(TinkerTools.blankPattern, 4, 2), -50, TConstruct.ingotLiquidValue * 2);
if (!PHConstruct.removeGoldCastRecipes) {
Smeltery.addMelting(
gold,
new ItemStack(TinkerTools.blankPattern, 4, 2),
-50,
TConstruct.ingotLiquidValue * 2);
}
Smeltery.addMelting(
FluidType.getFluidType("Glue"),
new ItemStack(TinkerTools.materials, 1, 36),
@@ -1911,24 +1909,12 @@ public class TinkerSmeltery {
ItemStack pattern = new ItemStack(TinkerSmeltery.metalPattern, 1, 0);
LiquidCasting tableCasting = TConstructRegistry.getTableCasting();
for (ItemStack ore : OreDictionary.getOres(name)) {
tableCasting.addCastingRecipe(
pattern,
new FluidStack(TinkerSmeltery.moltenAlubrassFluid, TConstruct.ingotLiquidValue),
new ItemStack(ore.getItem(), 1, ore.getItemDamage()),
false,
50);
if (!PHConstruct.removeGoldCastRecipes) tableCasting.addCastingRecipe(
pattern,
new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
new ItemStack(ore.getItem(), 1, ore.getItemDamage()),
false,
50);
// Allow making ingot cast with this ingot
ItemStack ingot = new ItemStack(ore.getItem(), 1, ore.getItemDamage());
addMetalPatternCastingTableRecipe(tableCasting, pattern, ingot, 50);
tableCasting.addCastingRecipe(
new ItemStack(ore.getItem(), 1, ore.getItemDamage()),
new FluidStack(ft.fluid, TConstruct.ingotLiquidValue),
pattern,
80);
// Allow casting this ingot using a metal ingot cast
tableCasting.addCastingRecipe(ingot, new FluidStack(ft.fluid, TConstruct.ingotLiquidValue), pattern, 80);
}
}
@@ -1944,24 +1930,12 @@ public class TinkerSmeltery {
if (isOreberry) continue;
}
tableCasting.addCastingRecipe(
pattern,
new FluidStack(TinkerSmeltery.moltenAlubrassFluid, TConstruct.ingotLiquidValue),
new ItemStack(ore.getItem(), 1, ore.getItemDamage()),
false,
50);
if (!PHConstruct.removeGoldCastRecipes) tableCasting.addCastingRecipe(
pattern,
new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
new ItemStack(ore.getItem(), 1, ore.getItemDamage()),
false,
50);
// Allow making nugget cast with this ingot
ItemStack nugget = new ItemStack(ore.getItem(), 1, ore.getItemDamage());
addMetalPatternCastingTableRecipe(tableCasting, pattern, nugget, 50);
tableCasting.addCastingRecipe(
new ItemStack(ore.getItem(), 1, ore.getItemDamage()),
new FluidStack(ft.fluid, TConstruct.nuggetLiquidValue),
pattern,
40);
// Allow casting this nugget using a metal ingot cast
tableCasting.addCastingRecipe(nugget, new FluidStack(ft.fluid, TConstruct.nuggetLiquidValue), pattern, 40);
}
}
@@ -315,6 +315,12 @@ public class PHConstruct {
new String[] { "wanion.avaritiaddons.block.chest.infinity.TileEntityInfinityChest" })
.getStringList());
metalCastFluidTypeName = config.get(
"CrossmodInteractions",
"Metal cast FluidType",
"AluminumBrass",
"For pack maintainers. Defines the LiquidType used to create metal casts.").getString();
/* Save the configuration file only if it has changed */
if (config.hasChanged()) config.save();
@@ -508,4 +514,7 @@ public class PHConstruct {
public static boolean extraBlockUpdates;
public static String[] heartDropBlacklist;
public static Set<String> craftingStationBlacklist;
// Crossmod interactions
public static String metalCastFluidTypeName;
}
@@ -274,17 +274,10 @@ public class TinkerWeaponry {
ItemStack cast = new ItemStack(metalPattern, 1, i);
ItemStack clay_cast = new ItemStack(clayPattern, 1, i);
tableCasting.addCastingRecipe(
TinkerSmeltery.addMetalPatternCastingTableRecipe(
tableCasting,
cast,
new FluidStack(TinkerSmeltery.moltenAlubrassFluid, TConstruct.ingotLiquidValue),
new ItemStack(patternOutputs[i], 1, Short.MAX_VALUE),
false,
50);
if (!PHConstruct.removeGoldCastRecipes) tableCasting.addCastingRecipe(
cast,
new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
new ItemStack(patternOutputs[i], 1, Short.MAX_VALUE),
false,
50);
for (int iterTwo = 0; iterTwo < TinkerSmeltery.liquids.length; iterTwo++) {
@@ -312,17 +305,10 @@ public class TinkerWeaponry {
ItemStack cast = new ItemStack(TinkerSmeltery.metalPattern, 1, 25);
ItemStack clay_cast = new ItemStack(TinkerSmeltery.clayPattern, 1, 25);
tableCasting.addCastingRecipe(
TinkerSmeltery.addMetalPatternCastingTableRecipe(
tableCasting,
cast,
new FluidStack(TinkerSmeltery.moltenAlubrassFluid, TConstruct.ingotLiquidValue),
new ItemStack(arrowhead, 1, Short.MAX_VALUE),
false,
50);
if (!PHConstruct.removeGoldCastRecipes) tableCasting.addCastingRecipe(
cast,
new FluidStack(TinkerSmeltery.moltenGoldFluid, TConstruct.ingotLiquidValue * 2),
new ItemStack(arrowhead, 1, Short.MAX_VALUE),
false,
50);
for (int iterTwo = 0; iterTwo < TinkerSmeltery.liquids.length; iterTwo++) {