public final class FabricDefaultAttributeRegistry extends Object
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)
.
DefaultAttributeRegistry
Constructor and Description |
---|
FabricDefaultAttributeRegistry() |
Modifier and Type | Method and Description |
---|---|
static void |
register(net.minecraft.entity.EntityType<? extends net.minecraft.entity.LivingEntity> type,
net.minecraft.entity.attribute.DefaultAttributeContainer.Builder builder)
Registers a default attribute for a type of living entity.
|
public static void register(net.minecraft.entity.EntityType<? extends net.minecraft.entity.LivingEntity> type, net.minecraft.entity.attribute.DefaultAttributeContainer.Builder builder)
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 FabricEntityTypeBuilder
to simplify the building process.
type
- the entity typebuilder
- the builder that creates the default attributeFabricEntityTypeBuilder.Living.defaultAttributes(Supplier)