SoggyMustache Posted November 2, 2016 Share Posted November 2, 2016 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)); } } Quote Link to comment Share on other sites More sharing options...
LexManos Posted November 2, 2016 Share Posted November 2, 2016 Do NOT use global IDs, this is PURELY a legacy ModLoader compatibility function. And update to 1.10+ Quote I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon Link to comment Share on other sites More sharing options...
SoggyMustache Posted November 2, 2016 Author Share Posted November 2, 2016 They spawn in fine I need them to have eggs as well Quote Link to comment Share on other sites More sharing options...
LexManos Posted November 2, 2016 Share Posted November 2, 2016 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. Quote I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon Link to comment Share on other sites More sharing options...
SoggyMustache Posted November 2, 2016 Author Share Posted November 2, 2016 I removed the global ids, Im not trying to sound rude but I just need to know how to add eggs to the entities Quote Link to comment Share on other sites More sharing options...
LexManos Posted November 2, 2016 Share Posted November 2, 2016 /** * 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! Quote I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon Link to comment Share on other sites More sharing options...
Recommended Posts
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.