• Forums

Navigation

  • Home
  • Style Guide
  • Getting Started
    • Home
    • Structuring Your Mod
    • Forge Update Checker
    • Debug Profiler
  • Concepts
    • Sides
    • Resources
    • Data
    • Registries
    • Mod Lifecycle
    • Internationalization and Localization
  • Blocks
    • Home
    • BlockStates
    • Interaction
  • Block Entities
    • Home
    • Renderer
  • Items
    • Home
    • Loot Modification
  • Models
    • Intro to Models
    • Model Files
    • BlockStates
      • Intro to BlockState JSON
    • Coloring Textures
    • Item Properties
    • Advanced Models
      • BakedModel
      • Perspective
      • Item Overrides
  • Rendering
    • BlockEntityWithoutLevelRenderer
      • Using BlockEntityWithoutLevelRenderer
  • Data Generation
    • Introduction
    • Model Providers
  • Events
    • Basic Usage
  • Networking
    • Home
    • Overview
    • SimpleImpl
    • Entities
  • Data Storage
    • Capabilities
    • Saved Data
  • Utilities
    • Recipes
    • Tags
  • Effects
    • Particles
    • Sounds
  • Conventions
    • Versioning
    • Locations
  • Advanced Topics
    • Access Transformers
  • Contributing to Forge
    • Getting Started
    • PR Guidelines
  • Legacy Versions
    • Home
    • Porting to 1.17

BlockEntityWithoutLevelRenderer

BlockEntityWithoutLevelRenderer is a method to handle dynamic rendering on items. This system is much simpler than the old ItemStack system, which required a BlockEntity, and did not allow access to the ItemStack.

Using BlockEntityWithoutLevelRenderer

BlockEntityWithoutLevelRenderer allows you to render your item using public void renderByItem(ItemStack itemStack, TransformType transformType, PoseStack poseStack, MultiBufferSource bufferSource, int combinedLight, int combinedOverlay).

In order to use an BEWLR, the Item must first satisfy the condition that its model returns true for BakedModel#isCustomRenderer. Once that returns true, the Item’s BEWLR will be accessed for rendering. If it does not have one, it will use the default ItemRenderer#getBlockEntityRenderer.

To set the BEWLR for an Item, an anonymous instance of IItemRenderProperties must be consumed within Item#initializeClient. Within the anonymous instance, IItemRenderProperties#getItemStackRenderer should be overridden to return the instance of your BEWLR:

// In your item class
@Override
public void initializeClient(Consumer<IItemRenderProperties> consumer) {
  consumer.accept(new IItemRenderProperties() {

    @Override
    public BlockEntityWithoutLevelRenderer getItemStackRenderer() {
      return myBEWLRInstance;
    }
  });
}

Important

Each mod should only have one instance of a custom BEWLR.

That is it, no additional setup is necessary to use a BEWLR.

Built with MkDocs using a custom theme. Hosted by Read the Docs.
Enable Dark Theme