Instead of flooding the Forge IRC with this questions for weeks to come, why not offer a tutorial? (Just kidding the channel will be overrun...)
Anyway. 1.5 completely changes the way mc handles textures, and your pre-1.5 mods will require significant file format and code changes. The transition can be a bit harsh, but I'll outline it for you.
Major changes:
- all Block and Item Textures are now kept in seperate (default 16x16 px) files
- the textures have to be in specific folders in your mod archive
- your Block and Item classes need to override a new method to specify their texture files
- all Block and Item Textures can be animated without additional code (see vanilla lava/water)
- getTexture, setTexture and any Icon Index related methods are consequently gone (or do nothing)
- you no longer need to preload textures
What stayed the same:
- Entity Render models. No change.
- Block sides are still handled in code as seperate textures
Procedure:
1)
Use image editing software (such as GIMP) to split all your block/item texture files in such a way that each 16x16 Item/Block texture is saved as a new, seperate file. png format with transparency! Useful names are useful.
2)
Prepare your textures in the new folder structure. From the base of your mod archive, they have to be at:
/mods/YOURMODNAMEHERE/textures/blocks/ for Block textures
/mods/YOURMODNAMEHERE/textures/items/ for Item textures
/mods/YOURMODNAMEHERE/textures/gui/ for your GUI screens
/mods/YOURMODNAMEHERE/textures/models/ for your entities (this one is optional)
with YOURMODNAMEHERE being your mod's descriptor. Just make sure what you choose here matches what you put in code. Since the Entities still work the old style that one is optional.
3) TO THE CODE
- remove any setTexture, getTexture methods from your Item/Block classes
- remove any iconIndex related code, from the constructors too
- find the new public void methods in Item/Block classes that take IconRegister as parameter
- right now they have the names func_94332_a and func_94581_a, but that will change after the first MCP update
- in MCP 1.5.1 the names are updateIcons in Item and registerIcons for Block
- in these methods, set the protected "Icon" field (currently named iconIndex, will change) using the method returning Icon in IconRegister (currently named func_94245_a, will change)
- in MCP 1.5.1, the fields are blockIcon and iconIndex, the method is registerIcon
- the method takes a String parameter. That string is "YOURMODNAMEHERE:FILENAME", in other words your mod descriptor, a colon, and the file name of the texture file without the ending.
- GUIs do not need texture specific code. Just make sure the filename matches the GUI class name
An example:
public class ItemHookShotCartridge extends Item
{
public ItemHookShotCartridge(int id)
{
super(id);
}
@Override
public void updateIcons(IconRegister iconRegister)
{
iconIndex = iconRegister.registerIcon("ropesplus:hscartridge");
}
}
The texture file being selected is located at /mods/ropesplus/textures/items/hscartridge.png
The Block/Item distinction is being made by mc itself.
Another example:
public class BlockGrapplingHook extends Block
{
public BlockGrapplingHook(int i)
{
super(i, Material.wood);
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
}
The texture file being selected is located at /mods/ropesplus/textures/blocks/blockGrapplingHook.png
And that's it! Your Items and Blocks should render. In the long run, this is going to make things a LOT easier.
Finally, Block sides. The old methods are still in place, but instead of an Icon Index they now return instances of "Icon". I'll just slap you with them:
// this one deals with in-world textures
@Override
public Icon getBlockTexture(IBlockAccess world, int x, int y, int z, int blockSide)
// this one does inventory rendering
@Override
public Icon getBlockTextureFromSideAndMetadata(int blockSide, int blockMeta)
For this to work, you will have to use the IconRegister method in Block and save the Icon returns you get from the Icon-returning method, to be returned here. If you want to see an actual examples, check out these:
Or other big open source mods as soon as they update (Buildcraft, Equivalent Exchange...)
Should you still have questions, by all means do not ask me. Go to the forge forums, the forge IRC channel, and get helped there.
Addendum #1
Stahp using modloader ... just STAHP
Compass and Clock work completely different now. If you check out their texture images, you'll notice a series of needle/pointer positions is saved as "animation" in the texture. The code now simply selects the fitting "animation" for the angle/time of day.
Edit #2
Added 1.5.1 deobfuscated names. They are terrible choices, IMO.
The folder to use in eclipse is /src/minecraft/mods/.....
Alright, when I put the /mods/whatever folder there with the correctly named textures, my mod finds them (it no longer says "...but that file does not exist. Ignoring." anymore) but the textures show up as white background, black text 'missing texture' textures instead of flowers. xD
Alright, when I put the /mods/whatever folder there with the correctly named textures, my mod finds them (it no longer says "...but that file does not exist. Ignoring." anymore) but the textures show up as white background, black text 'missing texture' textures instead of flowers. xD
I seem to be having the exact same problem. I've tried having my MODNAME folder as a folder, a rar file, and a zip file, and none of them seem to work.
with YOURMODNAMEHERE being your mod's descriptor. Just make sure what you choose here matches what you put in code. Since the Entities still work the old style that one is optional.
What do you mean by "Just make sure what you choose here matches what you put in code"? I assume you just mean this line of code:
but I'm just kind of grasping at any possible mistakes I could have made.
Here is my method:
@Override
public void func_94581_a(IconRegister iconRegister){
iconIndex = iconRegister.func_94245_a("mod_ocarina:ocarina");
}
And here is the error I keep getting:
2013-03-12 23:07:18 [WARNING] [Minecraft-Client] TextureManager.createTexture called for file mods/mod_ocarina/textures/items/ocarina.png, but that file does not exist. Ignoring.
My image is at that address, yet it seems like it can't find it.
If you get that error, the mc instance cannot find the file at the specified path relative to itself. Did you refresh your eclipse workspace? Try reobfuscating and using your mod in an actual mc.
If you get that error, the mc instance cannot find the file at the specified path relative to itself. Did you refresh your eclipse workspace? Try reobfuscating and using your mod in an actual mc.
Okay, I figured out what I was doing wrong. I assumed the mods folder you were referring to was the actual mods folder in the minecraft directory. But its really a folder you have to create inside your zip folder.
Thanks for posting this, I have my mod almost fully converted except a few things. Can you please put examples of how to change the textures on logs and leafs?
Thanks for posting this, I have my mod almost fully converted except a few things. Can you please put examples of how to change the textures on logs and leafs?
For example the Log file has these two parts of code:
I may be overlooking it, but can you show me on that code? Would be much appreciated
In the IconRegister method, the various Icons are loaded and saved into an array, then returned as needed in the Icon method. See the example classes i linked.
Anyway. 1.5 completely changes the way mc handles textures, and your pre-1.5 mods will require significant file format and code changes. The transition can be a bit harsh, but I'll outline it for you.
Major changes:
- all Block and Item Textures are now kept in seperate (default 16x16 px) files
- the textures have to be in specific folders in your mod archive
- your Block and Item classes need to override a new method to specify their texture files
- all Block and Item Textures can be animated without additional code (see vanilla lava/water)
- getTexture, setTexture and any Icon Index related methods are consequently gone (or do nothing)
- you no longer need to preload textures
What stayed the same:
- Entity Render models. No change.
- Block sides are still handled in code as seperate textures
Procedure:
1)
Use image editing software (such as GIMP) to split all your block/item texture files in such a way that each 16x16 Item/Block texture is saved as a new, seperate file. png format with transparency! Useful names are useful.
2)
Prepare your textures in the new folder structure. From the base of your mod archive, they have to be at:
/mods/YOURMODNAMEHERE/textures/blocks/ for Block textures
/mods/YOURMODNAMEHERE/textures/items/ for Item textures
/mods/YOURMODNAMEHERE/textures/gui/ for your GUI screens
/mods/YOURMODNAMEHERE/textures/models/ for your entities (this one is optional)
with YOURMODNAMEHERE being your mod's descriptor. Just make sure what you choose here matches what you put in code. Since the Entities still work the old style that one is optional.
3) TO THE CODE
- remove any setTexture, getTexture methods from your Item/Block classes
- remove any iconIndex related code, from the constructors too
- find the new public void methods in Item/Block classes that take IconRegister as parameter
- right now they have the names func_94332_a and func_94581_a, but that will change after the first MCP update
- in MCP 1.5.1 the names are updateIcons in Item and registerIcons for Block
- in these methods, set the protected "Icon" field (currently named iconIndex, will change) using the method returning Icon in IconRegister (currently named func_94245_a, will change)
- in MCP 1.5.1, the fields are blockIcon and iconIndex, the method is registerIcon
- the method takes a String parameter. That string is "YOURMODNAMEHERE:FILENAME", in other words your mod descriptor, a colon, and the file name of the texture file without the ending.
- GUIs do not need texture specific code. Just make sure the filename matches the GUI class name
An example:
The texture file being selected is located at /mods/ropesplus/textures/items/hscartridge.png
The Block/Item distinction is being made by mc itself.
Another example:
The texture file being selected is located at /mods/ropesplus/textures/blocks/blockGrapplingHook.png
And that's it! Your Items and Blocks should render. In the long run, this is going to make things a LOT easier.
Finally, Block sides. The old methods are still in place, but instead of an Icon Index they now return instances of "Icon". I'll just slap you with them:
For this to work, you will have to use the IconRegister method in Block and save the Icon returns you get from the Icon-returning method, to be returned here. If you want to see an actual examples, check out these:
IronChests by cpw
https://github.com/c...kIronChest.java
AdvancedMachines by mine self
http://code.google.c...edMachines.java
Or other big open source mods as soon as they update (Buildcraft, Equivalent Exchange...)
Should you still have questions, by all means do not ask me. Go to the forge forums, the forge IRC channel, and get helped there.
Addendum #1
Stahp using modloader ... just STAHP
Compass and Clock work completely different now. If you check out their texture images, you'll notice a series of needle/pointer positions is saved as "animation" in the texture. The code now simply selects the fitting "animation" for the angle/time of day.
Edit #2
Added 1.5.1 deobfuscated names. They are terrible choices, IMO.
Alright, when I put the /mods/whatever folder there with the correctly named textures, my mod finds them (it no longer says "...but that file does not exist. Ignoring." anymore) but the textures show up as white background, black text 'missing texture' textures instead of flowers. xD
Any help on adding textures to armor models? getArmorTextureFile doesn't seem to work anymore.Never mind, stupid me forgot to change the directory for the armor textures.
That's the vanilla way of doing it, so yes. But if trolljang decides to arbitrarily do more changes there....
I seem to be having the exact same problem. I've tried having my MODNAME folder as a folder, a rar file, and a zip file, and none of them seem to work.
What do you mean by "Just make sure what you choose here matches what you put in code"? I assume you just mean this line of code:
but I'm just kind of grasping at any possible mistakes I could have made.
Here is my method:
And here is the error I keep getting:
My image is at that address, yet it seems like it can't find it.
Okay, I figured out what I was doing wrong. I assumed the mods folder you were referring to was the actual mods folder in the minecraft directory. But its really a folder you have to create inside your zip folder.
However, how do we use this with damage values?
Same way you would on any other Block
For example the Log file has these two parts of code:
and this:
I may be overlooking it, but can you show me on that code? Would be much appreciated
2013-03-13 23:31:01 [INFO] [ForgeModLoader] Forge Mod Loader version 5.0.21.574 for Minecraft 1.5 loading
2013-03-13 23:31:01 [INFO] [ForgeModLoader] Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
2013-03-13 23:31:04 [INFO] [STDOUT] 229 recipes
2013-03-13 23:31:04 [INFO] [STDOUT] 27 achievements
2013-03-13 23:31:04 [INFO] [Minecraft-Client] Setting user: Player177
2013-03-13 23:31:04 [INFO] [STDOUT] (Session ID is -)
2013-03-13 23:31:04 [INFO] [STDERR] Client asked for parameter: server
2013-03-13 23:31:05 [INFO] [Minecraft-Client] LWJGL Version: 2.4.2
2013-03-13 23:31:05 [INFO] [MinecraftForge] Attempting early MinecraftForge initialization
2013-03-13 23:31:05 [INFO] [STDOUT] MinecraftForge v7.7.0.574 Initialized
2013-03-13 23:31:05 [INFO] [ForgeModLoader] MinecraftForge v7.7.0.574 Initialized
2013-03-13 23:31:05 [INFO] [STDOUT] Replaced 73 ore recipies
2013-03-13 23:31:05 [INFO] [MinecraftForge] Completed early MinecraftForge initialization
2013-03-13 23:31:05 [INFO] [ForgeModLoader] Reading custom logging properties from C:\Users\Quickhead555\Desktop\MCP's\CupCakes Mod 1.5\forge\mcp\jars\config\logging.properties
2013-03-13 23:31:05 [OFF] [ForgeModLoader] Logging level for ForgeModLoader logging is set to ALL
2013-03-13 23:31:06 [INFO] [ForgeModLoader] Searching C:\Users\Quickhead555\Desktop\MCP's\CupCakes Mod 1.5\forge\mcp\jars\mods for mods
2013-03-13 23:31:07 [INFO] [ForgeModLoader] Forge Mod Loader has identified 4 mods to load
2013-03-13 23:31:07 [INFO] [mcp] Activating mod mcp
2013-03-13 23:31:07 [INFO] [FML] Activating mod FML
2013-03-13 23:31:07 [INFO] [Forge] Activating mod Forge
2013-03-13 23:31:07 [INFO] [Jackd44's Cupcakes] Activating mod Jackd44's Cupcakes
2013-03-13 23:31:07 [INFO] [ForgeModLoader] Configured a dormant chunk cache size of 0
2013-03-13 23:31:07 [INFO] [STDOUT] Starting up SoundSystem...
2013-03-13 23:31:08 [INFO] [STDOUT] Initializing LWJGL OpenAL
2013-03-13 23:31:08 [INFO] [STDOUT] (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org)
2013-03-13 23:31:08 [INFO] [STDOUT] OpenAL initialized.
2013-03-13 23:31:09 [INFO] [Minecraft-Client] Found animation info for: textures/blocks/lava_flow.txt
2013-03-13 23:31:09 [INFO] [Minecraft-Client] Found animation info for: textures/blocks/water_flow.txt
2013-03-13 23:31:09 [INFO] [Minecraft-Client] Found animation info for: textures/blocks/fire_0.txt
2013-03-13 23:31:09 [INFO] [Minecraft-Client] Found animation info for: textures/blocks/fire_1.txt
2013-03-13 23:31:09 [INFO] [Minecraft-Client] Found animation info for: textures/blocks/lava.txt
2013-03-13 23:31:09 [INFO] [Minecraft-Client] Found animation info for: textures/blocks/portal.txt
2013-03-13 23:31:09 [INFO] [Minecraft-Client] Found animation info for: textures/blocks/water.txt
2013-03-13 23:31:10 [INFO] [Minecraft-Client] Found animation info for: textures/items/clock.txt
2013-03-13 23:31:10 [INFO] [Minecraft-Client] Found animation info for: textures/items/compass.txt
2013-03-13 23:31:10 [SEVERE] [ForgeModLoader] Fatal errors were detected during the transition from INITIALIZATION to POSTINITIALIZATION. Loading cannot continue
2013-03-13 23:31:10 [SEVERE] [ForgeModLoader]
mcp [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized
FML [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized
Forge [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized
Jackd44's Cupcakes [The Cupcakes Mod] (bin) Unloaded->Constructed->Pre-initialized->Errored
2013-03-13 23:31:10 [SEVERE] [ForgeModLoader] The following problems were captured during this phase
2013-03-13 23:31:10 [SEVERE] [ForgeModLoader] Caught exception from Jackd44's Cupcakes
java.lang.NullPointerException
at net.minecraft.item.ItemStack.<init>(ItemStack.java:72)
at net.CupCakes.src.Cupcakes.loadInit(Cupcakes.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:515)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:165)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
at com.google.common.eventbus.EventBus.post(EventBus.java:267)
at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:98)
at cpw.mods.fml.common.Loader.initializeMods(Loader.java:681)
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:206)
at net.minecraft.client.Minecraft.startGame(Minecraft.java:443)
at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)
at net.minecraft.client.Minecraft.run(Minecraft.java:728)
at java.lang.Thread.run(Unknown Source)
2013-03-13 23:31:10 [INFO] [STDERR] java.lang.NullPointerException
2013-03-13 23:31:10 [INFO] [STDERR] at net.minecraft.item.ItemStack.<init>(ItemStack.java:72)
2013-03-13 23:31:10 [INFO] [STDERR] at net.CupCakes.src.Cupcakes.loadInit(Cupcakes.java:43)
2013-03-13 23:31:10 [INFO] [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2013-03-13 23:31:10 [INFO] [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2013-03-13 23:31:10 [INFO] [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2013-03-13 23:31:10 [INFO] [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
2013-03-13 23:31:10 [INFO] [STDERR] at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:515)
2013-03-13 23:31:10 [INFO] [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2013-03-13 23:31:10 [INFO] [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2013-03-13 23:31:10 [INFO] [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2013-03-13 23:31:10 [INFO] [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
2013-03-13 23:31:10 [INFO] [STDERR] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
2013-03-13 23:31:10 [INFO] [STDERR] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
2013-03-13 23:31:10 [INFO] [STDERR] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
2013-03-13 23:31:10 [INFO] [STDERR] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
2013-03-13 23:31:10 [INFO] [STDERR] at com.google.common.eventbus.EventBus.post(EventBus.java:267)
2013-03-13 23:31:10 [INFO] [STDERR] at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:165)
2013-03-13 23:31:10 [INFO] [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2013-03-13 23:31:10 [INFO] [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
2013-03-13 23:31:10 [INFO] [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
2013-03-13 23:31:10 [INFO] [STDERR] at java.lang.reflect.Method.invoke(Unknown Source)
2013-03-13 23:31:10 [INFO] [STDERR] at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
2013-03-13 23:31:10 [INFO] [STDERR] at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
2013-03-13 23:31:10 [INFO] [STDERR] at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)
2013-03-13 23:31:10 [INFO] [STDERR] at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
2013-03-13 23:31:10 [INFO] [STDERR] at com.google.common.eventbus.EventBus.post(EventBus.java:267)
2013-03-13 23:31:10 [INFO] [STDERR] at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:98)
2013-03-13 23:31:10 [INFO] [STDERR] at cpw.mods.fml.common.Loader.initializeMods(Loader.java:681)
2013-03-13 23:31:10 [INFO] [STDERR] at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:206)
2013-03-13 23:31:10 [INFO] [STDERR] at net.minecraft.client.Minecraft.startGame(Minecraft.java:443)
2013-03-13 23:31:10 [INFO] [STDERR] at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)
2013-03-13 23:31:10 [INFO] [STDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:728)
2013-03-13 23:31:10 [INFO] [STDERR] at java.lang.Thread.run(Unknown Source)
You screwed up your constructor with a Nullpointer, has nothing to do with this
In the IconRegister method, the various Icons are loaded and saved into an array, then returned as needed in the Icon method. See the example classes i linked.
This will work the same way, without having to override method or if you don't want to make a new java file just to change a texture.