Jump to content

Recommended Posts

Posted

So I am working on just implementing simple item like a pickaxe. When applying a texture to the object, it appears as if the iconIndex is missing. Below is the code. I'm guessing its probably something extremely simple, and I just need a second pair of eyes. Any help/suggestions is appreciated. Thanks.

 


package mods.resources.common;

import mods.resources.tool.ItemSteelPickaxe;

import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.EnumHelper;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;



@Mod(modid = "resources", name = "resources",version = "1.0")



public class resources {

//public static Item ingotSteel;
public static Item SteelPickaxe;
public static Item SteelShovel;
public static Item SteelSword;
public static Item SteelAxe;
public static Item SteelHoe;



public static EnumToolMaterial materialSteel = EnumHelper.addToolMaterial("STEEL", 2, 250, 8.0F, 2, 6);

public resources (){

	SteelPickaxe = new ItemSteelPickaxe(1001,materialSteel).setUnlocalizedName("SteelPickaxe").setCreativeTab(CreativeTabs.tabTools);


	LanguageRegistry.addName(SteelPickaxe,"Steel Pickaxe");

}
}

 

and also

 


package mods.resources.tool;

import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.ItemPickaxe;


public class ItemSteelPickaxe extends ItemPickaxe {

public ItemSteelPickaxe(int par1, EnumToolMaterial par2EnumToolMaterial) {
	super(par1, par2EnumToolMaterial);

}

public void updateIcons(IconRegister iconRegister)
{
	iconIndex = iconRegister.registerIcon("resources:SteelPickaxe");
}


}

 

I am getting the error "iconIndex could not be resolved to a variable". I looked over plenty of how to's and I think I understand for the most part the major change with the update. If there is anything you want me to provide please let me know.

 

Images are located inside : src\minecraft\mods\resources\textures\items

 

Thanks again for the help!

Posted

"resources" is a bad name for a top-level folder.

 

You really should name it the same as your mod-name.

 

The folder structure will look like this:

 

[mcp]/src/minecraft/mods/MODNAME/textures/items/ITEMNAME.png

 

Where MODNAME and ITEMNAME are what you specify in the registerIcon function.  In this case, you have "resources:SteelPickaxe" so your texture file should be named "SteelPickaxe.png" and it will be located at "[mcp]/src/minecraft/mods/resources/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

yea, thats true. I change it's name;  and that is how I have the folders setup.

 

 

I get the error during runtime : "TextureManager.createTexture called for file textures/items/SteelPickaxe.png, but that file does not exist. Ignoring."

 

but I know I have the image there : mcp\src\minecraft\mods\modName\textures\items\SteelPickaxe.png

Posted

Hello, while I was making a tutorial on updating to forge 678 I encountered this issue.

there were 2 changes

1) iconIndex changed to itemIcon (you already noticed this)

2) the method changed from updateIcons(IconRegister iconRegister){/*whatever*/} to registerIcons(IconRegister iconRegister){/*whatever*/}

 

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



×
×
  • Create New...

Important Information

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