Jump to content

Recommended Posts

Posted

Following the comments from diesieben07 in this thread, I thought I'd try and implement my own spawn egg that didn't use global IDs.

 

I quickly ran into an issue: the entity kill statistics rely on

EntityList.EntityEggInfo

, which is tied to the global ID list. I can create my own stats for each of my entities and increment them myself; but they won't show up in the vanilla statistics GUI (the mobs section of which also relies on global IDs).

 

Is there any way to have kill statistics that display in the vanilla GUI without global IDs?

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

This is only for a test mod which I don't plan to update to 1.8, I have a separate test mod for each version.

 

I ended up going with a slightly different solution, but your reference to invalid IDs pointed me in the right direction. Thanks.

 

The solution I ended up with was using IDs in the range [256,

Short.MAX_VALUE

] and calling

EntityList.addMapping

instead of

EntityRegistry.registerGlobalEntityID

to add the spawn egg. You can see the code here.

 

In the process of testing this, I realised that Biomes O' Plenty was already using IDs >= 300 for its own entities; so I found its implementation here. This is simpler than mine, but it doesn't add the class to ID mapping so kill statistics don't work.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Is the basic premise of what I'm doing (using IDs >= 256 with vanilla spawn eggs) correct? Is there a specific part of my code you think is unnecessary?

 

EntityRegistry.registerGlobalEntityID

will log an ERROR message when the ID isn't an unsigned byte, though it will still add the mapping and the egg with

EntityList.addMapping

. My code calls the same method.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

For the stats to be incremented, the class to ID mapping is needed. For the egg to work, the ID to class mapping is needed. For the

/summon

command's auto-complete to work (not a big priority), the string (name) to ID mapping is needed (though the IDs are never actually used).

 

Should I let FML create the class <-> name mappings with

EntityRegistry.addModEntity

and then manually add the three ID mappings and the egg?

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Okay, I thought I could use the vanilla spawn egg; but I'll implement my own egg and manually increment the stats.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.