-
Notifications
You must be signed in to change notification settings - Fork 0
Create Entity Attributes Event
Maksym Uimanov edited this page Feb 12, 2026
·
1 revision
The @CreateEntityAttributes annotation is used to automatically register entity attributes for custom entities during mod initialization. This annotation eliminates the need for manual attribute registration by programmatically mapping attribute builders to specific entity types.
- Automates attribute registration: Registers entity attributes without manual event handling
- Maps entities to attributes: Links entity types to their attribute configurations
- Integrates with initialization: Works seamlessly with Temporal API's initialization system
- Supports multiple entities: Allows one attribute method to serve multiple entity types
-
Annotation processing: The framework scans methods annotated with
@CreateEntityAttributes -
Method invocation: Invokes the annotated method to get the
AttributeSupplier.Builder - Entity mapping: Maps the attribute builder to specified entity type IDs
-
Registration: Registers the attributes in the
EntityAttributeEventHandler
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface CreateEntityAttributes {
String[] value();
}-
value(required): Array of entity type resource location strings to apply the attributes to
public class ExampleEntity extends Turtle {
public ExampleEntity(EntityType<? extends ExampleEntity> entityType, Level level) {
super(entityType, level);
}
@NotNull
@CreateEntityAttributes("example:example_entity")
public static AttributeSupplier.Builder createAttributes() {
return Mob.createMobAttributes()
.add(Attributes.MAX_HEALTH, 20.0D)
.add(Attributes.MOVEMENT_SPEED, 0.23D)
.add(Attributes.ATTACK_DAMAGE, 3.0D);
}
}@NotNull
@CreateEntityAttributes({
"example:example_entity",
"example:example_entity_variant",
"example:example_entity_boss"
})
public static AttributeSupplier.Builder createAttributes() {
return Mob.createMobAttributes()
.add(Attributes.MAX_HEALTH, 30.0D)
.add(Attributes.MOVEMENT_SPEED, 0.25D)
.add(Attributes.ATTACK_DAMAGE, 5.0D)
.add(Attributes.ARMOR, 2.0D);
}The annotated method must follow these requirements:
-
Required:
AttributeSupplier.Builder
-
Required:
public static -
Optional:
@NotNull(recommended for null safety)
public static AttributeSupplier.Builder createAttributes()- Custom entities: Any custom entity that needs specific attributes
- Entity variants: Multiple entity types sharing the same attributes
- Boss entities: Special entities with enhanced stats
- Modded mobs: Replacing or extending vanilla entity attributes
- Balanced gameplay: Ensuring proper attribute balance for custom mobs
The annotation system integrates with Temporal API's metadata processing:
- Automatic registration: No manual event registration required
- Multiple entity support: One method can serve multiple entity types
-
Strategy pattern: Uses
CreateEntityAttributesStrategyfor processing -
Event handler integration: Works with
EntityAttributeEventHandler - Reflection-based: Uses reflection to invoke attribute methods
The annotation maps to the CreateEntityAttributesStrategy that handles the attribute registration logic, allowing for easy extension and customization of the entity attribute system.
🚀 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