Open azacock opened 7 years ago
I've written a bit of a workaround:
import mods.minefantasy.Forge;
import mods.minefantasy.Anvil;
val mf_hot = <minefantasy2:MF_Hot_Item>;
val mf_bar = <minefantasy2:custom_bar>;
val hot_atlarus = mf_hot.withTag({MFHeatable_ItemSave: {id: 6026, Count: 1, Damage: 0}});
val hot_atlarus_ing = mf_hot.onlyWithTag({MFHeatable_ItemSave: {id: 6026, Count: 1, Damage: 0}});
val bar_atlarus = mf_bar.withTag({MF_CustomMaterials: {main_metal: "Atlarus"}, display: {Name:"Atlarus Bar"}});
val bar_atlarus_ing = mf_bar.onlyWithTag({MF_CustomMaterials: {main_metal: "Atlarus"}, display: {Name:"Atlarus Bar"}});
val hot_bar_atlarus_ing = mf_hot.onlyWithTag({MFHeatable_ItemSave: {id: 7864, Count: 1, Damage: 0, tag: {MF_CustomMaterials: {main_metal: "Atlarus"}}}});
Forge.addHeatableItem(<Metallurgy:atlarus.ingot>, 1500, 2000, 2500);
Forge.addHeatableItem(bar_atlarus_ing, 1500, 2000, 2500);
Anvil.addShapelessRecipe(<Metallurgy:atlarus.ingot>, "artisanry", "", true, 10.0, "hammer", 1, 1, 10, [hot_bar_atlarus_ing]);
Anvil.addShapelessRecipe(bar_atlarus, "artisanry", "", true, 10.0, "hammer", 1, 1, 10, [hot_atlarus_ing]);
This sort of works. I can heat ingots, craft them into bars, the bars are named correctly ("Atlarus Bar"), and the bars keep temperature metadata. The only remaining problem with this setup is that the heated bars are still named "Hot Any Bar".
Actually, it looks like there's yet more issues with my tweak. Unless I'm just using this incorrectly, it seems like the anvil recipes don't respect temperature: as long as the item is heated (to any temperature), the crafting will succeed. Even worse, if you're using a normal metal, like an iron ingot, and it's heated below it's workable temperature, attempting to make a bar with it will let you make, in this case, an atlarus bar.
I don't think there's any work around for this.
I written experimental handler, but it requires finalization (API methods will be changed slightly). Unfortunately, my PC are broken and i can't test code. If all works as i think you are can add custom materials "on the fly" (but don't remove it now) and manipulate with added and existing materials (change stats, tiers, color, etc).
Note: Now MF don't have any protection from programmer's mistakes, please, don't add unbreakable/meltable wood and leather materials, this can cause unpredictable events (North Korea missile stike, USSR reborn, world/item corruption)
MineFantasyII-2.8.14.3u.zip (don't forget to unzip)
MT script example:
import mods.minefantasy.CustomMaterial;
import mods.minefantasy.MaterialExpansion;
//Args: type (wood, leather, metal), name, tier, hardness, durability, flexibility, sharpness, resistance, density
CustomMaterial.addCustomMaterial("metal", "someMaterial", 4, 4.5, 6.0, 1.0, 4.0, 40.0, 2.5);
MaterialExpansion.setColor("someMaterial", 235, 244, 66);
MaterialExpansion.setMeltingPoint("someMaterial", 2000);
MaterialExpansion.setCrafterTiers("someMaterial", 6);
MaterialExpansion.setRarity("someMaterial", -1);
MaterialExpansion.setUnbreakable("someMaterial");
MaterialExpansion.setArmourStats("someMaterial", 1.0, 0.2, 0.8);
MaterialExpansion.modifyCraftTime("someMaterial", 5.0);
You can look into MF source code for default stats (minefantasy.mf2.material package). Also, ALL MF items can be crafted from added materials (axes, spears, armor, etc).
Sry me my english)
Hm... It seems to be partially working. Again, I'm testing this with an atlarus ingot from Metallurgy. After making a minetweaker script with those lines, I can see the MF2 metadata showing up on the atlarus ingot, showing the material tier, weight, and working temperatures. So that's fine.
But it doesn't seem to be heating up when placed in a forge. However, if I spawn in an Atlarus Bar from NEI, that heats up correctly in the forge.
Oh, and an unrelated issue is that the localization for the dynamically generated items appear as "material.atlarus.name Bar". You may need another function to set a proper display name for the material?
Altarus bar from creativetab can be heated and converted to ingot?
I'm forgot to add stats for ingots and hunks, try that build.
Tried the build, still not quite working. Here are some screenshots of the behavior I'm experiencing:
First one, the ingot does not become heated when added to the forge. Do I still need to add it with Forge.addHeatableItem()
?
Second, heated bars cannot be crafted back to the basic ingot. Also, you can see the issue with the name here.
Lastly, it seems like some crafting recipes, like hunks, aren't working properly:
This is the code I'm using:
import mods.minefantasy.CustomMaterial;
import mods.minefantasy.MaterialExpansion;
CustomMaterial.addCustomMaterial("metal", "atlarus", 4, 4.5, 6.0, 1.0, 4.0, 40.0, 2.5);
MaterialExpansion.setColor("atlarus", 235, 244, 66);
MaterialExpansion.setMeltingPoint("atlarus", 1500);
MaterialExpansion.setCrafterTiers("atlarus", 0);
MaterialExpansion.setRarity("atlarus", -1);
MaterialExpansion.setUnbreakable("atlarus");
MaterialExpansion.setArmourStats("atlarus", 1.0, 0.2, 0.8);
MaterialExpansion.modifyCraftTime("atlarus", 5.0);
I've toyed around with this a little more, and some of my problems were user error. The main problem was that I had the melting point set to 1500C. However, this meant the item had to be hotter than 1500C to be workable, meaning I couldn't get it hot enough in a coal-fueled forge. Setting the temperature lower fixed the issue, and I'm able to heat and craft using atlarus bars.
However, the issue with the way the way the name displays is still there. I also can't turn ingots into bars, or bars into ingots.
I've also noticed an issue adding recipes to the anvil with MineTweaker. It's possible I'm just doing it incorrectly, but I can't seem to add recipes that required heated bars or other heated materials.
Ingot issue will be fixed today. Name issue caused by translation system, temporary you can add material name into Minefantasy lang file.
Sounds good. I'll create a new issue for the anvil recipe issue, since it's really a totally unrelated problem
Was this ever resolved? Heavily interested in metallurgy integration.
The issue hasn't even been open for 2 weeks, dude.
Okay, so was anything done about it?
By the way, it's been 8 days.
Hey, Sirse. Let me know if this ever gets a fix. I'd be interested in using Metallurgy alongside MF.
I'm working on MF API changes, please, be patient.
MT API slightly changed. New example for adding new materials:
import mods.minefantasy.CustomMaterial;
CustomMaterial.addMaterial("metal", "Atlarus", 4, 4.5, 6.0, 1.0, 4.0, 40.0, 2.5).setColor(235, 244, 66).setMeltingPoint(1500).setCrafterTiers(0).setRarity(-1).setUnbreakable().setArmourStats(1.0, 0.2, 0.8).modifyCraftTime(5.0); //adds new material called "Altarus"
Also, you can modify any existing material (and grab materials and skills list with mt mf materials and mt mf skills commands):
mods.minefantasy.CustomMaterial.getMaterial("Steel").setColor(255, 255, 255);
About your problem - try use initRecipes() method. It will link altarus ingot from Metallurgy to MF altarus bar by oredict. Optional (try without it first) argument for initRecipes method - String value with oredict entry of ingot (grab it by mt hand command from Altarus ingot from metallurgy). E.g: CustomMaterial.addMaterial("metal", "Atlarus", 4, 4.5, 6.0, 1.0, 4.0, 40.0, 2.5).initRecipes("ingotAltarus");
I'm not tested API with other mods yet, this is very raw dev code.
MineFantasyII-2.8.14.3u.zip (UNZIP ME!)
Do these changes do anything to resolve #16? Just curious.
No. Anvil/Carpenter/Crucible recipe handlers written by other author and will be rewritten from scratch by right way (API changes required too, current recipe searching code are ambiguous and slow).
I'm currently trying to integrate Metallurgy and Tinkers Construct with MF2 using MineTweaker. Because of the way hot ingots and items are handled, I'm able to heat ingots, which is great. I'm also able to craft hot versions of TiC tool parts, which need to be quenched. Also great.
The problem is that I can't create bars of the modded metals. I tried to create, for example, a bar of Atlarus by adding the tag
{MF_CustomMaterials: {main_metal: "Atlarus"}}
to the base bar item, but that predictably failed. Presumably thatmain_metal
key is not dynamic and needs to be handled in the code. This breaks even more if the custom bar is heated, as it doesn't inherit its temperature stats from the ingot it's based on.