Jump to content

difference between registerModEntity and registerGlobalEntityID


Torojima

Recommended Posts

What is the difference between EntityRegistry.registerModEntity and EntityRegistry.registerGlobalEntityID and when to use the one or the other?

running minecraft on Mac OS X - Sierra --- creating code since 1986 ... --- मेरा दिल भारतवासी है!

width=289 height=100http://www.arno-saxena.de/pictures/chococraft/banner_signature.png[/img]

Link to comment
Share on other sites

registerModEntity is required for MP tracking stuff, so the entity works on a dedicated server with multiple clients connected to it, I believe. registerGlobalEntityID is the base method for registering entities and should always be used in order to make entities work.

 

I would suggest to use both methods. The registerGlobalEntityID first, then registerModEntity.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

I had done it the wrong way around then. First registerModEntity, then registerGlobalEntityID. As a result, the spawn egg's did not show and I had a warning in the ForgeModLoader client log

 

 

2012-09-24 11:42:51 [FINEST] [ForgeModLoader] Automatically registered mod ChocoCraft entity ChocoboYellow as ChocoCraft.ChocoboYellow

2012-09-24 11:42:51 [WARNING] [ForgeModLoader] The mod ChocoCraft tried to register the entity class class chococraft.common.entities.colours.EntityChocoboYellow which was already registered - if you wish to override default naming for FML mod entities, register it here first

 

 

Thus I presume if omited, EntityRegistry.registerModEntity will be called by the EntityRegistry.registerGlobalEntityID, since right now I'm doing exactly that and I have the respective spawnEggs and can spawn my entities.

 

But if the explicit call of both methods in the correct order are the correct way, I'll of course do it like that, first the EntityRegistry.registerGlobalEntityID, then the EntityRegistry.registerModEntity.

running minecraft on Mac OS X - Sierra --- creating code since 1986 ... --- मेरा दिल भारतवासी है!

width=289 height=100http://www.arno-saxena.de/pictures/chococraft/banner_signature.png[/img]

Link to comment
Share on other sites

Well, I can ensure you that neither the registerGlobalEntityID nor the registerModEntity methods call eachother.

 

There are two versions of registerGlobalEntityID, one with two additional parameters - the foreground and background color for the egg -, which will add an egg, and one without these parameters, which won't add an egg.

 

Anyway you HAVE to call these methods in this order or else you will get the error you mentioned.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

I have now tried the version with registerGlobalEntityID first and registerModEntity second and I'm receiving again a warning about double registration. So using both might not be the correct way to do things :)

 

So I'll keep the registerGlobalEntityID and remove the registerModEntity (I would like to use the eggs for testing).

 

The registerModEntity as a few other parameters trackingRange, updateFrequency and a boolean called sendsVelocityUpdates. Which I can not set when using the other register method. Could it be: one is for registering the entity in the client side methods (with the eggs) and one for the server side methods (with the updateFrequency etc...) <- wild guessing here :D

 

running minecraft on Mac OS X - Sierra --- creating code since 1986 ... --- मेरा दिल भारतवासी है!

width=289 height=100http://www.arno-saxena.de/pictures/chococraft/banner_signature.png[/img]

Link to comment
Share on other sites

That's weird that you get the error even with the right order. It works for me. Could you provide the code where you register your entities?

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

 

    
@Init
public void loadChocoCraft(FMLInitializationEvent loadEvent)
{
   this.createItemInstances();
    	
   this.createBlockInstances();
    	
   this.addSmeltings();

   this.addRecipes();

   ClientProxyChocoCraft.registerRenderInformation();

   this.registerChocobos();

   //EntityRegistry.addSpawn(EntityChocoboYellow.class, 100, 5, 8, EnumCreatureType.creature, BiomeGenBase.biomeList);

   GameRegistry.registerWorldGenerator(new WorldGenGysahls());
        
   proxy.registerRenderThings();
}


private void registerChocobos()
{

   // Chicobo
   int eggColChicobo = (170 << 16) + (70 <<  + 250;
   int eggDotsColChicobo = (250 << 16) + (250 <<  + 0;
   int globUniEntIdChicobo = EntityRegistry.findGlobalUniqueEntityId();
   String entNameChicobo = "Chicobo";
   LanguageRegistry.instance().addStringLocalization("entity.Chicobo.name", "en_US", "Chicobo");
   EntityRegistry.registerGlobalEntityID(EntityChicobo.class, entNameChicobo, globUniEntIdChicobo, eggColChicobo, eggDotsColChicobo);
   EntityRegistry.registerModEntity(EntityChicobo.class, entNameChicobo, chicoboEntityId, instance, 10, 10, true);

   // Yellow
   int eggColYellow = (253 << 16) + (206 <<  + 125;
   int eggDotsColYellow = (178 << 16) + (147 <<  + 85;
   int globUniEntIdYellow = EntityRegistry.findGlobalUniqueEntityId();
   String entNameYellow = "ChocoboYellow";
   LanguageRegistry.instance().addStringLocalization("entity.ChocoboYellow.name", "en_US", "Yellow Chocobo");
   EntityRegistry.registerGlobalEntityID(EntityChocoboYellow.class, entNameYellow, globUniEntIdYellow, eggColYellow, eggDotsColYellow);
   EntityRegistry.registerModEntity(EntityChocoboYellow.class, entNameYellow, chocoboYellowEntityId, instance, 10, 10, true);

   // the block above for 9 different entities
        
}

 

 

is creating the following entries in the log file

 

 

2012-09-24 22:24:58 [FINER] [ForgeModLoader] Posting state event FMLInitializationEvent to mod FML

2012-09-24 22:24:58 [FINER] [ForgeModLoader] State event FMLInitializationEvent delivered to mod FML

2012-09-24 22:24:58 [FINER] [ForgeModLoader] Posting state event FMLInitializationEvent to mod Forge

2012-09-24 22:24:58 [FINER] [ForgeModLoader] State event FMLInitializationEvent delivered to mod Forge

2012-09-24 22:24:58 [FINER] [ForgeModLoader] Posting state event FMLInitializationEvent to mod ChocoCraft

2012-09-24 22:24:58 [FINE] [ForgeModLoader] Skipping automatic mod ChocoCraft entity registration for already registered class chococraft.common.entities.EntityChicobo

2012-09-24 22:24:58 [FINE] [ForgeModLoader] Skipping automatic mod ChocoCraft entity registration for already registered class chococraft.common.entities.colours.EntityChocoboYellow

2012-09-24 22:24:58 [FINE] [ForgeModLoader] Skipping automatic mod ChocoCraft entity registration for already registered class chococraft.common.entities.colours.EntityChocoboGreen

2012-09-24 22:24:58 [FINE] [ForgeModLoader] Skipping automatic mod ChocoCraft entity registration for already registered class chococraft.common.entities.colours.EntityChocoboBlue

2012-09-24 22:24:58 [FINE] [ForgeModLoader] Skipping automatic mod ChocoCraft entity registration for already registered class chococraft.common.entities.colours.EntityChocoboWhite

2012-09-24 22:24:58 [FINE] [ForgeModLoader] Skipping automatic mod ChocoCraft entity registration for already registered class chococraft.common.entities.colours.EntityChocoboBlack

2012-09-24 22:24:58 [FINE] [ForgeModLoader] Skipping automatic mod ChocoCraft entity registration for already registered class chococraft.common.entities.colours.EntityChocoboGold

2012-09-24 22:24:58 [FINE] [ForgeModLoader] Skipping automatic mod ChocoCraft entity registration for already registered class chococraft.common.entities.colours.EntityChocoboPink

2012-09-24 22:24:58 [FINE] [ForgeModLoader] Skipping automatic mod ChocoCraft entity registration for already registered class chococraft.common.entities.colours.EntityChocoboRed

2012-09-24 22:24:58 [FINE] [ForgeModLoader] Skipping automatic mod ChocoCraft entity registration for already registered class chococraft.common.entities.colours.EntityChocoboPurple

2012-09-24 22:24:58 [FINER] [ForgeModLoader] State event FMLInitializationEvent delivered to mod ChocoCraft

2012-09-24 22:24:58 [FINER] [ForgeModLoader] Posting state event FMLInitializationEvent to mod mod_SpawnerGUI

2012-09-24 22:24:58 [FINER] [ForgeModLoader] State event FMLInitializationEvent delivered to mod mod_SpawnerGUI

2012-09-24 22:24:58 [FINER] [ForgeModLoader] Posting state event FMLInitializationEvent to mod Millenaire

2012-09-24 22:24:58 [FINE] [ForgeModLoader] Skipping automatic mod Millenaire entity registration for already registered class org.millenaire.common.MillVillager$MLEntityGenericAsymmFemale

2012-09-24 22:24:58 [FINE] [ForgeModLoader] Skipping automatic mod Millenaire entity registration for already registered class org.millenaire.common.MillVillager$MLEntityGenericSymmFemale

2012-09-24 22:24:58 [FINE] [ForgeModLoader] Skipping automatic mod Millenaire entity registration for already registered class org.millenaire.common.MillVillager$MLEntityGenericMale

2012-09-24 22:24:58 [FINE] [ForgeModLoader] Skipping automatic mod Millenaire entity registration for already registered class org.millenaire.common.FarmAnimal$FarmPig

2012-09-24 22:24:58 [FINE] [ForgeModLoader] Skipping automatic mod Millenaire entity registration for already registered class org.millenaire.common.FarmAnimal$FarmCow

2012-09-24 22:24:58 [FINE] [ForgeModLoader] Skipping automatic mod Millenaire entity registration for already registered class org.millenaire.common.FarmAnimal$FarmChicken

2012-09-24 22:24:58 [FINE] [ForgeModLoader] Skipping automatic mod Millenaire entity registration for already registered class org.millenaire.common.FarmAnimal$FarmSheep

2012-09-24 22:24:58 [FINE] [ForgeModLoader] Skipping automatic mod Millenaire entity registration for already registered class org.millenaire.common.EntityWallDecoration

 

 

looks like Millenaire has similar effects ... (I'm running some other mods too, to see if I'll have no compatibility problems ...

running minecraft on Mac OS X - Sierra --- creating code since 1986 ... --- मेरा दिल भारतवासी है!

width=289 height=100http://www.arno-saxena.de/pictures/chococraft/banner_signature.png[/img]

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.