Jump to content

Recommended Posts

Posted

You need to override getUnlocalizedName(ItemStack stack) in your ItemBlock class and return a different unlocalized name for each damage value. I like to just do

@Override
public String getUnlocalizedName(ItemStack stack) {
return super.getUnlocalizedName(stack) + stack.getItemDamage();
}

Then in your language file you would just have

tile.modid:name0.name=Name 0
tile.modid:name1.name=Name 1
tile.modid:name2.name=Name 2
tile.modid:name3.name=Name 3
etc...

I am the author of Draconic Evolution

Posted

I have already done that:

 

    
@Override
public String getUnlocalizedName(ItemStack stack)
{
    return super.getUnlocalizedName() + "." + BlockColor.colorNames[stack.getItemDamage()];
}

 

tile.stone.raw.aqua.name=Aqua Stone
tile.stone.raw.black.name=Sooty Stone

 

They have the correct name in game but the registered name is still the same between all of the blocks.

 

width=800 height=449https://dl.dropboxusercontent.com/u/248986518/Orizon/2014-12-06_14.45.49.png[/img]

 

width=800 height=449https://dl.dropboxusercontent.com/u/248986518/Orizon/2014-12-06_14.45.53.png[/img]

Posted

Well the registered name is supposed to be the same across all blocks because they are all the same block just with different meta data. All meta blocks are the same look at wool for example each colour is the same block with different metadata.

I am the author of Draconic Evolution

Posted

You need an ItemBlock class, like so:

 

package com.draco18s.ores.item;

import java.util.List;

import com.draco18s.ores.OresBase;
import com.draco18s.ores.block.BlockOreFlower;

import cpw.mods.fml.common.Loader;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.BlockColored;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemDye;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;

public class ItemBlockOreFlower extends ItemBlock {
private IIcon[] icons;
public static final String[] names = new String[] {"poorjoe","horsetail","horsetail","vallozia","flame_lily","flame_lily",
												   "tansy","tansy","hauman","leadplant","primrose"};
private String[] flowerDescript = {"indicator.iron","indicator.gold","indicator.gold","indicator.diamond","indicator.redstone","indicator.redstone",
								   "indicator.tin","indicator.tin","indicator.copper","indicator.lead","indicator.uranium"};

public ItemBlockOreFlower(Block b) {
	super(b);
	setHasSubtypes(true);
}

@Override
@SideOnly(Side.CLIENT)
    public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean flag) {
	if(stack.getItemDamage() < 6 || Loader.isModLoaded("IC2")) {
		list.add(StatCollector.translateToLocal(flowerDescript[stack.getItemDamage()]));
	}
}

@Override
@SideOnly(Side.CLIENT)
    public IIcon getIconFromDamage(int p_77617_1_) {
        return this.field_150939_a.getIcon(2, p_77617_1_);
    }

@Override
    public int getMetadata(int p_77647_1_)
    {
        return p_77647_1_;
    }
    
@Override
    public String getUnlocalizedName(ItemStack itemStack)
    {
        return "item." + names[itemStack.getItemDamage()];
    }
}

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.

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.