Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Unsolved | 1.7.10] Items are unnamed in Creative tab until placed in Inventory.

Featured Replies

Posted

Hey, for some reason I have an item that while in the creative menu or in NEI, it's name is Unnamed. When I put it into my inventory it fixes itself. I suspect this may be due to me using NBT but I'm not sure.

 

Here is my Item Class:

 

package noahc3.AbilityStones;

import java.util.List;

import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.world.World;



public class ItemRegenerationStone extends Item
{

//use timer in ticks (24000)
public ItemRegenerationStone() {
	setMaxStackSize(1);
	setMaxDamage(24000);
	setNoRepair();
	setUnlocalizedName("ItemRegenerationStone");
	setTextureName("abilstones:itemRegenerationStone");
}	

public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Minutes Remaining: " + (((par1ItemStack.getTagCompound().getInteger("timer"))/20)/60+1));
}

public ItemStack onItemRightClick(ItemStack itemstack, World par2World, EntityPlayer par3EntityPlayer)
{
        if(itemstack.stackTagCompound.getInteger("enabled") == 1 && itemstack.stackTagCompound.getInteger("cooldown") == 0)
        {
        	itemstack.stackTagCompound.setInteger("enabled", 0);
        	itemstack.stackTagCompound.setInteger("cooldown", 20);
		System.out.println("Was Enabled, now Disabled");
             		return itemstack;
        }
        else if(itemstack.stackTagCompound.getInteger("enabled") == 0 && itemstack.stackTagCompound.getInteger("cooldown") == 0)
        {
        	itemstack.stackTagCompound.setInteger("enabled", 1);
        	itemstack.stackTagCompound.setInteger("cooldown", 20);
		 System.out.println("Was Disabled, now Enabled");
		 return itemstack;
        }
        else
        {
        	System.out.println("Warning! For some reason the " + this + " is not enabled nor disabled. Please report this to the mod author!");
        	return itemstack;
        }
}







 EntityPlayer player = Minecraft.getMinecraft().thePlayer;






@Override
public void onUpdate(ItemStack itemstack, World world, Entity entity, int i, boolean flag)
{
	//stuff to do when active

	 if(itemstack.stackTagCompound == null){
		 itemstack.stackTagCompound = new NBTTagCompound();
		 itemstack.stackTagCompound.setInteger("timer", 23999);
		 itemstack.stackTagCompound.setInteger("enabled", 0);
		 itemstack.stackTagCompound.setInteger("cooldown", 0);
		 }
	 EntityPlayer player = (EntityPlayer)entity;

	 if(itemstack.stackTagCompound.getInteger("enabled") == 1)
	 {

		 itemstack.stackTagCompound.setInteger("timer", itemstack.getTagCompound().getInteger("timer") + -1);
		 	((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.regeneration.id, 20, 1));
	 }


	 if(itemstack.stackTagCompound.getInteger("timer") <= 0){player.inventory.consumeInventoryItem(AbilityStones.itemRegenerationStone);}

	 if(itemstack.stackTagCompound.getInteger("cooldown") > 0)
	 {
		 itemstack.stackTagCompound.setInteger("cooldown", itemstack.getTagCompound().getInteger("cooldown") + -1);
		 System.out.println("minus one tick");
	 }

}

}

 

Thanks for the help.

  • Author

en_US.lang:

 

item.ItemRegenerationStone.name=Regeneration Stone


itemGroup.tabAbilitystones=Ability Stones

 

Again, when I put the item in my inventory, it correctly displays as Regeneration Stone.

Maybe because your texture's name is itemRegenerationStone and unlocalized is ItemRegenerationStone?

 

Not sure

When in doubt, use brute force.

  • Author
package noahc3.AbilityStones;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;

@Mod(modid = "abilstones", name = "Ability Stones", version = "1.0")

public class AbilityStones 
{
public static Item itemRegenerationStone;
//public static Item itemFireResistStone;
//public static Item itemSwiftnessStone;
//public static Item itemNightVisionStone;

@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
	//Item/Block init and registration		
	//Config Handling
        
	//blocks

	//items

	itemRegenerationStone = new ItemRegenerationStone().setCreativeTab(tabAbilityStones);
	GameRegistry.registerItem(itemRegenerationStone, itemRegenerationStone.getUnlocalizedName().substring(5));

	//itemFireResistStone = new ItemFireResistStone().setUnlocalizedName("ItemFireResistStone").setTextureName("abilstones:itemFireResistStone").setMaxDamage(24000).setCreativeTab(tabAbilityStones);
	//GameRegistry.registerItem(itemFireResistStone, itemFireResistStone.getUnlocalizedName().substring(5));

	//itemSwiftnessStone = new ItemSwiftnessStone().setUnlocalizedName("ItemSwiftnessStone").setTextureName("abilstones:itemSwiftnessStone").setMaxDamage(24000).setCreativeTab(tabAbilityStones);
	//GameRegistry.registerItem(itemSwiftnessStone, itemSwiftnessStone.getUnlocalizedName().substring(5));

	//itemNightVisionStone = new ItemNightVisionStone().setUnlocalizedName("ItemNightVisionStone").setTextureName("abilstones:itemNightVisionStone").setMaxDamage(24000).setCreativeTab(tabAbilityStones);
	//GameRegistry.registerItem(itemNightVisionStone, itemNightVisionStone.getUnlocalizedName().substring(5));

	//foods

	//tools

	//armor

	//furnace recipes
}

@EventHandler
public void init(FMLInitializationEvent event) 
{
	//Proxy, Tileentity, entity, crafting recipes, GUI and Packet Registration
}
@EventHandler
public void postInit(FMLPostInitializationEvent event) 
{

}
public static CreativeTabs tabAbilityStones = new CreativeTabs("tabAbilityStones"){
	@Override
	public Item getTabIconItem(){
		return new ItemStack(itemRegenerationStone).getItem();
	}
};


}

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.