Jump to content

Need assistance linking entity names in language file to datawatcher


Cyan

Recommended Posts

So, title kinda explains it all in a nutshell.

 

So, I have made a datawatcher to keep track of my entity names, but I cannot for the life of me figure out how I would link it to the language file. Currently I am using the EntityList to get the names of the entities, but the names are displayed as modid.entity instead.

 

Not sure this is making any sense, so here is all the relevant code.

 

 

public abstract class EntityTest extends EntityCreature
{




    public EntityTest(World world)
    {
      super(world);
dataWatcher.addObject(4, ""); //Name


      newEntity();
    }


    public void newTest()
    {
        setName(EntityList.getEntityString(this));
        
    }


//Naming process
public String getName() {

return dataWatcher.getWatchableObjectString(4);
}

public void setName(String name) {
dataWatcher.updateObject(4, name);
}

public void writeEntityToNBT(NBTTagCompound nbt)
    {
        super.writeEntityToNBT(nbt);

        nbt.setString("name", getName());
       
    }
    
   

    public void readEntityFromNBT(NBTTagCompound nbt)
    {
       super.readEntityFromNBT(nbt);

       setName(nbt.getString("name"));
     
    }


 

 

And then the code adding the entity, as well as what it is marked down as in the language file

 

EntityRegistry.registerModEntity(EntityTest.class, "TestEntity", 1, testmod.instance, 80, 3, true);

entity.testmod.TestEntity.name=TestEntity

 

 

Now, this will give be the "Player has been slain by TestEntity" when killed, but when setName() is displayed in my render over the mob, it is shown as testmod.TestEntity

 

I figure this is somehow related to the way getEntityString() reads the names from mods. So is is possible to get setName() to read from the Lanuage file names?

 

Thanks for any help you can provide

 

 

 

Link to comment
Share on other sites

Consider reading "CustomNameTag" stuff. It is object 10 in the datawatcher for EntityLiving.

 

Not necessarily what I am looking for.

 

I have a rather large amount of custom entities, and there is nothing there that really satisfies what I am trying to do. I would still need to go through and set each entities name individually in their respective files.

 

Which:

A) Is irrelevant. I am trying to figure out if there is a way I can use EntityList to return the names without it returning as "modid.mobname", as EntityList seems like the best way to set names for over 240 entities without individually going through each file.

 

B) Use the language registry, so it will reflect the language(I.E. Using a spanish lanuage file rendering "Pollo" over a chicken, rather than "Chicken"

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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