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.

Featured Replies

Posted

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.

  • Author

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?

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.