Friday, September 6, 2013

Forge - Correct Use of ResourceLocation

After Minecraft updated to version 1.6, Forge did some changes to the GUI texture loading.  Thankfully, it's considerably easier to bundle all manner of resources, but unfortunately more complicated to set up the addresses.  They reverted bindTexture to func_110577_a and changed its argument to a ResourceLocation instance.  Such an instance can be easily created with one or two strings.  Important note: You should use only the one-string constructor; the two-string one will only work when launching from Eclipse.  That string is of the format "modname:textures/gui/filename.png".  So, for my Absorber, I would create the ResourceLocation like so: "new ResourceLocation("higherpower:textures/gui/absorber.png)".  Notice that the mod ID is now required to be in all lowercase.  While developing, place your mod's assets folder under the src folder.

No comments:

Post a Comment