ArmorGroup
Link to armorgroup
Importing the class
Link to 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.
ZenScript Copyimport mods.armoreablemobs.ArmorGroup;
Static Methods
Link to static-methods
Name: overrideExistingArmor
A powerful method to override the armor of a mob depending on which block they are standing on.
ZenScript Copy// ArmorGroup.overrideExistingArmor(type as EntityType, 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>);
Parameter | Type | Description | Optional |
---|---|---|---|
Parameter type | Type EntityType | Description The EntityType<T> to Override | Optional false |
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. | Optional false |
Parameter state | Type BlockState | Description The BlockState to override the armor if the aforementioned EntityType<T> spawns on top of. | Optional true |
Constructors
Link to constructors
ZenScript Copynew ArmorGroup(name as string) as ArmorGroup
Parameter | Type | Description |
---|---|---|
Parameter name | Type string | Description The display name of the group to create. |
Casters
Link to casters
Result Type | Is Implicit |
---|---|
Result Type string | Is Implicit true |
Methods
Link to methods
Name: getMap
Returns the AssociativeArray that corresponds to the internal EquipmentSlot[IItemStack]
Returns: The internal map as EquipmentSlot[IItemStack]
Return Type: ItemStack[EquipmentSlot]
ZenScript Copy// ArmorGroup.getMap() as ItemStack[EquipmentSlot]
myArmorGroup.getMap();
Name: getName
Gets the name of the ArmorGroup
Returns: The name of the group as a string.
Return Type: string
ZenScript Copy// ArmorGroup.getName() as string
myArmorGroup.getName();
Name: getStackinSlot
Gets the ItemStack the group will give in a selected slot. Can be null. Would be the same as using ArmorGroup#getMap() and passing the EquipmentSlot as a key.
Returns: The ItemStack at the selected location. Can be null.
Return Type: ItemStack
ZenScript Copy// ArmorGroup.getStackinSlot(slot as EquipmentSlot) as ItemStack
myArmorGroup.getStackinSlot(<constant:minecraft:equipmentslot:head>);
Parameter | Type |
---|---|
Parameter slot | Type EquipmentSlot |
Name: getWeight
Gets the weight of the ArmorGroup
Returns: The weight of the group as a double.
Return Type: double
ZenScript Copy// ArmorGroup.getWeight() as double
myArmorGroup.getWeight();
Name: inSlot
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
ZenScript Copy// ArmorGroup.inSlot(slot as EquipmentSlot, stack as IItemStack) as ArmorGroup
myArmorGroup.inSlot(<constant:minecraft:equipmentslot:feet>, <item:minecraft:iron_boots>);
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. |
Name: register
Registers the ArmorGroup.
ZenScript Copy// ArmorGroup.register(type as EntityType)
myArmorGroup.register(<entitytype:minecraft:zombie>);
Parameter | Type | Description |
---|---|---|
Parameter type | Type EntityType | Description The entity at which the ArmorGroup will be applied on spawn. |
Name: setWeight
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
ZenScript Copy// ArmorGroup.setWeight(weight as double) as ArmorGroup
myArmorGroup.setWeight(3.0);
Parameter | Type | Description |
---|---|---|
Parameter weight | Type double | Description The weight at which the ArmorGroup will spawn on the entity type. |