[GH-ISSUE #5549] Block entities for mod blocks whatever their template #1727

Closed
opened 2026-11-02 15:49:13 +07:00 by bsakaguchi · 1 comment
Owner

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

Originally assigned to: @Xmilon on GitHub.

Summary

Let native_block_entity (API 15) give a content-mod block a block entity whatever template the block uses, with the engine removing it when the block is broken or replaced.

Why

A content mod picks a block's template for its shape, sound, hardness and light: stone for a full machine casing, iron_chain or end_rod for a thin part, carved_pumpkin for something that faces the player. Most machines and storage blocks still need a block entity for their items, energy, progress or settings:

  • Create: depot, press, basin, millstone, belts, funnels.
  • Mekanism, Thermal Expansion, Immersive Engineering: machine casings that look like full blocks.
  • Farmer's Delight: stove, cooking pot. Storage Drawers: drawers.

Today the doc comment on native_block_entity says the template must already have a block entity (a chest, a furnace...) "so that breaking the block removes it; on another template it gets none". So these mods either take a chest's or furnace's shape and behaviour, or get no block entity at all.

Proposal

  • Track a mod block entity by its block, not by its template: made when the block is placed, removed when the block at that position is broken, replaced or blown up.
  • Everything else stays as it is: ticking (API 15), item slots and hoppers (API 16), menus (API 17), client sync (API 45, 52), fluid tanks (API 54).

How I did it on my fork

On my fork I keep block entities for Create's machines on any template: game/machine_entities.rs, synced over LAN as block entity type 4000 in lan/chunks.rs (bd887b2d4, 507b26bf7).

Originally created by @JuanLuci on GitHub (Oct 31, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5549 Originally assigned to: @Xmilon on GitHub. ## Summary Let `native_block_entity` (API 15) give a content-mod block a block entity whatever template the block uses, with the engine removing it when the block is broken or replaced. ## Why A content mod picks a block's template for its shape, sound, hardness and light: stone for a full machine casing, `iron_chain` or `end_rod` for a thin part, `carved_pumpkin` for something that faces the player. Most machines and storage blocks still need a block entity for their items, energy, progress or settings: - Create: depot, press, basin, millstone, belts, funnels. - Mekanism, Thermal Expansion, Immersive Engineering: machine casings that look like full blocks. - Farmer's Delight: stove, cooking pot. Storage Drawers: drawers. Today the doc comment on `native_block_entity` says the template must already have a block entity (a chest, a furnace...) "so that breaking the block removes it; on another template it gets none". So these mods either take a chest's or furnace's shape and behaviour, or get no block entity at all. ## Proposal - Track a mod block entity by its block, not by its template: made when the block is placed, removed when the block at that position is broken, replaced or blown up. - Everything else stays as it is: ticking (API 15), item slots and hoppers (API 16), menus (API 17), client sync (API 45, 52), fluid tanks (API 54). ## How I did it on my fork On my fork I keep block entities for Create's machines on any template: `game/machine_entities.rs`, synced over LAN as block entity type 4000 in `lan/chunks.rs` ([bd887b2d4](https://github.com/JuanLuci/starling/commit/bd887b2d4), [507b26bf7](https://github.com/JuanLuci/starling/commit/507b26bf7)).
Author
Owner

@Xmilon commented on GitHub (Nov 1, 2026):

🤖 Agent: /claim

Plan (agreed with Isloka on Discord): keep a mod block entity on any template. Drop the template check in new_block_entity; the level removes a mod block entity when its block is broken or replaced, and pistons don't move it, by asking whether a mod block entity lives at the position instead of reading the template flag. The render side does the same: a mod block entity's position joins the chunk's block entity render list when it is created and leaves it when it is gone, so native_block_entity_submit draws on any template.

<!-- gh-comment-id:6560919566 --> @Xmilon commented on GitHub (Nov 1, 2026): 🤖 Agent: /claim Plan (agreed with Isloka on Discord): keep a mod block entity on any template. Drop the template check in `new_block_entity`; the level removes a mod block entity when its block is broken or replaced, and pistons don't move it, by asking whether a mod block entity lives at the position instead of reading the template flag. The render side does the same: a mod block entity's position joins the chunk's block entity render list when it is created and leaves it when it is gone, so `native_block_entity_submit` draws on any template.
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#1727
No description provided.