Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Datagen generating redundant item models, even though it shouldn't. #4303

Open
Fellteros opened this issue Dec 16, 2024 · 8 comments
Open

Datagen generating redundant item models, even though it shouldn't. #4303

Fellteros opened this issue Dec 16, 2024 · 8 comments

Comments

@Fellteros
Copy link

Github repo
Hi, I've come across this when using my ModelProvider. I've normally added a few new blocks, to which I wanted to do the item and block models manually (vertical grass slab and stairs to be exact). But when I did that and ran the datagen, it generated item models for those blocks, even though they're not in my ModelProvider.

Here are steps to reproduce this issue:

  • register a block
  • create a item model JSON in resources/assets/mod_id/items for this block
  • run a datagen with ModelProvider registered

I have a few custom datagen methods, tho it shouldn't be them. I tested this in my other mod without such methods, and had the same problem.

@cputnam-a11y
Copy link

I'm pretty sure this is a vanilla feature.

@Fellteros
Copy link
Author

So mixing in the vanilla methods is the answer?

@Linguardium
Copy link

no, calling BlockStateModelGenerator#excludeFromSimpleItemModelGeneration in your ModelProvider's generateBlockStateModels method is

@cputnam-a11y
Copy link

no, calling BlockStateModelGenerator#excludeFromSimpleItemModelGeneration in your ModelProvider's generateBlockStateModels method is

Quoted

@Fellteros
Copy link
Author

I forgot to mention that I use 1.21.4, in which this method no longer exist, so far with no replacement.

@Linguardium
Copy link

Linguardium commented Jan 6, 2025

1.21.4 uses item asset generation. are you manually generating your item model definition files? this should have no issues with your own models as you can datagen the item model definitions without generating the model and it wont automatically generate a model either.

it sounds like this is not a models issue but an item model definition issue where you manually generate your item model definition (assets/namespace/items/youritem.json) rather than the model itself (assets/namespace/models/item/youritem.json)

fabric api already filters out autogenerating stuff from mods other than your own. I could see this beaing a feature request for an item model definition exclusion as well added to the FabricModelProvider

@Fellteros
Copy link
Author

Fellteros commented Jan 7, 2025

I wrote the JSON item model definitions by hand, because I wanted to have them tinted. When I tried generating them with the tint, it generated both the tinted version and the default redundant JSON.

@Linguardium
Copy link

I wrote the JSON item model definitions by hand, because I wanted to have them tinted. When I tried generating them with the tint, it generated both the tinted version and the default redundant JSON.

This seems to work fine for me when generating a tinted layered item model and item model definition.

// register a normal layer0 item model.
        Models.GENERATED.upload(item, TextureMap.layer0(item), itemModelGenerator.modelCollector);
// register the item model definition
        itemModelGenerator.output.accept(item,
            ItemModels.tinted(ModelIds.getItemModelId(item), new DyeTintSource(8606770))
        );

or if you are using the block model with a tintsource

// the block model would be generated from the "generateBlockStateModels" method already
// just register the item model definition pointing to the block model
        itemModelGenerator.output.accept(item,
            ItemModels.tinted(ModelIds.getBlockModelId(block), new DyeTintSource(8606770))
        );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants