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

Hi,

 

I want to change between two models for an entity I have, depending on whether or not it is being ridden. I was thinking of something like an if(isBeingRidden) statement inside the entity's Model class to change the model, but this is an EntityType, not an EntityModel, method.

 

I tried to see how Minecraft does it (let's say for a Zombie attacking) but as of now, I can't access any vanilla Entity or Render class. I did notice the use of DataParameters in Entity classes; and thus used one to store and update whether or not my entity is being ridden. I'm not sure how, and where to use it, though.

 

Thanks,

Kres

'Everyone is a genius,

But if you judge a fish by its ability to climb trees, it will live its whole life believing that it is stupid.'

 

-Albert Einstein

----------------------------------------------------------

If Arthas's horse is named "Invincible", then why can I clearly see him?

  • Author

I've sorted myself out so I'm answering this in order for this thread to be closed.

 

All I had to do was to create a boolean isMounted in my entity's model class, and call the doRender() method in my entity's renderer class; where inside I would have checked if the entity isBeingRidden() and change the isMounted boolean accordingly within doRender().

 

Example:

	public void doRender(ScorpionEntity entity, double x, double y, double z, float entityYaw, float partialTicks) {
		boolean state = entity.isBeingRidden();
		ScorpionModel<ScorpionEntity> scorpion = this.getEntityModel();
		scorpion.isMounted = state;

		super.doRender(entity, x, y, z, entityYaw, partialTicks);
	}

Works like a charm

'Everyone is a genius,

But if you judge a fish by its ability to climb trees, it will live its whole life believing that it is stupid.'

 

-Albert Einstein

----------------------------------------------------------

If Arthas's horse is named "Invincible", then why can I clearly see him?

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.