Skip to content
On this page
Common

KattonEntityTypeModificationApi

top.katton.api.modcommon/src/main/kotlin/top/katton/api/mod/KattonEntityTypeModificationApi.kt
Configuration for modifying default attributes of an existing [EntityType] (vanilla or modded).

EntityTypeModificationConfig

EntityTypeModificationConfigCommonClass
kotlin
class EntityTypeModificationConfig(val entityId: Identifier)

Configuration for modifying default attributes of an existing [EntityType] (vanilla or modded).

Mirrors the property surface of [top.katton.registry.KattonEntityProperties] but applies to already-registered entity types via [top.katton.registry.DefaultAttributesHelper].

Properties

PropertyDescription
entityIdThe identifier of the entity type being modified.

EntityTypeModificationConfig.attribute

EntityTypeModificationConfig.attributeCommonFunction
kotlin
fun attribute(attribute: Holder<Attribute>, value: Double): EntityTypeModificationConfig

Overrides the base value of an arbitrary attribute.

EntityTypeModificationConfig.maxHealth

EntityTypeModificationConfig.maxHealthCommonFunction
kotlin
fun maxHealth(value: Double): EntityTypeModificationConfig

Overrides max health (generic.max_health).

EntityTypeModificationConfig.movementSpeed

EntityTypeModificationConfig.movementSpeedCommonFunction
kotlin
fun movementSpeed(value: Double): EntityTypeModificationConfig

Overrides movement speed (generic.movement_speed).

EntityTypeModificationConfig.knockbackResistance

EntityTypeModificationConfig.knockbackResistanceCommonFunction
kotlin
fun knockbackResistance(value: Double): EntityTypeModificationConfig

Overrides knockback resistance (generic.knockback_resistance).

EntityTypeModificationConfig.attackDamage

EntityTypeModificationConfig.attackDamageCommonFunction
kotlin
fun attackDamage(value: Double): EntityTypeModificationConfig

Overrides attack damage (generic.attack_damage).

EntityTypeModificationConfig.attackSpeed

EntityTypeModificationConfig.attackSpeedCommonFunction
kotlin
fun attackSpeed(value: Double): EntityTypeModificationConfig

Overrides attack speed (generic.attack_speed).

EntityTypeModificationConfig.armor

EntityTypeModificationConfig.armorCommonFunction
kotlin
fun armor(value: Double): EntityTypeModificationConfig

Overrides armor (generic.armor).

EntityTypeModificationConfig.armorToughness

EntityTypeModificationConfig.armorToughnessCommonFunction
kotlin
fun armorToughness(value: Double): EntityTypeModificationConfig

Overrides armor toughness (generic.armor_toughness).

EntityTypeModificationConfig.followRange

EntityTypeModificationConfig.followRangeCommonFunction
kotlin
fun followRange(value: Double): EntityTypeModificationConfig

Overrides follow range (generic.follow_range).

EntityTypeModificationConfig.luck

EntityTypeModificationConfig.luckCommonFunction
kotlin
fun luck(value: Double): EntityTypeModificationConfig

Overrides luck (generic.luck).

modifyEntityType

modifyEntityTypeCommonFunction
kotlin
@ApiStatus.Experimental
@ApiStatus.Experimental fun modifyEntityType(entityId: String, configure: EntityTypeModificationConfig.() -> Unit): Boolean

Modifies the default attributes of an existing entity type.

If the entity type already has default attributes registered, the existing supplier is used as a baseline and individual attribute base values are overridden. If no default supplier exists, a fresh supplier built from [LivingEntity.createLivingAttributes] is used as the baseline.

Applied via [DefaultAttributesHelper] (reflection on DefaultAttributes.SUPPLIERS). Works for vanilla entity types as well as modded ones that register attributes through the same mechanism.

Parameters

ParameterDescription
entityIdEntity type identifier (e.g. "minecraft:zombie").
configureConfiguration lambda.

Returns

true when the supplier was replaced; false when the entity type could not be resolved or the underlying registry is non-living.

modifyEntityType

modifyEntityTypeCommonFunction
kotlin
@ApiStatus.Experimental
@ApiStatus.Experimental fun modifyEntityType(entityId: Identifier, configure: EntityTypeModificationConfig.() -> Unit): Boolean

Identifier overload of [modifyEntityType].