Jump to content

How to use item property override, jsons and inheritance?


Recommended Posts

Posted

I want to create items which will render differently depending on information stored in an ItemStack capability. My goal is a bit similar to how vanilla items are rendered with a durability bar: the underlying item remains the same but there is another layer rendered on top which is one of a few textures. The possible overlay textures are the same for all the different items that have this property (just like the vanilla durability bar is the same for all items with durability), but the underlying item texture is different for each.

 

I think I'll need to use item property override like the vanilla bow, but I just don't really understand how and can't find any tutorials or explanations. I can't figure out how the property override gets converted into json-usable information. I also really don't want to have to make multiple model files for every single item when they will all be using the same set of properties and overlays, so I'd like to figure out how to make some kind of abstract json that can be 'subclassed' without having to redefine things every time. But, I also don't know how to do that. And when I try searching for minecraft json help I mostly just find stuff about blockstates. A summary of my questions:

 

1. How exactly does item property override work? Is there a tutorial I can refer to? The

apply

method returns a float, but where does this go and how is it converted into different item textures?

2. How does inheritance work with json models? How would I go about making a parent model which uses the same overlays for the same item property override, but with a base texture that can be specified for each item type?

Posted

I've made some progress. I've got a working item property override for a single item now. But the downsides is, I had to make four models for a single item that has this property. And I'm planning to have a lot of items with the same overlay property. Does anyone have any idea if I can make a generic/abstract version of the model (which applies the overlay textures according to the item property) which I can then extend by just adding the item's base textures? It seems so excessive to have to make endless really simple models which all have the same overrides. D:

 

Edit: for reference, I'll show how I'm using property override. My item class:

 

 

  Reveal hidden contents

 

 

My item model json:

 

  Reveal hidden contents

 

 

And the extra model files for the variants:

 

  Reveal hidden contents

 

 

And as I said, the property override and models are working as they should - I'm just hoping there's a more efficient way than creating many files for every item.

  • 1 year later...
Posted

Please don’t necro old threads, if you have an issue please make your own thread.

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

  Reveal hidden contents

 

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.