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

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

  • Author
@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

  • Author

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

  • Author

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

  • Author

I only used ModelBakery.registerItemVariants(item,model2d,model3d ); this time to register, no console errors, missing model model for all views

  • Author

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...

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.