Jump to content

SOLVED [1.19.2] How to attach a custom renderer to an item?


TheRealJaws

Recommended Posts

Hi there,
I've been trying to figure this out but no luck so far, how do I attach a custom renderer to an item in 1.19? Do I need to do it indirectly by attaching an entity to the item and rendering that instead or something?
I won't be able to accomplish what I want to do in the render with a .json model.
Thanks

Edited by TheRealJaws
Query is solved
Link to comment
Share on other sites

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

So I need a line like this correct?
 

itemRenderer = new ItemRenderer(Minecraft.getInstance().getBlockEntityRenderDispatcher(),Minecraft.getInstance().getEntityModels());

and then a model with is isCustomRenderer set to true, with
 

  @Override
    public void initializeClient(Consumer<IClientItemExtensions> consumer) {
        consumer.accept(new IClientItemExtensions() {
            @Override
            public @Nullable Font getFont(ItemStack stack, FontContext context) {
                return IClientItemExtensions.super.getFont(stack, context);
            }

            @Override
            public BlockEntityWithoutLevelRenderer getCustomRenderer() {
                return workoutmc.itemRenderer;
            }
        });

on my item,

and then where do I attach the model to the item?

Link to comment
Share on other sites

There's over a thousand examples on github.

Find one that is up-to-date and suites your taste and what you are trying to do.

https://github.com/search?l=Java&q=BlockEntityWithoutLevelRenderer&type=Code

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

  • TheRealJaws changed the title to SOLVED [1.19.2] How to attach a custom renderer to an item?

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.