So you're browsing through the Minecraft Mods section of Minecraft Forums, rumaging through to find the best of the best, like NetherCraft, More Creeps and Weirdos, Mo'Creatures, and others. You begin installing all required mods, the actual mods, then run your handy errortest.bat, just to run into another 'no more empty item sprite inidices!' error. This is your best solution, since it hooks into ModLoader's addOverride method (for items only) to one of nine blank sprite sheets when the original items.png file is full. If you would like to use this alongside Forge API, you must download the patch, first.
public class mod_RegenOres extends BaseMod
ironNugget = (new ItemTexture(ironNuggetID, "/regen-ores/items.png")).setIconCoord(12,2).setItemName("ironNugget");
goldNugget = (new ItemTexture(goldNuggetID, "/regen-ores/items.png")).setItemName("ironNugget");
goldNugget.iconIndex = 43;
//Note that the ironNugget is in place of the iron door, and goldNugget is in place of the wooden door if these items were using the original /gui/items.png file.
//Also, note that changing your mod's code is obsolete, because v4.0 introduces an increased item-sprite limit (increased from 256 to 2560) that works whenever ModLoader.addOverride is used for item textures. This does NOT affect terrain sprites.
===ITEMS THAT USE DIFFERENT ITEMS.PNGS===
It is extremely easy to create an item that will use a new items.png-type image file with ItemSprite API. Simply use 'ItemTexture', and declare the path of the items.png-type file, then use '.setIconCoord(int i, int j)' to declare the position on the file. You may also use the 'blockIndexInTexture' method to declare the position, as seen with the goldNugget. Using this method will NOT use any item sprites, meaning you can have unlimited* numbers of items.
* - Here, unlimited means 32,000, the max item limit.
===IMPLEMENTING IITEMTEXTURE TO CUSTOM ITEM FILES===
In this example, I will show you how to convert an Item file to use the same method as ItemCT.
Here is the custom Item file that we are dealing with:*/
1. public class ItemHoe extends Item
2. implements IItemTexture
4. public ItemHoe(int i, EnumToolMaterial enumtoolmaterial)
7. maxStackSize = 1;
11. public String getTextureFile()
13. return "/regen-ores/items.png";
As you can see, I am using a modified ItemHoe (removed some code so it isn't as lengthy). Notice line #2, and notice the 'getTextureFile()' method (line #11-14) as well. This is all you must add to create a custom item that will use a custom items.png-type file!
v4.0 - Added feature: increased item-sprite limit without requiring code changes from modders.
v3.0 - Updated to 1.0.0
v2.0 - Updated to Beta 1.8.1. Released the source files as well.
v1.2 - First public release. Fixed render texture obtained from the ItemRenderer.class (handles item textures that appear in the player's hand.
v1.1 - Now uses an Interface for texture paths, instead of altering Item.class.
v1.0 - Initial release, for Beta 1.7.3.