Jump to content

Recommended Posts

Posted

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.

Posted

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).

Posted

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

Posted

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?

Posted

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?

Posted

Yes Barney, that's how it works as of the newest versions of Forge for 1.5 and beyond since Minecraft 1.5 updated how textures are handled :)

If you guys dont get it.. then well ya.. try harder...

Posted

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.

Posted

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.

Posted

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]

Posted

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");
}

Posted

Just put simply this

this.iconIndex = iconRegister.registerIcon("NameOfYourModFolder:NameOfYourItem/Block");

 

example

 

this.iconIndex = iconRegister.registerIcon("mod:superpickaxe");

.-.

  • 1 month later...
Posted

this is what got it to work for me

 

       

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

Posted

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

Posted

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

Posted

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.

  • 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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • that happens every time I enter a new dimension.
    • This is the last line before the crash: [ebwizardry]: Synchronising spell emitters for PixelTraveler But I have no idea what this means
    • What in particular? I barely used that mod this time around, and it's never been a problem in the past.
    • Im trying to build my mod using shade since i use the luaj library however i keep getting this error Reason: Task ':reobfJar' uses this output of task ':shadowJar' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. So i try adding reobfJar.dependsOn shadowJar  Could not get unknown property 'reobfJar' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. my gradle file plugins { id 'eclipse' id 'idea' id 'maven-publish' id 'net.minecraftforge.gradle' version '[6.0,6.2)' id 'com.github.johnrengelman.shadow' version '7.1.2' id 'org.spongepowered.mixin' version '0.7.+' } apply plugin: 'net.minecraftforge.gradle' apply plugin: 'org.spongepowered.mixin' apply plugin: 'com.github.johnrengelman.shadow' version = mod_version group = mod_group_id base { archivesName = mod_id } // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. java.toolchain.languageVersion = JavaLanguageVersion.of(17) //jarJar.enable() println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft { mappings channel: mapping_channel, version: mapping_version copyIdeResources = true runs { configureEach { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' arg "-mixin.config=derp.mixin.json" mods { "${mod_id}" { source sourceSets.main } } } client { // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. property 'forge.enabledGameTestNamespaces', mod_id } server { property 'forge.enabledGameTestNamespaces', mod_id args '--nogui' } gameTestServer { property 'forge.enabledGameTestNamespaces', mod_id } data { workingDirectory project.file('run-data') args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') } } } sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { flatDir { dirs './libs' } maven { url = "https://jitpack.io" } } configurations { shade implementation.extendsFrom shade } dependencies { minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" implementation 'org.luaj:luaj-jse-3.0.2' implementation fg.deobf("com.github.Virtuoel:Pehkui:${pehkui_version}") annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' minecraftLibrary 'luaj:luaj-jse:3.0.2' shade 'luaj:luaj-jse:3.0.2' } // Example for how to get properties into the manifest for reading at runtime. tasks.named('jar', Jar).configure { manifest { attributes([ 'Specification-Title' : mod_id, 'Specification-Vendor' : mod_authors, 'Specification-Version' : '1', // We are version 1 of ourselves 'Implementation-Title' : project.name, 'Implementation-Version' : project.jar.archiveVersion, 'Implementation-Vendor' : mod_authors, 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", "TweakOrder" : 0, "MixinConfigs" : "derp.mixin.json" ]) } rename 'mixin.refmap.json', 'derp.mixin-refmap.json' } shadowJar { archiveClassifier = '' configurations = [project.configurations.shade] finalizedBy 'reobfShadowJar' } assemble.dependsOn shadowJar reobf { re shadowJar {} } publishing { publications { mavenJava(MavenPublication) { artifact jar } } repositories { maven { url "file://${project.projectDir}/mcmodsrepo" } } } my entire project:https://github.com/kevin051606/DERP-Mod/tree/Derp-1.0-1.20
  • Topics

×
×
  • Create New...

Important Information

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