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

So I'm wondering how I can make my mob do sort of a key frame animation. Right now I've got a simple rotation: 

public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn) {

        if (playerRightClicked) {
            Block13.rotateAngleX = 2F;
        } else {
            Block13.rotateAngleX = 0F;
        }
    }

 

I'm hoping to somehow make it so each tick causes the Block13 to be rotated 0.5 more. Is there an easy way to accomplish this?

Block13.rotateAngleX = Math.toRadians((float)entityIn.ticksExisted / 2);

 

Additionally models are singletons. If you change a value of a fieldin your model it will apply to all your entities. I am talking about this:

1 hour ago, Electric said:

if (playerRightClicked) {

 

  • Author
6 hours ago, V0idWa1k3r said:

Block13.rotateAngleX = Math.toRadians((float)entityIn.ticksExisted / 2);

 

Additionally models are singletons. If you change a value of a fieldin your model it will apply to all your entities. I am talking about this:

 

Thank you so much! Now I've got the beginning of an animation, but is there a way to reset the entityIn#ticksExisted on each right click, so that the animation will begin at the same point each time?

 

And oops, I didn't realize this makes each of my entities do the same animation at the same time. How could I have the animation apply only to the entity being interacted with? I'm guessing it has something to do with entityIn#getEntityId, but I'm not sure. Does everything I do in the mob's model class affect each of my custom mobs?

10 minutes ago, Electric said:

is there a way to reset the entityIn#ticksExisted on each right click, so that the animation will begin at the same point each time?

Have your own counter field in your entity class and increment it each tick, then reset when needed.

 

12 minutes ago, Electric said:

How could I have the animation apply only to the entity being interacted with?

Move this field to your entity class, then access it from your model when needed. This is a basic OOP concept.

 

12 minutes ago, Electric said:

Does everything I do in the mob's model class affect each of my custom mobs?

As I've said models are singletons. Any change made to the model will affect rendering of all your entities which use that model.

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.