Class FabricDefaultAttributeRegistry
java.lang.Object
net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry
Allows registering custom default attributes for living entities.
All living entity types must have default attributes registered. See FabricEntityTypeBuilder for utility on entity type registration in general.
A registered default attribute for an entity type can be retrieved through
DefaultAttributeRegistry.get(EntityType).
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidregister(EntityType<? extends LivingEntity> type, DefaultAttributeContainer container) Registers a default attribute for a type of living entity.static voidregister(EntityType<? extends LivingEntity> type, DefaultAttributeContainer.Builder builder) Registers a default attribute for a type of living entity.
-
Method Details
-
register
public static void register(EntityType<? extends LivingEntity> type, DefaultAttributeContainer.Builder builder) Registers a default attribute for a type of living entity.- Parameters:
type- the entity typebuilder- the builder that creates the default attribute- See Also:
-
register
public static void register(EntityType<? extends LivingEntity> type, DefaultAttributeContainer container) Registers a default attribute for a type of living entity.It can be used in a fashion similar to this:
EntityAttributeRegistry.INSTANCE.register(type, LivingEntity.createLivingAttributes());
If a registration overrides another, a debug log message will be emitted. Existing registrations can be checked at
DefaultAttributeRegistry.hasDefinitionFor(EntityType).For convenience, this can also be done on the
FabricEntityTypeBuilderto simplify the building process.- Parameters:
type- the entity typecontainer- the container for the default attribute- See Also:
-