JimiIT92 Posted April 26, 2023 Posted April 26, 2023 In my mod I'm dealing with some custom chests and, for the item rendering, I came across the BlockEntityWithoutLevelRenderer to render the item model of the chest inside the inventory. Now, everything works, but I've noticed that I have to call an instance of this class in the custom chest item, like so @Override public void initializeClient(final @NotNull Consumer<IClientItemExtensions> consumer) { consumer.accept(new IClientItemExtensions() { @Override public BlockEntityWithoutLevelRenderer getCustomRenderer() { return MineWorld.getItemsRenderer(); } }); } where the MineWorld.getItemsRenderer is a method that returns a new instance of my custom BEWLR class, or an existing one if it has been already initialized. What got my attention is that if I want to add another item with a custom model I have to add this same method in that item class as well. Is this the optimal approach or there's a better, centralized one? Maybe one that would also prevent me from registering a custom item for the chest, and instead checks for the actual chest block item? Quote Don't blame me if i always ask for your help. I just want to learn to be better
ChampionAsh5357 Posted April 27, 2023 Posted April 27, 2023 18 hours ago, JimiIT92 said: What got my attention is that if I want to add another item with a custom model I have to add this same method in that item class as well. Is this the optimal approach or there's a better, centralized one? Basically, a subtype of the Item class. Quote
JimiIT92 Posted April 27, 2023 Author Posted April 27, 2023 Yeah, but that would work if every item that I need to render in a certain way in the inventory are direct childs of Item. If I have some items that extend another vanilla item class (for example something that extends TridentItem to make some spears) I have to specify that code inside the custom trident item class as well 😅 Quote Don't blame me if i always ask for your help. I just want to learn to be better
ChampionAsh5357 Posted April 27, 2023 Posted April 27, 2023 Not much you can do there other than just create anonymous classes. Quote
Recommended Posts
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.