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 am having a problem with being able to have a 3D rendered model when the item is equipped, while also being able to have a default texture for the model in the GUI. I have tried using IPerspectiveAwareModel to do this by checking if the camera transform is equal to the GUI - if that is true I then return the baked quads for the texture (built-in/generated model) in getGeneralQuads(). Isn't there a better way for achieving a 3D model when equipped, and a regular texture for the GUI? Any help is appreciated!

 

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

  • Author

It is not that simple. If it were, it'd already be solved. I have tried returning a different model based on perspective - that didn't work. I also tried returning the texture model's baked quads when the camera transform = GUI. It looked like it kind of worked, though the transform matrices were messed up due to the huge problem of each model having to use the super model's transform matrices. Also, may I ask what the getTexture() method is for in IBakedModel and it's subclasses? It seems to do nothing when returning different models' textures. Anyway, if you can use IPerspectiveAwareModel to do this, how so? Where would you return this model, it's baked quads, or it's texture? Again, thanks for any help in advance.

 

Here is the current code that returns the super model and the super model's transform matrices:

        @Override
public Pair<IBakedModel, Matrix4f> handlePerspective(TransformType transformType)
{	
	this.transformType = transformType;

	switch(transformType)
	{
	case FIRST_PERSON : RenderItem.applyVanillaTransform(super.getItemCameraTransforms().firstPerson); break;
	case THIRD_PERSON : RenderItem.applyVanillaTransform(super.getItemCameraTransforms().thirdPerson); break;
	case GUI : RenderItem.applyVanillaTransform(super.getItemCameraTransforms().gui); break;
	case HEAD : RenderItem.applyVanillaTransform(super.getItemCameraTransforms().head); break;
	default : break;
	}

	return Pair.of(this, null);	
}

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

  • Author

Well, I managed to get it working exactly to how I want it. Forgot I had to override the isGui3d() method (silly mistake!) along with returning a different IBakedModel with its own transforms in handlePerspective(). In the earlier post, you were correct, IPerspectiveAwareModel is all you need. Thanks again!

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

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.