Jump to content

Recommended Posts

Posted

I'm trying to make an Item that looks like a block (Has the model of a block with 6 same sides).

The Item should have a NBT tag where the block name and meta is stored (like minecraft:log, 2). It then gets the texture of that block that it is in NBT and applies it to its model.

So in the end I will have a Item that looks like any block and changes its texture based on NBT.

 

How would I go about creating something like this?

Posted (edited)

The only way I could think of is using block states, but someone will probably reply with a better way.

Edited by Awesome_Spider
Posted

I just realized that wasn't what you were asking. Ignore that.

Posted (edited)
22 hours ago, diesieben07 said:

You will need to write a custom model implementation (using ICustomModelLoader, IModel, IBakedModel and ItemOverrideList) and then bake new models on the fly based on contained block's model.

Oh dear, that sounds really complicated... I don't know why, but all model and rendering stuff seems to be the hardest thing about modding to me. Can you maybe try to explain what each of these elements do, or where I can find a tutorial or sample code? I didn't find any.

Edited by Tschipp
Posted
2 hours ago, diesieben07 said:
  • ICustomModelLoader: Basically what it says on the tin, this is something that knows how to take a model file (from the assets) and read/parse it. For example the OBJ loader knows how to read OBJ files.
  • IModel: A representation of a model's data in code. An IModel cannot be rendered, it merely "knows all the data" about the model, but still allows modification (e.g. retexturing or transformation). This is what's produced from ICustomModelLoader when it loads a model file.
  • IBakedModel: A compact model representation that can be rendered. You obtain this from the IModel and basically it just contains a list of BakedQuads. Every IBakedModel also has an ItemOverrideList associated with it, which allows the model to substitute a different model right before an Item is rendered based on that Item (this is what you need).

As for example, there are quite a few in the Forge codebase.

Thanks, just two more things: How and where do I register all this stuff and can you give me the link to the Forge codebase? I couldn't find it.

Posted (edited)
2 minutes ago, diesieben07 said:

You register your ICustomModelLoader in ModelRegistryEvent using ModelLoaderRegistry.registerLoader.

 

When you set up a MDK workspace you will have Forge as a library available to you. Alternatively you can find the code on Github.

Whoops, I thought you meant acutal examples. 

EDIT: Also, congrats on 5000 rep!

Edited by Tschipp

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.