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

I looked everywhere (I think) but I can't find anything on how to give my mobs spawn eggs I used this in 1.8 and it is telling me I need to change randomId to a string but that stilll doesnt make the egg work.

 

package net.soggymustache.zawam.entity;

import net.minecraft.entity.EntityList;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import net.soggymustache.zawam.ZAWAMain;
import net.soggymustache.zawam.entity.Warthog.EntityWarthog;

public class Entity {
public static int randomId;

public static void ZAWAMain(){
	registerEntity();
}
	 public static void registerEntity(){
//			 	createEntity(EntitySumatranRhinoceros.class, "SumatranRhinoceros", 0x424040, 
	 }

		public static void createEntity(Class entityClass, String entityName, int solidColor, int spotColor){
			randomId = EntityRegistry.findGlobalUniqueEntityId();

			EntityRegistry.registerGlobalEntityID(entityClass, entityName, randomId);
			EntityRegistry.registerModEntity(entityClass, entityName, randomId, ZAWAMain.modInstance, 42, 1, true);
			createEgg(randomId, solidColor, spotColor);

		}
		public static void createEgg(int randomId, int solidColor, int spotColor) {
			EntityList.entityEggs.put(String.valueOf(randomId), new EntityList.EntityEggInfo(randomId, solidColor, spotColor));

		}
	}

Do NOT use global IDs, this is PURELY a legacy ModLoader compatibility function.

And update to 1.10+

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Yes, but you're doing it wrong.

Stop using Global IDs.

As for the eggs, There are extra parameters for registering a mod entity with a egg.

We do it in a generic way without having to us Global IDs by using the entity name.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

    /**
     * Register the mod entity type with FML
     * This will also register a spawn egg.

     * @param entityClass The entity class
     * @param entityName A unique name for the entity
     * @param id A mod specific ID for the entity
     * @param mod The mod
     * @param trackingRange The range at which MC will send tracking updates
     * @param updateFrequency The frequency of tracking updates
     * @param sendsVelocityUpdates Whether to send velocity information packets as well
     * @param eggPrimary Primary egg color
     * @param eggSecondary Secondary egg color
     */
    public static void registerModEntity(Class<? extends Entity> entityClass, String entityName, int id, Object mod, int trackingRange, int updateFrequency, boolean sendsVelocityUpdates, int eggPrimary, int eggSecondary)
    {
        instance().doModEntityRegistration(entityClass, entityName, id, mod, trackingRange, updateFrequency, sendsVelocityUpdates);
        EntityRegistry.registerEgg(entityClass, eggPrimary, eggSecondary);
    }

Reading helps... Its straight forward. Also UPDATE to 1.10!

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

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.