[1.7.10] Using the gas API in mods.
SmileycorpMC opened this issue ยท 5 comments
While working on creating a mod with mekanism support i ran into issues concerning the addition and usage of new gasses, using MDK 8.1.9.265.
NEI crashes the game if a gas isn't set to render properly, looking at the MekanismRenderer class, I thought I would just need to implement the onStitch event:
@SubscribeEvent
public void onStitch(TextureStitchEvent.Pre event)
{
if(event.map.getTextureType() == 0)
{
GasRegistry.getGas("siliconCarbide").setIcon(event.map.registerIcon("nuclearscience:silicongas"));
GasRegistry.getGas("carbonIron").setIcon(event.map.registerIcon("nuclearscience:pigirongas"));
System.out.println("[nsconstruction] stitched gas textures");
}
}
However in game no icon renders for the added gasses, and NEI crashes whenever a recipe using them is veiwed. Just to note the crash report was from a compiled version and not in the eclipse test environment.
Crash report:
https://pastebin.com/Na2s0MtF
I'm not familiar with the 1.7 branch, but on newer versions you simply need to register the gas before the Stitch happens, with a valid texture location set, and the registry should handle it for you.
That said, Mekanism 9 exists on 1.7
How would you set the texture location, I'm really new to using the API, and I can't find anything about this.
Would you know how to initiate the IIcon?
The way base mekanism does it is with event.map.registerIcon(), which is only called through the TextureStitchEvent.