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.

Forge 1.14: Using different wavefront models when rendering items in the inventory and when handheld.

Featured Replies

Posted

Hello guys!

I just managed to render wavefront models instead of the 2d textures for items in forge 1.14. Here is how I did it:

@SubscribeEvent
public static void onModelBakeEvent(ModelBakeEvent event) {
	registerModel(event, "minecraft:wooden_sword",		"rolecraft:item/wooden_sword.obj");
}

private static void registerModel(ModelBakeEvent event, String itemName, String modelPathWithFileType) {
	try {
		// Try to load an OBJ model (placed in src/main/resources/assets/examplemod/models/) REMEMBER *.obj
		IUnbakedModel model = ModelLoaderRegistry.getModelOrMissing(new ResourceLocation(modelPathWithFileType));

		if (model instanceof OBJModel) {
			// If loading OBJ model succeeds, bake the model and replace stick's model with the baked model
			IBakedModel bakedModel = model.bake(event.getModelLoader(), ModelLoader.defaultTextureGetter(), new BasicState(model.getDefaultState(), false), DefaultVertexFormats.ITEM);
			event.getModelRegistry().put(new ModelResourceLocation(itemName, "inventory"), bakedModel);
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}

 

While this looks great in-game, there are some problems with the GUIs. The item is rendered in a very unfortunate way in the GUI and in item frames, as you can see in the attached image. I want to rotate the sword 90 degrees around the z-axis when the sword is not rendered in an entity's hand. How do you suggest I do this?

 

Thanks in advance for your help :)

rendering.png

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.