#How to get instance of ItemModel.Unbaked?

14 messages · Page 1 of 1 (latest)

amber canopy
#

exact class: net.minecraft.client.render.item.model.ItemModel.Unbaked
I need 2 models (1 vanila and 1 custom) to put in ItemModels.condition:

@Override
    public void generateItemModels(ItemModelGenerator itemModelGenerator) {
        itemModelGenerator.output.accept(
                Items.TRIDENT,
                ItemModels.condition(
                        new RiptideBooleanProperty(),
                        /* model 1 */
                        /* model 2 */
                )
        );
    }
nimble moat
#

Um check vanilla how they do it? 😭

amber canopy
#

I can`t even find any usages of ItemModels.condition() or ConditionalItemModel .-.

nimble moat
#

They should have the trident item datagen "atleast the items one` ?

amber canopy
#

found those, gonna try now, ty :D

amber canopy
nimble moat
#

the output? nvm hm show me where its used by the model

amber canopy
#
ItemModelGenerator.class
public final Identifier upload(Item item, Model model) {
        return model.upload(ModelIds.getItemModelId(item), TextureMap.layer0(item), this.modelCollector);
    }

public final void registerTrident(Item item) {
        ItemModel.Unbaked unbaked = ItemModels.basic(this.upload(item, Models.GENERATED));
        ItemModel.Unbaked unbaked2 = ItemModels.special(ModelIds.getItemSubModelId(item, "_in_hand"), new TridentModelRenderer.Unbaked());
        ItemModel.Unbaked unbaked3 = ItemModels.special(ModelIds.getItemSubModelId(item, "_throwing"), new TridentModelRenderer.Unbaked());
        ItemModel.Unbaked unbaked4 = ItemModels.condition(ItemModels.usingItemProperty(), unbaked3, unbaked2);
        this.output.accept(item, createModelWithInHandVariant(unbaked, unbaked4));
    }
amber canopy
# amber canopy ```Java ItemModelGenerator.class public final Identifier upload(Item item, Model...
Model.class
public Identifier upload(Identifier id, TextureMap textures, BiConsumer<Identifier, ModelSupplier> modelCollector) {
        Map<TextureKey, Identifier> map = this.createTextureMap(textures);
        modelCollector.accept(id, (ModelSupplier)() -> {
            JsonObject jsonObject = new JsonObject();
            this.parent.ifPresent(identifier -> jsonObject.addProperty("parent", identifier.toString()));
            if (!map.isEmpty()) {
                JsonObject jsonObject2 = new JsonObject();
                map.forEach((textureKey, identifier) -> jsonObject2.addProperty(textureKey.getName(), identifier.toString()));
                jsonObject.add("textures", jsonObject2);
            }

            return jsonObject;
        });
        return id;
    }
nimble moat
amber canopy
#

ye, but it need modelCollector as a 3rd arg

#

mb gonna try some mixin later

amber canopy