Jump to content

[SOLVED] [1.8] Item Texture For Gui, Model When Equipped


EverythingGames

Recommended Posts

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]

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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]

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.