aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/tinkers
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/tinkers')
-rw-r--r--src/main/java/gtPlusPlus/xmod/tinkers/HANDLER_Tinkers.java159
-rw-r--r--src/main/java/gtPlusPlus/xmod/tinkers/material/BaseTinkersMaterial.java473
-rw-r--r--src/main/java/gtPlusPlus/xmod/tinkers/util/TinkersDryingRecipe.java199
-rw-r--r--src/main/java/gtPlusPlus/xmod/tinkers/util/TinkersUtils.java1089
4 files changed, 960 insertions, 960 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/tinkers/HANDLER_Tinkers.java b/src/main/java/gtPlusPlus/xmod/tinkers/HANDLER_Tinkers.java
index 4a3f9cd504..25fa989551 100644
--- a/src/main/java/gtPlusPlus/xmod/tinkers/HANDLER_Tinkers.java
+++ b/src/main/java/gtPlusPlus/xmod/tinkers/HANDLER_Tinkers.java
@@ -1,7 +1,5 @@
package gtPlusPlus.xmod.tinkers;
-import java.lang.reflect.Field;
-
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
import gtPlusPlus.core.lib.LoadedMods;
@@ -9,97 +7,94 @@ import gtPlusPlus.core.util.reflect.ReflectionUtils;
import gtPlusPlus.xmod.tinkers.material.BaseTinkersMaterial;
import gtPlusPlus.xmod.tinkers.util.TinkersDryingRecipe;
import gtPlusPlus.xmod.tinkers.util.TinkersUtils;
+import java.lang.reflect.Field;
import net.minecraft.block.Block;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
public class HANDLER_Tinkers {
- public static AutoMap<BaseTinkersMaterial> mTinkerMaterials = new AutoMap<BaseTinkersMaterial>();
-
- public static final void preInit() {
- if (LoadedMods.TiCon) {
-
- }
- }
+ public static AutoMap<BaseTinkersMaterial> mTinkerMaterials = new AutoMap<BaseTinkersMaterial>();
- public static final void init() {
- if (LoadedMods.TiCon) {
+ public static final void preInit() {
+ if (LoadedMods.TiCon) {}
+ }
- }
- }
+ public static final void init() {
+ if (LoadedMods.TiCon) {}
+ }
- public static final void postInit() {
- if (LoadedMods.TiCon) {
+ public static final void postInit() {
+ if (LoadedMods.TiCon) {
- Fluid pyrotheumFluid = FluidRegistry.getFluid("pyrotheum");
- if (pyrotheumFluid != null) {
- //Enable Pyrotheum as Fuel for the Smeltery
- TinkersUtils.addSmelteryFuel(pyrotheumFluid, 5000, 70); // pyrotheum lasts 3.5 seconds per 15 mb
- }
+ Fluid pyrotheumFluid = FluidRegistry.getFluid("pyrotheum");
+ if (pyrotheumFluid != null) {
+ // Enable Pyrotheum as Fuel for the Smeltery
+ TinkersUtils.addSmelteryFuel(pyrotheumFluid, 5000, 70); // pyrotheum lasts 3.5 seconds per 15 mb
+ }
- //Generate Drying Rack recipes
- TinkersDryingRecipe.generateAllDryingRecipes();
-
- for (BaseTinkersMaterial y : mTinkerMaterials) {
- //y.generate();
- }
+ // Generate Drying Rack recipes
+ TinkersDryingRecipe.generateAllDryingRecipes();
- Class aTinkersSmeltery = ReflectionUtils.getClass("tconstruct.smeltery.TinkerSmeltery");
- AutoMap<Fluid> aTweakedFluids = new AutoMap<Fluid>();
- if (aTinkersSmeltery != null) {
- try {
- Logger.INFO("Manipulating the light levels of fluids in TiCon. Molten 'metals' in world are now very luminescent!");
- Field aFluidArrayField = ReflectionUtils.getField(aTinkersSmeltery, "fluids");
- Field aBlockArrayField = ReflectionUtils.getField(aTinkersSmeltery, "fluidBlocks");
- Fluid[] aTiconFluids = (Fluid[]) aFluidArrayField.get(null);
- Block[] aTiconFluidBlocks = (Block[]) aBlockArrayField.get(null);
- if (aTiconFluids != null && aTiconFluidBlocks != null) {
- for (Fluid a : aTiconFluids) {
- if (a == null) {
- continue;
- } else {
- if (a.getLuminosity() <= 15) {
- //if (a.getTemperature() >= 500) {
- a.setLuminosity(16);
- aTweakedFluids.put(a);
- //}
- } else {
- aTweakedFluids.put(a);
- continue;
- }
- }
- }
- for (Block a : aTiconFluidBlocks) {
- if (a == null) {
- continue;
- } else {
- Fluid f = FluidRegistry.lookupFluidForBlock(a);
- boolean isHot = false;
- if (f != null && f.getTemperature() >= 500) {
- if (f.getLuminosity() <= 16 && !aTweakedFluids.containsValue(f)) {
- f.setLuminosity(16);
- }
- isHot = true;
- }
- if (a.getLightValue() <= 16f) {
- if (isHot) {
- a.setLightLevel(16f);
- } else {
- if (a.getLightValue() <= 16f) {
- a.setLightLevel(16f);
- }
- }
- } else {
- continue;
- }
- }
- }
- }
- } catch (IllegalArgumentException | IllegalAccessException e) {
- }
- }
- }
- }
+ for (BaseTinkersMaterial y : mTinkerMaterials) {
+ // y.generate();
+ }
+ Class aTinkersSmeltery = ReflectionUtils.getClass("tconstruct.smeltery.TinkerSmeltery");
+ AutoMap<Fluid> aTweakedFluids = new AutoMap<Fluid>();
+ if (aTinkersSmeltery != null) {
+ try {
+ Logger.INFO(
+ "Manipulating the light levels of fluids in TiCon. Molten 'metals' in world are now very luminescent!");
+ Field aFluidArrayField = ReflectionUtils.getField(aTinkersSmeltery, "fluids");
+ Field aBlockArrayField = ReflectionUtils.getField(aTinkersSmeltery, "fluidBlocks");
+ Fluid[] aTiconFluids = (Fluid[]) aFluidArrayField.get(null);
+ Block[] aTiconFluidBlocks = (Block[]) aBlockArrayField.get(null);
+ if (aTiconFluids != null && aTiconFluidBlocks != null) {
+ for (Fluid a : aTiconFluids) {
+ if (a == null) {
+ continue;
+ } else {
+ if (a.getLuminosity() <= 15) {
+ // if (a.getTemperature() >= 500) {
+ a.setLuminosity(16);
+ aTweakedFluids.put(a);
+ // }
+ } else {
+ aTweakedFluids.put(a);
+ continue;
+ }
+ }
+ }
+ for (Block a : aTiconFluidBlocks) {
+ if (a == null) {
+ continue;
+ } else {
+ Fluid f = FluidRegistry.lookupFluidForBlock(a);
+ boolean isHot = false;
+ if (f != null && f.getTemperature() >= 500) {
+ if (f.getLuminosity() <= 16 && !aTweakedFluids.containsValue(f)) {
+ f.setLuminosity(16);
+ }
+ isHot = true;
+ }
+ if (a.getLightValue() <= 16f) {
+ if (isHot) {
+ a.setLightLevel(16f);
+ } else {
+ if (a.getLightValue() <= 16f) {
+ a.setLightLevel(16f);
+ }
+ }
+ } else {
+ continue;
+ }
+ }
+ }
+ }
+ } catch (IllegalArgumentException | IllegalAccessException e) {
+ }
+ }
+ }
+ }
}
diff --git a/src/main/java/gtPlusPlus/xmod/tinkers/material/BaseTinkersMaterial.java b/src/main/java/gtPlusPlus/xmod/tinkers/material/BaseTinkersMaterial.java
index 0d2c79db08..6aa2fe8931 100644
--- a/src/main/java/gtPlusPlus/xmod/tinkers/material/BaseTinkersMaterial.java
+++ b/src/main/java/gtPlusPlus/xmod/tinkers/material/BaseTinkersMaterial.java
@@ -2,14 +2,13 @@ package gtPlusPlus.xmod.tinkers.material;
import static gtPlusPlus.core.util.math.MathUtils.safeCast_LongToInt;
-import java.util.HashMap;
-
import cpw.mods.fml.common.event.FMLInterModComms;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.xmod.tinkers.HANDLER_Tinkers;
import gtPlusPlus.xmod.tinkers.util.TinkersUtils;
+import java.util.HashMap;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -17,258 +16,220 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.fluids.Fluid;
public class BaseTinkersMaterial {
-
-
-
- private static HashMap<String, Integer> aInternalMaterialIdMap = new HashMap<String, Integer>();
- private static int aNextFreeID;
-
- public final String mLocalName;
-
- private final String mUnlocalName;
- private final int mID;
- private final Material mMaterial;
-
- static {
- aNextFreeID = (Short.MAX_VALUE/2)+420;
- }
-
- public BaseTinkersMaterial(Material aMaterial) {
- mLocalName = aMaterial.getLocalizedName();
- mUnlocalName = "material.gtpp."+Utils.sanitizeString(mLocalName);
- mMaterial = aMaterial;
- mID = aNextFreeID++;
- Logger.INFO("[TiCon] Assigning ID "+mID+" to "+mLocalName+".");
- aInternalMaterialIdMap.put(mUnlocalName, mID);
- HANDLER_Tinkers.mTinkerMaterials.put(this);
- }
-
- public String getUnlocalName() {
- return mUnlocalName;
- }
-
- private static int calcDurability(Material aMaterial) {
- return safeCast_LongToInt(aMaterial.vDurability);
- }
-
- private static int calcMiningSpeed(Material aMaterial) {
- return (aMaterial.vHarvestLevel * 2)+aMaterial.vTier;
- }
-
- private static int calcHarvestLevel(Material aMaterial) {
- return aMaterial.vHarvestLevel;
- }
-
- private static int calcAttack(Material aMaterial) {
- return aMaterial.vHarvestLevel+aMaterial.vTier+aMaterial.vRadiationLevel;
- }
-
- private static float calcHandleModifier(Material aMaterial) {
- return 1f;
- }
-
- private static int calcReinforced(Material aMaterial) {
- return aMaterial.getMeltingPointC()/3600;
- }
-
- private static int calcBowProjectileSpeed(Material aMaterial) {
- return aMaterial.vHarvestLevel+2;
- }
-
- private static int calcBowDrawSpeed(Material aMaterial) {
- return aMaterial.vHarvestLevel+8;
- }
-
- private static float calcProjectileMass(Material aMaterial) {
- return (aMaterial.getMeltingPointC()/1800)*0.1f;
- }
-
- private static float calcProjectileFragility(Material aMaterial) {
- return 0f;
- }
-
- private static String calcStyle(Material aMaterial) {
- String aReturn = "" + EnumChatFormatting.WHITE;
- int aTemp = aMaterial.getMeltingPointC();
- if (aTemp < 3600) {
- aReturn = "" + EnumChatFormatting.WHITE;
- }
- else if (aTemp >= 3600) {
- aReturn = "" + EnumChatFormatting.YELLOW;
- }
- else if (aTemp >= (3600*2)) {
- aReturn = "" + EnumChatFormatting.GREEN;
- }
- else if (aTemp >= (3600*3)) {
- aReturn = "" + EnumChatFormatting.RED;
- }
- else if (aTemp >= (3600*4)) {
- aReturn = "" + EnumChatFormatting.DARK_RED;
- }
- else {
- aReturn = "" + EnumChatFormatting.GOLD;
- }
- return aReturn;
- }
-
- private static int calcColour(Material aMaterial) {
- return aMaterial.getRgbAsHex();
- }
-
- public Object generateToolMaterial(Material aMaterial) {
- int level, dura, speed, dmg, reinf, primColour;
- float handle, stonebound;
- level = calcHarvestLevel(aMaterial);
- dura = calcDurability(aMaterial);
- speed = calcMiningSpeed(aMaterial);
- dmg = calcAttack(aMaterial);
- reinf = calcReinforced(aMaterial);
- primColour = calcColour(aMaterial);
- handle = calcHandleModifier(aMaterial);
- //stonebound = calcHarvestLevel(aMaterial);
- stonebound = 0;
- return TinkersUtils.generateToolMaterial(aMaterial.getLocalizedName(), aMaterial.getUnlocalizedName(), level, dura, speed, dmg, handle, reinf, stonebound, calcStyle(aMaterial), primColour);
- }
-
- public void generate() {
-
- Logger.INFO("[TiCon] Trying to generate Material: "+mLocalName);
- int id = mID;
- if (id > 0) {
-
- //Object aTinkersCustomMaterial = generateToolMaterial(mMaterial);
- //Logger.INFO("[TiCon] Created Material: "+mLocalName);
-
- //TinkersUtils.addToolMaterial(id, aTinkersCustomMaterial);
- //TinkersUtils.addDefaultToolPartMaterial(id);
- //TinkersUtils.addBowMaterial(id, calcBowDrawSpeed(mMaterial), 1.0F);
- //TinkersUtils.addArrowMaterial(id, calcProjectileMass(mMaterial), calcProjectileFragility(mMaterial));
-
- NBTTagCompound tag = new NBTTagCompound();
- tag.setInteger("Id", id);
- tag.setString("Name", mUnlocalName);
- tag.setString("localizationString", mLocalName);
- tag.setInteger("Durability", calcDurability(mMaterial)); // 97
- tag.setInteger("MiningSpeed", calcMiningSpeed(mMaterial)); // 150
- tag.setInteger("HarvestLevel", calcHarvestLevel(mMaterial)); // 1
- tag.setInteger("Attack", calcAttack(mMaterial)); // 0
- tag.setFloat("HandleModifier", calcHandleModifier(mMaterial)); // 1.0f
- tag.setInteger("Reinforced", calcReinforced(mMaterial)); // 0
- tag.setFloat("Bow_ProjectileSpeed", calcBowProjectileSpeed(mMaterial)); // 3.0f
- tag.setInteger("Bow_DrawSpeed", calcBowDrawSpeed(mMaterial)); // 18
- tag.setFloat("Projectile_Mass", calcProjectileMass(mMaterial)); // 0.69f
- tag.setFloat("Projectile_Fragility", calcProjectileFragility(mMaterial)); // 0.2f
- tag.setString("Style", calcStyle(mMaterial));
- tag.setInteger("Color", calcColour(mMaterial));
-
-
- boolean generate = generateRecipes(mMaterial, id);
-
- if (generate) {
- Logger.INFO("[TiCon] Sending IMC: addMaterial - "+mLocalName+".");
- FMLInterModComms.sendMessage("TConstruct", "addMaterial", tag);
-
- ItemStack itemstack = mMaterial.getIngot(1);
- tag = new NBTTagCompound();
- tag.setInteger("MaterialId", id);
- NBTTagCompound item = new NBTTagCompound();
- itemstack.writeToNBT(item);
- tag.setTag("Item", item);
- tag.setInteger("Value", 2); // What is value for?
-
- Logger.INFO("[TiCon] Sending IMC: addPartBuilderMaterial - "+mLocalName+".");
- FMLInterModComms.sendMessage("TConstruct", "addPartBuilderMaterial", tag);
-
- tag = new NBTTagCompound();
- tag.setInteger("MaterialId", id);
- tag.setInteger("Value", 2); // What is value for?
- item = new NBTTagCompound();
- itemstack.writeToNBT(item);
- tag.setTag("Item", item);
-
- Logger.INFO("[TiCon] Sending IMC: addMaterialItem - "+mLocalName+".");
- FMLInterModComms.sendMessage("TConstruct", "addMaterialItem", tag);
- }
-
-
- }
-
- }
-
- private boolean generateRecipes(Material aMaterial, int aID) {
-
- Block aMatBlock;
- Integer aMelt;
- Fluid aFluid;
-
- try {
- aMatBlock = aMaterial.getBlock();
- aMelt = aMaterial.getMeltingPointC();
- aFluid = aMaterial.getFluidStack(0).getFluid();
- }
- catch (Throwable t) {
- return false;
- }
-
- if (aMatBlock == null || aMelt == null || aFluid == null) {
- return false;
- }
-
-
- //Smeltery.addMelting(new ItemStack(ExtraUtils.unstableIngot, 1, 0), ExtraUtils.decorative1, 5, 850, aMaterial.getFluid(72));
- TinkersUtils.registerFluidType(mLocalName, aMatBlock, 0, aMelt, aFluid, true);
- TinkersUtils.addMelting(aMaterial.getBlock(1), aMatBlock, 0, aMelt, aMaterial.getFluidStack(144*9));
- TinkersUtils.addMelting(aMaterial.getIngot(1), aMatBlock, 0, aMelt, aMaterial.getFluidStack(144));
- if (aMelt <= 3600) {
- ItemStack ingotcast = TinkersUtils.getPattern(1);
- TinkersUtils.addBasinRecipe(aMaterial.getBlock(1),
- aMaterial.getFluidStack(144*9), (ItemStack) null, true, 100);
- TinkersUtils.addCastingTableRecipe(aMaterial.getIngot(1),
- aMaterial.getFluidStack(144), ingotcast, false, 50);
- }
-
- boolean extended = TinkersUtils.generateCastingRecipes(aMaterial, aID);
-
-
-
-
-
-
- //TConstructRegistry.getBasinCasting().addCastingRecipe(new ItemStack(ExtraUtils.decorative1, 1, 5), new FluidStack(unstable, 1296), (ItemStack)null, true, 100);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- return true;
- }
-
-
-
-
-
-
-
+
+ private static HashMap<String, Integer> aInternalMaterialIdMap = new HashMap<String, Integer>();
+ private static int aNextFreeID;
+
+ public final String mLocalName;
+
+ private final String mUnlocalName;
+ private final int mID;
+ private final Material mMaterial;
+
+ static {
+ aNextFreeID = (Short.MAX_VALUE / 2) + 420;
+ }
+
+ public BaseTinkersMaterial(Material aMaterial) {
+ mLocalName = aMaterial.getLocalizedName();
+ mUnlocalName = "material.gtpp." + Utils.sanitizeString(mLocalName);
+ mMaterial = aMaterial;
+ mID = aNextFreeID++;
+ Logger.INFO("[TiCon] Assigning ID " + mID + " to " + mLocalName + ".");
+ aInternalMaterialIdMap.put(mUnlocalName, mID);
+ HANDLER_Tinkers.mTinkerMaterials.put(this);
+ }
+
+ public String getUnlocalName() {
+ return mUnlocalName;
+ }
+
+ private static int calcDurability(Material aMaterial) {
+ return safeCast_LongToInt(aMaterial.vDurability);
+ }
+
+ private static int calcMiningSpeed(Material aMaterial) {
+ return (aMaterial.vHarvestLevel * 2) + aMaterial.vTier;
+ }
+
+ private static int calcHarvestLevel(Material aMaterial) {
+ return aMaterial.vHarvestLevel;
+ }
+
+ private static int calcAttack(Material aMaterial) {
+ return aMaterial.vHarvestLevel + aMaterial.vTier + aMaterial.vRadiationLevel;
+ }
+
+ private static float calcHandleModifier(Material aMaterial) {
+ return 1f;
+ }
+
+ private static int calcReinforced(Material aMaterial) {
+ return aMaterial.getMeltingPointC() / 3600;
+ }
+
+ private static int calcBowProjectileSpeed(Material aMaterial) {
+ return aMaterial.vHarvestLevel + 2;
+ }
+
+ private static int calcBowDrawSpeed(Material aMaterial) {
+ return aMaterial.vHarvestLevel + 8;
+ }
+
+ private static float calcProjectileMass(Material aMaterial) {
+ return (aMaterial.getMeltingPointC() / 1800) * 0.1f;
+ }
+
+ private static float calcProjectileFragility(Material aMaterial) {
+ return 0f;
+ }
+
+ private static String calcStyle(Material aMaterial) {
+ String aReturn = "" + EnumChatFormatting.WHITE;
+ int aTemp = aMaterial.getMeltingPointC();
+ if (aTemp < 3600) {
+ aReturn = "" + EnumChatFormatting.WHITE;
+ } else if (aTemp >= 3600) {
+ aReturn = "" + EnumChatFormatting.YELLOW;
+ } else if (aTemp >= (3600 * 2)) {
+ aReturn = "" + EnumChatFormatting.GREEN;
+ } else if (aTemp >= (3600 * 3)) {
+ aReturn = "" + EnumChatFormatting.RED;
+ } else if (aTemp >= (3600 * 4)) {
+ aReturn = "" + EnumChatFormatting.DARK_RED;
+ } else {
+ aReturn = "" + EnumChatFormatting.GOLD;
+ }
+ return aReturn;
+ }
+
+ private static int calcColour(Material aMaterial) {
+ return aMaterial.getRgbAsHex();
+ }
+
+ public Object generateToolMaterial(Material aMaterial) {
+ int level, dura, speed, dmg, reinf, primColour;
+ float handle, stonebound;
+ level = calcHarvestLevel(aMaterial);
+ dura = calcDurability(aMaterial);
+ speed = calcMiningSpeed(aMaterial);
+ dmg = calcAttack(aMaterial);
+ reinf = calcReinforced(aMaterial);
+ primColour = calcColour(aMaterial);
+ handle = calcHandleModifier(aMaterial);
+ // stonebound = calcHarvestLevel(aMaterial);
+ stonebound = 0;
+ return TinkersUtils.generateToolMaterial(
+ aMaterial.getLocalizedName(),
+ aMaterial.getUnlocalizedName(),
+ level,
+ dura,
+ speed,
+ dmg,
+ handle,
+ reinf,
+ stonebound,
+ calcStyle(aMaterial),
+ primColour);
+ }
+
+ public void generate() {
+
+ Logger.INFO("[TiCon] Trying to generate Material: " + mLocalName);
+ int id = mID;
+ if (id > 0) {
+
+ // Object aTinkersCustomMaterial = generateToolMaterial(mMaterial);
+ // Logger.INFO("[TiCon] Created Material: "+mLocalName);
+
+ // TinkersUtils.addToolMaterial(id, aTinkersCustomMaterial);
+ // TinkersUtils.addDefaultToolPartMaterial(id);
+ // TinkersUtils.addBowMaterial(id, calcBowDrawSpeed(mMaterial), 1.0F);
+ // TinkersUtils.addArrowMaterial(id, calcProjectileMass(mMaterial), calcProjectileFragility(mMaterial));
+
+ NBTTagCompound tag = new NBTTagCompound();
+ tag.setInteger("Id", id);
+ tag.setString("Name", mUnlocalName);
+ tag.setString("localizationString", mLocalName);
+ tag.setInteger("Durability", calcDurability(mMaterial)); // 97
+ tag.setInteger("MiningSpeed", calcMiningSpeed(mMaterial)); // 150
+ tag.setInteger("HarvestLevel", calcHarvestLevel(mMaterial)); // 1
+ tag.setInteger("Attack", calcAttack(mMaterial)); // 0
+ tag.setFloat("HandleModifier", calcHandleModifier(mMaterial)); // 1.0f
+ tag.setInteger("Reinforced", calcReinforced(mMaterial)); // 0
+ tag.setFloat("Bow_ProjectileSpeed", calcBowProjectileSpeed(mMaterial)); // 3.0f
+ tag.setInteger("Bow_DrawSpeed", calcBowDrawSpeed(mMaterial)); // 18
+ tag.setFloat("Projectile_Mass", calcProjectileMass(mMaterial)); // 0.69f
+ tag.setFloat("Projectile_Fragility", calcProjectileFragility(mMaterial)); // 0.2f
+ tag.setString("Style", calcStyle(mMaterial));
+ tag.setInteger("Color", calcColour(mMaterial));
+
+ boolean generate = generateRecipes(mMaterial, id);
+
+ if (generate) {
+ Logger.INFO("[TiCon] Sending IMC: addMaterial - " + mLocalName + ".");
+ FMLInterModComms.sendMessage("TConstruct", "addMaterial", tag);
+
+ ItemStack itemstack = mMaterial.getIngot(1);
+ tag = new NBTTagCompound();
+ tag.setInteger("MaterialId", id);
+ NBTTagCompound item = new NBTTagCompound();
+ itemstack.writeToNBT(item);
+ tag.setTag("Item", item);
+ tag.setInteger("Value", 2); // What is value for?
+
+ Logger.INFO("[TiCon] Sending IMC: addPartBuilderMaterial - " + mLocalName + ".");
+ FMLInterModComms.sendMessage("TConstruct", "addPartBuilderMaterial", tag);
+
+ tag = new NBTTagCompound();
+ tag.setInteger("MaterialId", id);
+ tag.setInteger("Value", 2); // What is value for?
+ item = new NBTTagCompound();
+ itemstack.writeToNBT(item);
+ tag.setTag("Item", item);
+
+ Logger.INFO("[TiCon] Sending IMC: addMaterialItem - " + mLocalName + ".");
+ FMLInterModComms.sendMessage("TConstruct", "addMaterialItem", tag);
+ }
+ }
+ }
+
+ private boolean generateRecipes(Material aMaterial, int aID) {
+
+ Block aMatBlock;
+ Integer aMelt;
+ Fluid aFluid;
+
+ try {
+ aMatBlock = aMaterial.getBlock();
+ aMelt = aMaterial.getMeltingPointC();
+ aFluid = aMaterial.getFluidStack(0).getFluid();
+ } catch (Throwable t) {
+ return false;
+ }
+
+ if (aMatBlock == null || aMelt == null || aFluid == null) {
+ return false;
+ }
+
+ // Smeltery.addMelting(new ItemStack(ExtraUtils.unstableIngot, 1, 0), ExtraUtils.decorative1, 5, 850,
+ // aMaterial.getFluid(72));
+ TinkersUtils.registerFluidType(mLocalName, aMatBlock, 0, aMelt, aFluid, true);
+ TinkersUtils.addMelting(aMaterial.getBlock(1), aMatBlock, 0, aMelt, aMaterial.getFluidStack(144 * 9));
+ TinkersUtils.addMelting(aMaterial.getIngot(1), aMatBlock, 0, aMelt, aMaterial.getFluidStack(144));
+ if (aMelt <= 3600) {
+ ItemStack ingotcast = TinkersUtils.getPattern(1);
+ TinkersUtils.addBasinRecipe(
+ aMaterial.getBlock(1), aMaterial.getFluidStack(144 * 9), (ItemStack) null, true, 100);
+ TinkersUtils.addCastingTableRecipe(
+ aMaterial.getIngot(1), aMaterial.getFluidStack(144), ingotcast, false, 50);
+ }
+
+ boolean extended = TinkersUtils.generateCastingRecipes(aMaterial, aID);
+
+ // TConstructRegistry.getBasinCasting().addCastingRecipe(new ItemStack(ExtraUtils.decorative1, 1, 5), new
+ // FluidStack(unstable, 1296), (ItemStack)null, true, 100);
+
+ return true;
+ }
}
diff --git a/src/main/java/gtPlusPlus/xmod/tinkers/util/TinkersDryingRecipe.java b/src/main/java/gtPlusPlus/xmod/tinkers/util/TinkersDryingRecipe.java
index 8bc7ffef29..301302033e 100644
--- a/src/main/java/gtPlusPlus/xmod/tinkers/util/TinkersDryingRecipe.java
+++ b/src/main/java/gtPlusPlus/xmod/tinkers/util/TinkersDryingRecipe.java
@@ -1,9 +1,5 @@
package gtPlusPlus.xmod.tinkers.util;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.List;
-
import gregtech.api.enums.GT_Values;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.data.AutoMap;
@@ -11,110 +7,113 @@ import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.lib.LoadedMods;
import gtPlusPlus.core.recipe.common.CI;
import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import java.lang.reflect.Field;
+import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class TinkersDryingRecipe {
-
+
public static AutoMap<TinkersDryingRecipe> recipes = new AutoMap<TinkersDryingRecipe>();
- public final int time;
- public final ItemStack input;
- public final ItemStack result;
-
- public static void generateAllDryingRecipes() {
- List<?> aRecipes = TinkersUtils.getDryingRecipes();
- if (aRecipes != null && aRecipes.size() > 0) {
- for (Object o : aRecipes) {
- Logger.INFO("Trying to generate recipe using object of type "+o.getClass().getSimpleName());
- generateFromTinkersRecipeObject(o);
- }
- }
- else {
- Logger.INFO("Error generating Drying recipes, map was either null or empty. Null? "+(aRecipes != null)+", Size: "+aRecipes.size());
- }
- if (!recipes.isEmpty()) {
- Logger.INFO("Adding "+recipes.size()+" drying rack recipes to the dehydrator.");
- for (TinkersDryingRecipe r : recipes) {
- CORE.RA.addDehydratorRecipe(
- new ItemStack[] {
- CI.getNumberedCircuit(16),
- r.input
- },
- GT_Values.NF,
- GT_Values.NF,
- new ItemStack[] {r.result},
- new int[] {},
- r.time/10,
- 30);
- }
- }
- }
+ public final int time;
+ public final ItemStack input;
+ public final ItemStack result;
+
+ public static void generateAllDryingRecipes() {
+ List<?> aRecipes = TinkersUtils.getDryingRecipes();
+ if (aRecipes != null && aRecipes.size() > 0) {
+ for (Object o : aRecipes) {
+ Logger.INFO("Trying to generate recipe using object of type "
+ + o.getClass().getSimpleName());
+ generateFromTinkersRecipeObject(o);
+ }
+ } else {
+ Logger.INFO("Error generating Drying recipes, map was either null or empty. Null? " + (aRecipes != null)
+ + ", Size: " + aRecipes.size());
+ }
+ if (!recipes.isEmpty()) {
+ Logger.INFO("Adding " + recipes.size() + " drying rack recipes to the dehydrator.");
+ for (TinkersDryingRecipe r : recipes) {
+ CORE.RA.addDehydratorRecipe(
+ new ItemStack[] {CI.getNumberedCircuit(16), r.input},
+ GT_Values.NF,
+ GT_Values.NF,
+ new ItemStack[] {r.result},
+ new int[] {},
+ r.time / 10,
+ 30);
+ }
+ }
+ }
- public static TinkersDryingRecipe generateFromTinkersRecipeObject(Object o) {
- Field aTime;
- Field aInput;
- Field aOutput;
- Class aTinkerClass = ReflectionUtils.getClass("tconstruct.library.crafting.DryingRackRecipes.DryingRecipe");//o.getClass();
- if (aTinkerClass == null || !LoadedMods.TiCon) {
- Logger.INFO("Error generating Drying Recipe, could not find class. Exists? "+ReflectionUtils.doesClassExist("tconstruct.library.crafting.DryingRackRecipes.DryingRecipe"));
- Class clazz = ReflectionUtils.getClass("tconstruct.library.crafting.DryingRackRecipes");
- Class[] y = clazz.getDeclaredClasses();
- if (y == null || y.length <= 0) {
- Logger.INFO("No hidden inner classes.");
- return null;
- }
- else {
- boolean found = false;
- for (Class h : y) {
- Logger.INFO("Found hidden inner class: "+h.getCanonicalName());
- if (h.getSimpleName().toLowerCase().equals("dryingrecipe")) {
- Logger.INFO("Found correct recipe. Caching at correct location.");
- ReflectionUtils.mCachedClasses.put("tconstruct.library.crafting.DryingRackRecipes.DryingRecipe", h);
- aTinkerClass = h;
- found = true;
- break;
- }
- }
- if (!found) {
- return null;
- }
- }
- }
- aTime = ReflectionUtils.getField(aTinkerClass, "time");
- aInput = ReflectionUtils.getField(aTinkerClass, "input");
- aOutput = ReflectionUtils.getField(aTinkerClass, "result");
- try {
- int time_internal = aTime.getInt(o);
- ItemStack input_internal = (ItemStack) aInput.get(o);
- ItemStack result_internal = (ItemStack) aOutput.get(o);
- return new TinkersDryingRecipe(input_internal, time_internal, result_internal);
- } catch (Throwable b) {
- b.printStackTrace();
- }
- return null;
- }
+ public static TinkersDryingRecipe generateFromTinkersRecipeObject(Object o) {
+ Field aTime;
+ Field aInput;
+ Field aOutput;
+ Class aTinkerClass =
+ ReflectionUtils.getClass("tconstruct.library.crafting.DryingRackRecipes.DryingRecipe"); // o.getClass();
+ if (aTinkerClass == null || !LoadedMods.TiCon) {
+ Logger.INFO("Error generating Drying Recipe, could not find class. Exists? "
+ + ReflectionUtils.doesClassExist("tconstruct.library.crafting.DryingRackRecipes.DryingRecipe"));
+ Class clazz = ReflectionUtils.getClass("tconstruct.library.crafting.DryingRackRecipes");
+ Class[] y = clazz.getDeclaredClasses();
+ if (y == null || y.length <= 0) {
+ Logger.INFO("No hidden inner classes.");
+ return null;
+ } else {
+ boolean found = false;
+ for (Class h : y) {
+ Logger.INFO("Found hidden inner class: " + h.getCanonicalName());
+ if (h.getSimpleName().toLowerCase().equals("dryingrecipe")) {
+ Logger.INFO("Found correct recipe. Caching at correct location.");
+ ReflectionUtils.mCachedClasses.put(
+ "tconstruct.library.crafting.DryingRackRecipes.DryingRecipe", h);
+ aTinkerClass = h;
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ return null;
+ }
+ }
+ }
+ aTime = ReflectionUtils.getField(aTinkerClass, "time");
+ aInput = ReflectionUtils.getField(aTinkerClass, "input");
+ aOutput = ReflectionUtils.getField(aTinkerClass, "result");
+ try {
+ int time_internal = aTime.getInt(o);
+ ItemStack input_internal = (ItemStack) aInput.get(o);
+ ItemStack result_internal = (ItemStack) aOutput.get(o);
+ return new TinkersDryingRecipe(input_internal, time_internal, result_internal);
+ } catch (Throwable b) {
+ b.printStackTrace();
+ }
+ return null;
+ }
- public TinkersDryingRecipe(final ItemStack input, final int time, final ItemStack result) {
- this.time = time;
- this.input = input;
- this.result = result;
- Logger.INFO("Generating Drying Recipe. Input: "+input.getDisplayName()+", Output: "+result.getDisplayName());
- recipes.add(this);
- }
+ public TinkersDryingRecipe(final ItemStack input, final int time, final ItemStack result) {
+ this.time = time;
+ this.input = input;
+ this.result = result;
+ Logger.INFO(
+ "Generating Drying Recipe. Input: " + input.getDisplayName() + ", Output: " + result.getDisplayName());
+ recipes.add(this);
+ }
- public boolean matches(ItemStack input) {
- if (input.hasTagCompound()) {
- input = input.copy();
- input.getTagCompound().removeTag("frypanKill");
- if (input.getTagCompound().hasNoTags()) {
- input.setTagCompound((NBTTagCompound) null);
- }
- }
- return ItemStack.areItemStacksEqual(this.input, input);
- }
+ public boolean matches(ItemStack input) {
+ if (input.hasTagCompound()) {
+ input = input.copy();
+ input.getTagCompound().removeTag("frypanKill");
+ if (input.getTagCompound().hasNoTags()) {
+ input.setTagCompound((NBTTagCompound) null);
+ }
+ }
+ return ItemStack.areItemStacksEqual(this.input, input);
+ }
- public ItemStack getResult() {
- return this.result.copy();
- }
+ public ItemStack getResult() {
+ return this.result.copy();
+ }
}
diff --git a/src/main/java/gtPlusPlus/xmod/tinkers/util/TinkersUtils.java b/src/main/java/gtPlusPlus/xmod/tinkers/util/TinkersUtils.java
index cf3284bfae..2446eea9f1 100644
--- a/src/main/java/gtPlusPlus/xmod/tinkers/util/TinkersUtils.java
+++ b/src/main/java/gtPlusPlus/xmod/tinkers/util/TinkersUtils.java
@@ -1,5 +1,12 @@
package gtPlusPlus.xmod.tinkers.util;
+import gregtech.api.enums.Materials;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.api.objects.data.AutoMap;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
@@ -10,14 +17,6 @@ import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
-
-import gregtech.api.enums.Materials;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.api.objects.data.AutoMap;
-import gtPlusPlus.core.lib.LoadedMods;
-import gtPlusPlus.core.material.Material;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.core.util.reflect.ReflectionUtils;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -26,519 +25,565 @@ import net.minecraftforge.fluids.FluidStack;
public class TinkersUtils {
- private static final Class<?> mClass_Smeltery;
- private static final Class<?> mClass_TConstructRegistry;
- private static final Class<?> mClass_ToolMaterial;
- private static final Class<?> mClass_IPattern;
- private static final Class<?> mClass_DynamicToolPart;
- private static final Class<?> mClass_FluidType;
- private static final Class<?> mClass_CastingRecipe;
- private static final Class<?> mClass_TinkerSmeltery;
-
- private static final Field mField_MoltenIronFluid;
-
- private static final Method mMethod_getFluidType;
- private static final Method mMethod_getCastingRec