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 there,


I know I can load an existing block model like:

 

        BlockRendererDispatcher blockRenderer = Minecraft.getInstance().getBlockRendererDispatcher();
        IBakedModel bakedModel = blockRenderer.getBlockModelShapes().getModel(state);
        IModelData data = bakedModel.getModelData(world, pos, state, ModelDataManager.getModelData(world, pos));

        blockRenderer.getBlockModelRenderer().renderModel(world, bakedModel, state, pos, matrixStackIn, bufferIn.getBuffer(Atlases.getSolidBlockType()), false, new Random(), 42, combinedOverlayIn, data);

 

What I'm wondering is how I can load a model that doesn't have an associated item, block or entity?

No signature for you!

  • Author
1 minute ago, Turtledove said:

What is it you're trying to do? Is it going to be an entity, item, or what? You can load jsons, objs, b3ds, or if you've got it set up in a java class, that works well too. https://mcforge.readthedocs.io/en/latest/models/files/

It's for a TileEntityRenderer. I'd like to animate the position of this extra model.

 

Would I use modelLoader.getModelOrMissing() for this purpose?

 

I suppose something I could do is create "nothing" blocks that use the model and then load that using block state; but I'm not sure if that's a good way to go about it.

No signature for you!

Hi

This example project might give you some inspiration (see mbe21)

https://github.com/TheGreyGhost/MinecraftByExample

 

If you want a block model, the easiest way is like you said to register a block with a model, let Forge load it and stitch the texture etc, then grab it using the code in your question.  The block associated with your TileEntity is probably the best spot.  If your tileentity block already has another model, you can add a blockstate property purely for the purposes of accessing the correct model.  Or create an entirely new, unused block.

 

However if you really don't like that idea, you can access the ModelRegistryEvent and ModelLoader.addSpecialModel() instead.

 

-TGG

  • Author
20 hours ago, TheGreyGhost said:

Hi

This example project might give you some inspiration (see mbe21)

https://github.com/TheGreyGhost/MinecraftByExample

 

If you want a block model, the easiest way is like you said to register a block with a model, let Forge load it and stitch the texture etc, then grab it using the code in your question.  The block associated with your TileEntity is probably the best spot.  If your tileentity block already has another model, you can add a blockstate property purely for the purposes of accessing the correct model.  Or create an entirely new, unused block.

 

However if you really don't like that idea, you can access the ModelRegistryEvent and ModelLoader.addSpecialModel() instead.

 

-TGG

Thanks for that.

 

I ended up just registering a block for it and loading the model like normal.

No signature for you!

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.