ArmorGroup
Importing the class
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
Static Methods
A powerful method to override the armor of a mob depending on which block they are standing on.
Parameter | Type | Description |
---|---|---|
Parameter type | Type EntityType<Entity> | Description The EntityType<T> to Override |
Parameter map | Type IItemStack[EquipmentSlot] | Description The Associative Array, as EquipmentSlot[IItemStack] that will be used as the entities armor. If an EquipmentSlot is empty, it won’t override what’s there. |
Parameter state | Type BlockState | Description The BlockState to override the armor if the aforementioned EntityType<T> spawns on top of. |
Constructors
Parameter | Type | Description |
---|---|---|
Parameter name | Type string | Description The display name of the group to create. |
Casters
Result Type | Is Implicit |
---|---|
Result Type string | Is Implicit true |
Methods
Returns the AssociativeArray that corresponds to the internal EquipmentSlot[IItemStack]
Returns: The internal map as EquipmentSlot[IItemStack]
Return Type: ItemStack[EquipmentSlot]
Gets the name of the ArmorGroup
Returns: The name of the group as a string.
Return Type: string
Gets the ItemStack the group will give in a selected slot. Can be null. Would be the same as using ArmorGroup#getEquipment() and passing the EquipmentSlot as a key.
Returns: The ItemStack at the selected location. Can be null.
Return Type: ItemStack
Parameter | Type |
---|---|
Parameter slot | Type EquipmentSlot |
Gets the weight of the ArmorGroup
Returns: The weight of the group as a double.
Return Type: double
Links a slot to the ItemStack the entity will get when spawning. Accepts all EquipmentSlot types.
Returns: The ArmorGroup that has been modified.
Return Type: ArmorGroup
Parameter | Type | Description |
---|---|---|
Parameter slot | Type EquipmentSlot | Description The slot at which the ItemStack will be placed |
Parameter stack | Type IItemStack | Description The IItemStack to give to the Entity. |
Registers the ArmorGroup.
Parameter | Type | Description |
---|---|---|
Parameter type | Type EntityType<Entity> | Description The entity at which the ArmorGroup will be applied on spawn. |
Sets the weight at which the armor group can spawn. The chance a group has to spawn on an entity is determined using a pseudo random number and the total weight of ArmorGroups that entity can have.
Returns: The ArmorGroup that has been modified.
Return Type: ArmorGroup
Parameter | Type | Description |
---|---|---|
Parameter weight | Type double | Description The weight at which the ArmorGroup will spawn on the entity type. |