Jump to content

[1.12.2] lang file not working for entities


MSpace-Dev

Recommended Posts

Hey all,

 

I'm trying to get my spawn eggs to not display as "entity.mob_name.name", but rather as "Spawn mob_name" like Vanilla's spawn eggs. Here is the necessary information.

 

InitEntities.class

public class InitEntities
{

	private static int id = 1500;

	public static void register()
	{
		registerEntity("mob_id", "Mob Name", EntityMob.class, 16167425, 16775294);

		Utils.getLogger().info("Entities Registered");
	}

	private static void registerEntity(String nameId, String entityName, Class<? extends Entity> entityClass, int eggPrimary, int eggSecondary)
	{
		EntityRegistry.registerModEntity(new ResourceLocation(Reference.MODID, nameId), entityClass, entityName, ++id, Reference.MODID, 64, 1, false, eggPrimary, eggSecondary);
	}
}

 

Main class

public static final CreativeTabs creativeTab = new CreativeTabs(CreativeTabs.getNextID(), "modid")
{
    @Override
    @SideOnly(Side.CLIENT)
    public void displayAllRelevantItems(NonNullList<ItemStack> itemList)
  {
		super.displayAllRelevantItems(itemList);
		itemList.add(getSpawnEgg("mob_id"));
	}
};

 

en_us.lang (I've tried both of these separately. No luck.) [All other translations are working fine]

#### Entities ####
entity.mod_id.mob_id.name=Mob Name

entity.mob_id.name=Mob Name

 

Thanks.

Link to comment
Share on other sites

Alright, I've moved everything to being registered through the registry event and EntityEntryBuilder.

 

My entities are exactly the same in world, so it's working. The lang file is still not working for them though.

 

RegistryEventHandler

@SubscribeEvent
public static void registerEntities(RegistryEvent.Register<EntityEntry> event)
  {
  final IForgeRegistry<EntityEntry> registry = event.getRegistry();

  for (final EntityEntry entityEntry : ModEntities.ENTITIES)
  {
  	registry.register(entityEntry);
  }
}

 

ModEntities

public class ModEntities
{
	private static int id = 1500;

	public static final EntityEntry[] ENTITIES = {
			getEntityEntry("mob_name", "Mob Name", EntityMob.class, 16167425, 16775294)
	};

	private static EntityEntry getEntityEntry(String nameId, String entityName, Class<? extends Entity> entityClass, int eggPrimary, int eggSecondary)
	{
		return EntityEntryBuilder.create()
				.entity(entityClass)
				.id(new ResourceLocation(Reference.MODID, nameId),++id)
				.name(entityName)
				.tracker(64, 1, false)
				.egg(eggPrimary, eggSecondary)
				.spawn(EnumCreatureType.MONSTER, 0, 0, 0, Biomes.VOID)
				.build();
	}
}

 

en_us

#### Entities ####
entity.mod_id.mob_name.name=Mob Name

entity.mob_name.name=Mob Name

 

Am I missing something?

Link to comment
Share on other sites

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.