Jump to content

Mob Spawn substitution hook


SoundLogic

Recommended Posts

I was hoping that during the natural mob spawning events, we could have a hook that we could use to change the mob. The hook would pass along the entity to anything registered to receive it to a function that returned the mob after anything you wanted done to it was done.

I'm not sure how good that explanation was, so I am also going to try to explain it in code; basic code insert would be like this in SpawnerAnimals:

                                                            EntityLiving var38;

//existing code for reference
                                                            try
                                                            {
                                                                var38 = (EntityLiving)var21.entityClass.getConstructor(new Class[] {World.class}).newInstance(new Object[] {par0WorldServer});
                                                            }
                                                            catch (Exception var30)
                                                            {
                                                                var30.printStackTrace();
                                                                return var3;
                                                            }
//new code here
                                                            for (IEntitySpawnTransformer transformer : spawnTransformers)
                                                           {
                                                               var38=transformer.transform(var38,par0WorldServer,var17,var18,var19)
                                                          }
//continues with old code

This would help me with quite a few of the effects I am adding.

Thank you,

Sound Logic

Link to comment
Share on other sites

Well, I was hoping to transform it into another mob before the spawn check, and make it so that I could chain them properly, but I could include a chaining system seperate. I also suppose if I just kill it if a separate check doesn't work. Will LivingSpecialSpawnEvent trigger on mob spawners and such?

Link to comment
Share on other sites

.... You need something a lot different. There are many places around that spawn entities. You'll need to look into and figure out where you want to really hook in.

This one is specifically for when mobs spawn naturally. And for your intentions you just need to add a new spawn type like everything else.

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

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.