Jump to content

Reliable Entity ID and Spawn Particle help


wog890

Recommended Posts

I am working on making a mob entity that will attempt to find a mate for itself. This type of animal mates for life so obviously I need a way to save which entity is mated to which. I attempted to do it much like entities save their owner (using player.getUsername), but instead of username, because animals don't have usernames, I was using EntityID, since this also must be unique. This works great the first time and the AI with it, but if I reload the world, the entity Id's of all my animal's are different.

 

Because of this, they re-mate. If I re-load the world, this happens again. I can't seem to find a way to create a consistent and guaranteed unique way to do this. Does anyone else have any ideas how to do this?

 

My second issue is, when the animal first finds a mate, I would like it to release a couple heart particles, like wolves and other minecraft animals do while doing hanky panky activities. I used the following code (from EntityAIMate)

 

Random var2 = this.theAnimal.getRNG();

            for (int var3 = 0; var3 < 7; ++var3)
            {
                double var4 = var2.nextGaussian() * 0.02D;
                double var6 = var2.nextGaussian() * 0.02D;
                double var8 = var2.nextGaussian() * 0.02D;
                this.theWorld.spawnParticle("heart", this.theAnimal.posX + (double)(var2.nextFloat() * this.theAnimal.width * 2.0F) - (double)this.theAnimal.width, this.theAnimal.posY + 0.5D + (double)(var2.nextFloat() * this.theAnimal.height), this.theAnimal.posZ + (double)(var2.nextFloat() * this.theAnimal.width * 2.0F) - (double)this.theAnimal.width, var4, var6, var8);
            }

 

But this didn't work. Anyone know anything to help?

 

Thanks in advanced for any and all help!

Link to comment
Share on other sites

You are probably spawning the particles on the server side, which doesn't do anything.

 

I guess that is possible, but the EntityAIMate works exactly the same way, using the same function that I'm using and running the same code, so if that works (and yes I checked, it does), I don't see why mine would run on the server side. I'll see if I can check for that though. Thank you

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.