[GH-ISSUE #5548] Native hook to draw baked block models at a block every frame #1723

Open
opened 2026-11-02 15:49:12 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @JuanLuci on GitHub (Oct 31, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5548

Summary

A client hook that draws baked block models and item stacks at a block every frame, with a transform the mod sets per frame (rotation about an axis, translation, scale, texture scroll), in the entity pass and lit like the block. This is what Java mods get from a BlockEntityRenderer.

Why

Many mods draw part of a block apart from its baked model, every frame:

  • Moving parts: Create (shafts, cogs, belts, press and mixer heads, mechanical arm, bearings), Immersive Engineering (windmills, water wheels), Mekanism Generators (wind turbine blades).
  • Items shown on a block: Storage Drawers (the stored item on the front), Farmer's Delight (cutting board, skillet), Supplementaries (item shelf, pedestal), Botania (mana pool, petal apothecary).

The two routes on main today don't fit these:

  • API 58 native_world_drawn hands over raw wgpu with the world's matrices, but no block-model mesher, block atlas or block light, so every mod would rebuild the model pipeline.
  • API 59 display entities (native_summon, native_set_display) are server-driven, one entity per part. A turning shaft or a running belt becomes a stream of entity updates over the network.

Proposal

  • A client hook called for each visible mod block entity, for example native_block_entity_draw(pos, state, block_entity, partial_tick, &mut draw).
  • draw queues a baked model by id (a block model, or a partial model no blockstate names, see #5551) with a 4x4 transform, an item stack with a transform and display context, and an optional UV scroll.
  • Drawn with the block's packed light, culled with its chunk section, batched by model.
  • Paired with a render_shape of ENTITYBLOCK_ANIMATED for content-mod blocks (#5550), so the static mesh leaves those parts out.

How I did it on my fork

On my fork I draw Create's moving parts on the client through the block mesher: game/kinetics.rs, belts.rs, bearings.rs, arms.rs (b82d9d605, c119e5cd7). It is engine code there, not a native mod, so it would need this hook to become one.

Originally created by @JuanLuci on GitHub (Oct 31, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5548 ## Summary A client hook that draws baked block models and item stacks at a block every frame, with a transform the mod sets per frame (rotation about an axis, translation, scale, texture scroll), in the entity pass and lit like the block. This is what Java mods get from a BlockEntityRenderer. ## Why Many mods draw part of a block apart from its baked model, every frame: - Moving parts: Create (shafts, cogs, belts, press and mixer heads, mechanical arm, bearings), Immersive Engineering (windmills, water wheels), Mekanism Generators (wind turbine blades). - Items shown on a block: Storage Drawers (the stored item on the front), Farmer's Delight (cutting board, skillet), Supplementaries (item shelf, pedestal), Botania (mana pool, petal apothecary). The two routes on main today don't fit these: - API 58 `native_world_drawn` hands over raw wgpu with the world's matrices, but no block-model mesher, block atlas or block light, so every mod would rebuild the model pipeline. - API 59 display entities (`native_summon`, `native_set_display`) are server-driven, one entity per part. A turning shaft or a running belt becomes a stream of entity updates over the network. ## Proposal - A client hook called for each visible mod block entity, for example `native_block_entity_draw(pos, state, block_entity, partial_tick, &mut draw)`. - `draw` queues a baked model by id (a block model, or a partial model no blockstate names, see #5551) with a 4x4 transform, an item stack with a transform and display context, and an optional UV scroll. - Drawn with the block's packed light, culled with its chunk section, batched by model. - Paired with a `render_shape` of `ENTITYBLOCK_ANIMATED` for content-mod blocks (#5550), so the static mesh leaves those parts out. ## How I did it on my fork On my fork I draw Create's moving parts on the client through the block mesher: `game/kinetics.rs`, `belts.rs`, `bearings.rs`, `arms.rs` ([b82d9d605](https://github.com/JuanLuci/starling/commit/b82d9d605), [c119e5cd7](https://github.com/JuanLuci/starling/commit/c119e5cd7)). It is engine code there, not a native mod, so it would need this hook to become one.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#1723
No description provided.