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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I myself am quite new to the modding scene, I started modding in February but have been in development hell a lot and have struggled to focus on one mod though I have been developing the current mod I've been working on since September and have made a lot of progress; during this time I have found a lot of helpful resources and have learnt a lot of things.    1. You can, I have had no Java experience previously and since modding have managed to be quite knowledgeable in Java.   2. Modding does not require massive teams, I and many others work alone, though having a team is certainly helpful in the modding process to get things done in a quicker and more organised way.   3. I absolutely have to recommend ModdingByKaupenjoe, he makes loads of tutorials for Minecraft from 1.16.5 and above with support for Forge, Fabric, and as of his 1.21 tutorials, Neoforge. These tutorials are really well made, covering almost every modding topic, (such as items, blocks, mobs, worldgen, etc.) and are pretty easy to follow, and Kaupenjoe always leaves the link to his GitHub repositories where you can view the code of that tutorial at your own pace as well as linking textures in the description of his videos for you to use. These forums are also quite good if you need help, though I have found that it sometimes takes a little while for a response but it is always worth the wait; from my experience the people on these forums have always been kind and helpful. There are also user-submitted tutorials that may be helpful as well.  Using GitHub to search up a certain class that you are wanting to use in your mod is also quite helpful, the video I have linked goes into more detail. I would also recommend planning out your mod before you make it to have a clearer idea of how you want your mod to be, including sketches and annotations are also a good idea for this. It has helped me make progress a lot quicker when programming as I already know how I want things to look/act.   I hope all this information helps!
    • I don't know what I did differently, but the error code changed to "Invalid signature for profile public key" so I set "enforce-secure-profile" to false since only my friend will be allowed to join anyway and then everything worked properly. Here's the logs anyway, but I hope the problem doesn't come back. https://paste.ee/p/Ri44L
    • I tried to look for similar issues here on the forum already and couldn't find a fix. Just people who didn't read the rules properly.
  • Topics

×
×
  • Create New...

Important Information

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