Home Commands Examples Getting Started With Scripts Global Keywords
Generic Recipe Manipulation

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.

script.zs
import mods.armoreablemobs.ArmorGroup;

Static Methods

A powerful method to override the armor of a mob depending on which block they are standing on.

script.zs
// ArmorGroup.overrideExistingArmor(type as EntityType<Entity>, map as IItemStack[EquipmentSlot], state as BlockState)
ArmorGroup.overrideExistingArmor(<entitytype:minecraft:zombie>, {<constant:minecraft:equipmentslot:chest> : <item:minecraft:netherite_chestplate>,
<constant:minecraft:equipmentslot:mainhand> : <item:minecraft:netherite_sword>}, <blockstate:minecraft:sand>);
ParameterTypeDescription
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

script.zs
new ArmorGroup(name as string) as ArmorGroup
ParameterTypeDescription
Parameter
name
Type
string
Description
The display name of the group to create.

Casters

Result TypeIs 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]

script.zs
// ArmorGroup.getEquipment() as ItemStack[EquipmentSlot]
myArmorGroup.getEquipment();

Gets the name of the ArmorGroup

Returns: The name of the group as a string.
Return Type: string

script.zs
// ArmorGroup.getName() as string
myArmorGroup.getName();

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

script.zs
// ArmorGroup.getStackinSlot(slot as EquipmentSlot) as ItemStack
myArmorGroup.getStackinSlot(<constant:minecraft:equipmentslot:head>);
ParameterType
Parameter
slot
Type
EquipmentSlot

Gets the weight of the ArmorGroup

Returns: The weight of the group as a double.
Return Type: double

script.zs
// ArmorGroup.getWeight() as double
myArmorGroup.getWeight();

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

script.zs
// ArmorGroup.inSlot(slot as EquipmentSlot, stack as IItemStack) as ArmorGroup
myArmorGroup.inSlot(<constant:minecraft:equipmentslot:feet>, <item:minecraft:iron_boots>);
ParameterTypeDescription
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.

script.zs
// ArmorGroup.register(type as EntityType<Entity>)
myArmorGroup.register(<entitytype:minecraft:zombie>);
ParameterTypeDescription
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

script.zs
// ArmorGroup.setWeight(weight as double) as ArmorGroup
myArmorGroup.setWeight(3.0);
ParameterTypeDescription
Parameter
weight
Type
double
Description
The weight at which the ArmorGroup will spawn on the entity type.