Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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?

Don't blame me if i always ask for your help. I just want to learn to be better :)

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.

  • Author

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 😅

Don't blame me if i always ask for your help. I just want to learn to be better :)

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.