Jump to content

Mob ID Woes


TheMineshafter

Recommended Posts

Hey guys, I hate to open another topic after somebody just helped me, but I ran across another nasty problem. In my previous post (link: http://www.minecraftforge.net/forum/index.php?topic=35356.0), somebody told me that I shouldn't use global ids, since they are not compatible with mod packs due to their limitation. I was told that I should use the EntityRegistry only, and make my own spawn eggs. I was able to do this, and the eggs work perfectly fine. However, when I get rid of global ids, the eggs no longer spawn the mob. Here is my code:

 

 

Main Class:

http://pastebin.com/Pf9SWeK5

 

Spawn Egg Registry:

http://pastebin.com/CzjmNUKx

 

Mob Registry (Drider):

http://pastebin.com/eLN92yjb

 

Config Class:

http://pastebin.com/jUqGQfg7

 

 

 

 

Link to comment
Share on other sites

First of all, our entity registrations are wrong. Do not use

findGlobalUniqueEntityId

or

registerGlobalEntityID

. Only use

registerModEntity

, start with ID 0 and increase by one for each next entity. To create spawn eggs use the version of

registerModEntity

that takes the two color arguments, do not manually put stuff into

EntityList

.

Also do not use

LanguageRegistry

, use a lang file.

For your spawn registration you can probably optimize that code by using a for loop and a list of biomes instead of copying the same line over and over again.

 

As for why your config doesn't influence your spawn rates, well, you load your config file after registering the spawn entries...

We already told you how to do it without custom spawn eggs.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

First of all, our entity registrations are wrong. Do not use

findGlobalUniqueEntityId

or

registerGlobalEntityID

. Only use

registerModEntity

, start with ID 0 and increase by one for each next entity. To create spawn eggs use the version of

registerModEntity

that takes the two color arguments, do not manually put stuff into

EntityList

.

Also do not use

LanguageRegistry

, use a lang file.

For your spawn registration you can probably optimize that code by using a for loop and a list of biomes instead of copying the same line over and over again.

 

As for why your config doesn't influence your spawn rates, well, you load your config file after registering the spawn entries...

We already told you how to do it without custom spawn eggs.

 

We already told you how to do it without custom spawn eggs.

OP is on 1.7.10 ... (seriously, update).

 

Did you seriously create a separate class for every. single. SpawnEgg?

Seriously?

 

You need one class and one Item. Store the type of Mob to spawn (it's String (!) ID) in the ItemStacks NBT data instead of taking up a gazillion Item IDs.

 

Also (again!): Do not use LanguageRegistry. Use a .lang file.

 

You don't need to make the Entity IDs configurable. It serves no purpose and just confuses users.

 

About all those addSpawn calls... You do know that addSpawn has a varargs parameter, right? Use it! (Don't know what varargs means? Learn java.)

 

First of all, there is no version of registerModEntity that takes the two color arguments for spawn eggs. I tried looking through the forge library and I couldn't find it. Second, these classes are not permanent, since I'm still figuring out how to use only one class (I'm making normal items and using the onItemUse method to spawn the mobs. It's the simplest way I found). Third, I am going to create the lang file, but I'm using the language registry method until I fix the spawn egg problem. One problem at a time. As for NBT and varargs, I am learning how to use Java as I'm working on this mod. I know basic to intermediate java, but there are also things in the language that I'm not familiar with. Could you guys post an example of the registerModEntity that takes the color arguments? That would really help.

Link to comment
Share on other sites

So then how would I go about doing that? I searched for tutorials but none of them were very helpful. The code would come out as confusing and messy. However, I realized that I could just use normal items to spawn entities using the onItemClick function. This turned out to be much simpler for me, but now there is an issue with the ids. When i stopped using global entity ids, the eggs began spawning the wrong mobs.

Link to comment
Share on other sites

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.