Class FabricDefaultAttributeRegistry
All living entity types must have default attributes registered. See EntityType.Builder for utility on entity type registration in general.
A registered default attribute for an entity type can be retrieved through
DefaultAttributes.getSupplier(EntityType).
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfacestatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Event<FabricDefaultAttributeRegistry.ModifyDefaultAttribute> Bulk modifies the default attributes for entity types. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidregister(net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.LivingEntity> type, net.minecraft.world.entity.ai.attributes.AttributeSupplier container) Registers a default attribute for a type of living entity.static voidregister(net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.LivingEntity> type, net.minecraft.world.entity.ai.attributes.AttributeSupplier.Builder builder) Registers a default attribute for a type of living entity.
-
Field Details
-
MODIFY
Bulk modifies the default attributes for entity types. Fires just before registries are frozen to ensure all entity types are present before modification.
This event only affects entity types which have already had an
AttributeSupplierregistered to them via a method such asregister(EntityType, AttributeSupplier)orFabricEntityType.Builder.Living.defaultAttributes(Supplier).The event is invoked after all builtin registration is complete to ensure that all entity types have been registered.
-
-
Method Details
-
register
public static void register(net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.LivingEntity> type, net.minecraft.world.entity.ai.attributes.AttributeSupplier.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(net.minecraft.world.entity.EntityType<? extends net.minecraft.world.entity.LivingEntity> type, net.minecraft.world.entity.ai.attributes.AttributeSupplier container) Registers a default attribute for a type of living entity.It can be used in a fashion similar to this:
FabricDefaultAttributeRegistry.register(type, LivingEntity.createLivingAttributes());
If a registration overrides another, a debug log message will be emitted. Existing registrations can be checked at
DefaultAttributes.hasSupplier(EntityType).For convenience, this can also be done on the
FabricEntityType.Builderto simplify the building process.- Parameters:
type- the entity typecontainer- the container for the default attribute- See Also:
-