Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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!

  • Author

I solved the first problem. Stopped programming for just a little bit and the idea came to me!

 

I'm still need help with the particles though.....

  • Author

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

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.