Jump to content

[1.10.2] Render Item 2d in inventory, 3d json model in hand?


Recommended Posts

Posted

Hello.

I'm trying to render an item with a 2d sprite in the inventory and a 3d json model while in hand, on ground, etc.

I think this is possible through the json system but either I can't figure out the tag structure, or it's not possible with the normal json system.

Google/forums searches have not given me any results.
Any help would be great, thanks

Posted
@Override
	public Pair<? extends IBakedModel, Matrix4f> handlePerspective(
			TransformType cameraTransformType) {
		switch(cameraTransformType)
		{
	
		case GUI: 
			if(Model2d instanceof IPerspectiveAwareModel){
				Pair<? extends IBakedModel, Matrix4f> result =((IPerspectiveAwareModel) Model2d).handlePerspective(cameraTransformType);
				return Pair.of([2dmodel],result);
			}
			return Pair.of([2dmodel],null);
			
		default: return Pair.of([3dmodel],null);
		}
	}

how's this? I don't know how to get my model for those brackets then

Posted (edited)

Okay. Fixed. What do I need to do with my item and this perspective model class?

I used this bit of code
 

@SubscribeEvent
	public void modelBakeEvent(ModelBakeEvent event)
	{

		IBakedModel model2d = event.getModelRegistry().getObject(MasterRegistrar.model2d);
		IBakedModel model3d = event.getModelRegistry().getObject(MasterRegistrar.model3d);

			ItemModelPerspective customModel = new ItemModelPerspective(model2d,model3d);
			
			event.getModelRegistry().putObject(MasterRegistrar.model2d, customModel);
		
	}

and the inventory model looks like a side projection of my 3d model, not the one with parent "item/generated",

Edited by Cleverpanda
Posted (edited)

I did, registered it with both model variants and the names for my 2d and 3d model files, that's just the mrl.
I also put the check in my handleperspective method in a similar way to the 2d one.

Edited by Cleverpanda
Posted (edited)

Okay, that got me to a point I could get everything working properly!
Now I need to apply some transforms for each case to make it look right, what code would I use to do that? I need to do multiple transform operations

 

EDIT: this can be done in the json now

Edited by Cleverpanda

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.