Back to 9Minecraft
Wiki 9Minecraft Wiki 9Minecraft
Armoreablemobs Wiki › Guides › How to Give Mobs Armor on Spawn with ArmoreableMobs

How to Give Mobs Armor on Spawn with ArmoreableMobs

Set Up Your Script

ArmoreableMobs works entirely through CraftTweaker, so every setup starts in a .zs script file. Begin by importing the mod's classes:

`zenscript

import mods.armoreablemobs.ArmorHandler;

import mods.armoreablemobs.ArmorEntity;

import mods.armoreablemobs.ArmorSlot;

import mods.armoreablemobs.ArmorGroup;

`

Create a Group and Add an Entity

An ArmorGroup is the container that ties a set of armor pieces to one or more entities. Create it with ArmorHandler.createArmorGroup(name, chance), where the name is any string identifier and the chance is the probability the group is applied when a matching entity spawns.

`zenscript

var group = ArmorHandler.createArmorGroup("draconic", 0.5);

group.addEntity(<entity:minecraft:zombie>);

`

Add Armor Slots

Each ArmorSlot defines one item placed in one slot. Build them with ArmorHandler.createArmorSlot(slotName, itemStack) and attach them to the group with group.addArmor(...). Slot names follow vanilla conventions such as head, chest, legs, and feet.

`zenscript

group.addArmor(ArmorHandler.createArmorSlot("head", <draconicevolution:draconic_helm>));

group.addArmor(ArmorHandler.createArmorSlot("chest", <draconicevolution:draconic_chest>));

`

Reload scripts with /ct reload and spawn the entity to confirm the gear appears. Adjust the chance value to control how often the loadout shows up in normal play.