-
Notifications
You must be signed in to change notification settings - Fork 0
Add BlockEntityType Event
Maksym Uimanov edited this page Feb 12, 2026
·
1 revision
The @AddBlockEntityType annotation is used to associate custom blocks with existing vanilla block entity types during mod initialization. This annotation eliminates the need for manual block entity registration by programmatically mapping blocks to specific block entity types.
- Automates block entity association: Links blocks to block entity types without manual registration
- Enables block entity functionality: Allows blocks to use vanilla block entity behaviors
- Integrates with initialization: Works seamlessly with Temporal API's initialization system
- Supports vanilla compatibility: Enables custom blocks to work with existing block entity systems
-
Annotation processing: The framework scans fields annotated with
@AddBlockEntityType - Block extraction: Extracts the block from the annotated field
- Entity type resolution: Resolves the specified block entity type resource location
-
Registration: Maps the block to the block entity type in
BlockEntityTypeEventHandler
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface AddBlockEntityType {
String value();
}-
value(required): Resource location string of the block entity type to associate with the block
@AddBlockEntityType("minecraft:sign")
public static final DeferredBlock<StandingSignBlock> EXAMPLE_SIGN = BLOCK_FACTORY.createStandingSignWithoutItem("example_sign", 1f, ExampleWoodTypes.EXAMPLE_WOOD_TYPE);
@AddBlockEntityType("minecraft:sign")
public static final DeferredBlock<WallSignBlock> EXAMPLE_WALL_SIGN = BLOCK_FACTORY.createWallSignWithoutItem("example_wall_sign", 1f, ExampleWoodTypes.EXAMPLE_WOOD_TYPE);@AddBlockEntityType("minecraft:hanging_sign")
public static final DeferredBlock<CeilingHangingSignBlock> EXAMPLE_HANGING_SIGN = BLOCK_FACTORY.createCeilingHangingSignWithoutItem("example_hanging_sign", 1f, ExampleWoodTypes.EXAMPLE_WOOD_TYPE);
@AddBlockEntityType("minecraft:hanging_sign")
public static final DeferredBlock<WallHangingSignBlock> EXAMPLE_HANGING_WALL_SIGN = BLOCK_FACTORY.createWallHangingSignWithoutItem("example_wall_hanging_sign", 1f, ExampleWoodTypes.EXAMPLE_WOOD_TYPE);@AddBlockEntityType("minecraft:chest")
public static final DeferredBlock<ChestBlock> EXAMPLE_CHEST = BLOCK_FACTORY.createChest("example_chest", ExampleWoodTypes.EXAMPLE_WOOD_TYPE);- Sign blocks: Custom wood types for signs and hanging signs
- Storage blocks: Custom chest variants with different materials
- Utility blocks: Custom furnace, hopper, or dispenser variants
- Redstone blocks: Custom redstone components that need block entity functionality
- Decorative blocks: Custom blocks that need inventory or data storage
- Vanilla compatibility: When you want custom blocks to work with vanilla systems
The annotation system integrates with Temporal API's metadata processing:
- Automatic registration: No manual event registration required
- Type safety: Uses reflection to ensure proper block types
-
Strategy pattern: Uses
AddBlockEntityTypeStrategyfor processing -
Event handler integration: Works with
BlockEntityTypeEventHandler - Multi-block support: Multiple blocks can use the same block entity type
The annotation maps to AddBlockEntityTypeStrategy that handles block entity registration logic, allowing for easy extension and customization of the block entity association system.
- Vanilla only: Currently only supports vanilla block entity types
- Block entity behavior: The block will inherit all behaviors of the specified block entity type
- Data compatibility: Custom blocks will be compatible with existing block entity data formats
- Rendering: Blocks will use the appropriate rendering for their block entity type
- Inventory: Storage block entities will provide inventory functionality automatically
🚀 Getting Started
🧩 Core Concepts
⚙️ Data Generation
- ⚙️ Advancement
- ⚙️ Damage Type
- ⚙️ Chest Loot Modifier
- ⚙️ Recipe
- ⚙️ Sound
- ⚙️ Jukebox Song
- ⚙️ Enchantment
- ⚙️ Trim Material
- ⚙️ Trim Pattern
- ⚙️ Banner Pattern
- ⚙️ Painting Variant
- ⚙️ Particle Sprite Set
- ⚙️ Wolf Variant
- ⚙️ Item Model
- ⚙️ Block Model
- ⚙️ Block Loot Table
- ⚙️ Tag
- ⚙️ Language Translation
- ⚙️ World Feature
- ⚙️ Custom Properties
🚨 Events
🛠 Engine Layers
🧪 Resources
- 🧪 Examples