Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.5.1] Block/Item Texture/Icon location?


Kalbintion
 Share

Recommended Posts

I am wondering where (for testing purposes at this moment) the block/item texture/icon location is. Right now I have the custom item images located at "\forge\mcp\jars\mods\%modname%\textures\items\%itemname%.png" and blocks in the same location but "..\blocks\%blockname%.png" but neither are loading and am receiving a "Missing Texture" texture in-game when ran from Eclipse IDE.

 

A generic example Item class I have.

package mod.ModName;

import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;

public class ItemName extends Item {
public ItemName(int id) {
	super(id);
	this.setMaxStackSize(1);
	this.setCreativeTab(CreativeTabs.tabMisc);
	this.setUnlocalizedName("ModNameItemName");
	LanguageRegistry.addName(this, "ItemName");
}

public void updateIcons(IconRegister par1IconRegister) {
	this.iconIndex = par1IconRegister.registerIcon("ModName:ItemName");
}
}

 

With that, I would expect the icon file to be located at "\forge\mcp\jars\mods\ModName\textures\items\ItemName.png"

 

I have followed the basic tutorials on the wiki, and have searched the forums for 1.5+ related questions, what I have found has led me to this point. The wiki tutorial on textures is outdated and was the original stopping point for me since it wasn't working then.

Link to comment
Share on other sites

You placed the files to right folder, but You have to override

updateIcons function.

 

I do mine like so:

 

@SideOnly(Side.CLIENT)
@Override
public void updateIcons(IconRegister iconRegister)//updateIcons
{
    iconIndex = iconRegister.registerIcon(SenitielsSpaceMarineMod.ModId+":"+name);
}

 

Where ModId is the name I put in the @Mod attribute in the main class.

 

Remember to put " : " between mod id and item name. Also note, that unlocalizedName has "item_" before what You have assigned (or "tile_" in case of blocks).

Link to comment
Share on other sites

Well, upon doing what was said and some other directory locations (found by searching the forge folder for a "mods" folder) and attempting those locations (see below) I am still receiving a missing textures texture but I have found a warning in the console output saying the file cannot be found and what it was looking for. Following that, I made sure the folder names were properly named according to what it said it couldnt find, and it failed again. So i tried other directories, each time it failing. Just to mention, I am using forge 608 at this time.

 

2013-03-25 12:08:33 [WARNING] [Minecraft-Client] TextureManager.createTexture called for file mods/ModName/textures/items/ItemName.png, but that file does not exist. Ignoring.

 

Current Item Example

package mod.ModName;

import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.*;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;

public class ItemName extends Item {
public ItemName(int id) {
	super(id);
	this.setMaxStackSize(1);
	this.setCreativeTab(CreativeTabs.tabMisc);
	this.setUnlocalizedName("ModNameItemName");
	LanguageRegistry.addName(this, "ItemName");
}

@SideOnly(Side.CLIENT)
@Override
public void updateIcons(IconRegister par1IconRegister) {
	this.iconIndex = par1IconRegister.registerIcon("ModName:ItemName");
}
}

 

Locations I've Tried putting the folder scheme (\ModName\textures\items\ItemName.png) into (all with failure)

\forge\fml\bin\mods
\forge\fml\client\mods
\forge\fml\common\mods
\forge\mcp\bin\minecraft\mods
\forge\mcp\eclipse\Minecraft\bin\mods
\forge\mcp\mods
\forge\mcp\src\minecraft\mods
\forge\mcp\temp\bin\minecraft\mods
\forge\mcp\temp\cls\minecraft\mods
\forge\mcp\temp\src\minecraft\mods

Link to comment
Share on other sites

I think You didn't understand me correctly. But then, maybe I should have been more specific.

 

put this

 

@SideOnly(Side.CLIENT)
@Override
public void updateIcons(IconRegister iconRegister)//updateIcons
{
    iconIndex = iconRegister.registerIcon("ModName"+":"+"ItemName");
}

 

into Your ItemName class, and make all of Your items derive from it.

 

Forge has a feature, that if you call iconRegister.registerIcon(modname+":"+itemname) minecraft will search for the file in

 

"mcp/src/mods/modname/textures/items/itemname.png"

 

 

or, in case of blocks:

 

iconRegister.registerIcon(modname+":"+blockname)

 

"mcp/src/mods/modname/textures/blocks/blockname.png"

 

Code checks itself, if the texture is in blocks or items folder.

 

Does this solve Your problem?

Link to comment
Share on other sites

So if i understand you right I put for example if the mod is called MagicCola and the Item is called Cola :  @SideOnly(Side.CLIENT)

@Override

public void updateIcons(IconRegister iconRegister)//updateIcons

{

    iconIndex = iconRegister.registerIcon("MagicCola"+":"+"Cola");

}

is that right?

Link to comment
Share on other sites

2013-03-28 11:20:13 [WARNING] [Minecraft-Client] TextureManager.createTexture called for file textures/items/item_*modid**itemname*, but that file does not exist. Ignoring.

That is my error, please help. I have tried the texture in %mcp%/src/minecraft/mods/*modid*/textures/items/item_momeatSeasonedBeef.png

%mcp%/src/minecraft/*modid*/textures/items/item_momeatSeasonedBeef.png

%mcp%/src/minecraft/textures/items/item_momeatSeasonedBeef.png

and it still doesn't work. My code is:

package cookie.mods.momeat.items;

import cookie.mods.momeat.CommonProxy;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import cookie.mods.momeat.MoMeat;

public class ItemSeasonedBeef extends ItemFood {

public ItemSeasonedBeef(int par1, int par2, boolean par3) {
	super(par1, par2, par3);
	setAlwaysEdible();
}

@SideOnly(Side.CLIENT)
@Override
public void updateIcons(IconRegister iconRegister) {
	iconIndex = iconRegister.registerIcon("momeat" + ":" + this.getUnlocalizedName());
}

}

and I just get a square with "missing texture missing texture" written on it.

Link to comment
Share on other sites

Textures go in:

 

/mcp/src/minecraft/mods/%MODNAME%/textures/%TYPE%/%FILENAME%.png

 

Where %MODNAME% and %FILENAME% are specified in the call to iconRegister.registerIcon(...)

 

e.g. for an item,

iconRegister.registerIcon("MyMod:MyItem")

 

will look for a texture at:

/mcp/src/minecraft/mods/MyMod/textures/items/MyItem.png

 

for a block, it will look in ...textures/blocks/ instead of ...textures/items/

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Textures go in:

 

/mcp/src/minecraft/mods/%MODNAME%/textures/%TYPE%/%FILENAME%.png

 

Where %MODNAME% and %FILENAME% are specified in the call to iconRegister.registerIcon(...)

 

e.g. for an item,

iconRegister.registerIcon("MyMod:MyItem")

 

will look for a texture at:

/mcp/src/minecraft/mods/MyMod/textures/items/MyItem.png

 

for a block, it will look in ...textures/blocks/ instead of ...textures/items/

 

 

He's right, this is what I use and it works perfectly. In the .class fine your using for the item/items you place

@Override

public void updateIcons(IconRegister iconRegister)

{

iconIndex = iconRegister.registerIcon("mps:energyCore");

        }

 

Where mps is the mod name and energyCore is the file name, so the item picture would be in MCP/src/minecraft/mods/mps/textures/items/energyCore.png

Make sure to not put .png at the end of the file name in Eclipse.

I am the current head modder for the Metroid Prime Suits mod. I have no other staff members, so I'm hiring! I also co-own the SkyTekkit server.

width=600 height=126http://i1276.photobucket.com/albums/y480/Sypher40/MPSbanner_zps9d50d86a.png[/img]

Link to comment
Share on other sites

I did what you said, but I just got an NPE.

 

 

2013-03-28 14:49:51 [iNFO] [sTDERR] java.lang.RuntimeException: Don't register null!

2013-03-28 14:49:51 [iNFO] [sTDERR] at net.minecraft.client.renderer.texture.TextureMap.registerIcon(TextureMap.java:229)

2013-03-28 14:49:51 [iNFO] [sTDERR] at net.minecraft.item.Item.updateIcons(Item.java:726)

2013-03-28 14:49:51 [iNFO] [sTDERR] at net.minecraft.client.renderer.texture.TextureMap.refreshTextures(TextureMap.java:85)

2013-03-28 14:49:51 [iNFO] [sTDERR] at net.minecraft.client.renderer.RenderEngine.refreshTextureMaps(RenderEngine.java:521)

2013-03-28 14:49:51 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.startGame(Minecraft.java:440)

2013-03-28 14:49:51 [iNFO] [sTDERR] at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)

2013-03-28 14:49:51 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:729)

2013-03-28 14:49:51 [iNFO] [sTDERR] at java.lang.Thread.run(Unknown Source)

2013-03-28 14:49:51 [iNFO] [sTDERR] java.lang.NullPointerException

2013-03-28 14:49:51 [iNFO] [sTDERR] at net.minecraft.client.renderer.texture.TextureMap.refreshTextures(TextureMap.java:102)

2013-03-28 14:49:51 [iNFO] [sTDERR] at net.minecraft.client.renderer.RenderEngine.refreshTextureMaps(RenderEngine.java:521)

2013-03-28 14:49:51 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.startGame(Minecraft.java:440)

2013-03-28 14:49:51 [iNFO] [sTDERR] at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)

2013-03-28 14:49:51 [iNFO] [sTDERR] at net.minecraft.client.Minecraft.run(Minecraft.java:729)

2013-03-28 14:49:51 [iNFO] [sTDERR] at java.lang.Thread.run(Unknown Source)

 

 

EDIT: Ok, I've just found out from the code that it throws that NPE when registerIcon() gets passed null, but I think I've written updateIcons() right.

@Override
@SideOnly(Side.CLIENT)
public void updateIcons(IconRegister iconRegister) {
	iconIndex = iconRegister.registerIcon("momeat" + ":" + "SeasonedBeef");
}

Link to comment
Share on other sites

  • 1 month later...

this is what got it to work for me

 

       

        @Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconRegister) {
        this.itemIcon = iconRegister.registerIcon("modname:itemname");

Link to comment
Share on other sites

Also, try putting a file system like this:

 

/mods/%MODID%/textures/(items or blocks depending)/%FILENAME%.png

 

into mcp/eclipse/bin/

 

That is where I put my textures whilst developing mods

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Link to comment
Share on other sites

Hey guys, I am learning to mod so I am doing my first testing mod in 1.5 (already have made one testing mod in 1.4.7) and I have the same problem with the textures (error with missing texture) and I tried everything I found on the internet and it still does not work.

 

So here is my code for my blocks and items:

 

 

For blocks:

package first.Block;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class ModBlock extends Block {

    private String location;

    public ModBlock(int id, Material material, String location) {
        super(id, material);

        this.location = location;

    }

    @SideOnly(Side.CLIENT)
    public void registerIcons(IconRegister par1iconRegister) {
        this.blockIcon = par1iconRegister.registerIcon("first:" + location);

    }

}

And for Items:

package first.Item;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.item.Item;

public class ModItem extends Item{
    
    private String location;

    public ModItem(int par1, String location) {
        super(par1);
        this.location = location;
    }
    
    @SideOnly(Side.CLIENT)
    @Override
    public void registerIcons(IconRegister par1IconRegister){
        this.itemIcon = par1IconRegister.registerIcon("first:" + location);
    }


}

 

 

And I have the textures at:

mcp\src\minecraft\mods\first\textures\blocks\

mcp\src\minecraft\mods\first\textures\items\

 

and I am sure that the names are correct.

 

Please help, I am really stuck on that :(

If someone helps you, click that thank you button ;)

 

EasyTessellator library: http://www.minecraftforge.net/forum/index.php/topic,14705.0.html

Link to comment
Share on other sites

And for the tenth time...

 

Capture.png

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.