Home Commands Examples Getting Started With Scripts Global Keywords
BracketDumpers BracketHandlers BracketValidators ResourceLocationBracketHandler

Mob

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 crafttweaker.api.entity.type.misc.Mob;

Extending LivingEntity

Mob extends LivingEntity. That means all methods available in LivingEntity are also available in Mob

Methods

script.zs
// Mob.ate()
myMob.ate();

Return Type: boolean

script.zs
Mob.canBeLeashed(leashHolder as Player) as boolean
ParameterType
Parameter
leashHolder
Type
Player

Return Type: boolean

script.zs
Mob.canFireProjectileWeapon(weapon as ProjectileWeaponItem) as boolean
ParameterType
Parameter
weapon
Type
ProjectileWeaponItem

Return Type: boolean

script.zs
Mob.canHoldItem(stack as ItemStack) as boolean
ParameterType
Parameter
stack
Type
ItemStack

Return Type: boolean

script.zs
Mob.canReplaceEqualItem(toReplace as ItemStack, with as ItemStack) as boolean
ParameterType
Parameter
toReplace
Type
ItemStack
Parameter
with
Type
ItemStack

Return Type: boolean

script.zs
Mob.checkSpawnObstruction(level as invalid) as boolean
ParameterType
Parameter
level
Type
invalid

Return Type: boolean

script.zs
Mob.checkSpawnRules(level as invalid, spawnType as MobSpawnType) as boolean
ParameterType
Parameter
level
Type
invalid
Parameter
spawnType
Type
MobSpawnType
script.zs
// Mob.clearRestriction()
myMob.clearRestriction();
script.zs
Mob.dropLeash(broadcastPacket as boolean, dropLeash as boolean)
ParameterType
Parameter
broadcastPacket
Type
boolean
Parameter
dropLeash
Type
boolean

Return Type: boolean

script.zs
Mob.equipItemIfPossible(stack as ItemStack) as boolean
ParameterType
Parameter
stack
Type
ItemStack

Return Type: boolean

script.zs
Mob.isMaxGroupSizeReached(size as int) as boolean
ParameterType
Parameter
size
Type
int

Return Type: boolean

script.zs
Mob.isWithinMeleeAttackRange(entity as LivingEntity) as boolean
ParameterType
Parameter
entity
Type
LivingEntity

Return Type: boolean

script.zs
Mob.isWithinRestriction(position as BlockPos) as boolean
ParameterType
Parameter
position
Type
BlockPos
script.zs
Mob.lookAt(entity as Entity, maxXRotIncrease as float, maxYRotIncrease as float)
ParameterType
Parameter
entity
Type
Entity
Parameter
maxXRotIncrease
Type
float
Parameter
maxYRotIncrease
Type
float
script.zs
// Mob.playAmbientSound()
myMob.playAmbientSound();
script.zs
Mob.restrictTo(restrictCenter as BlockPos, restrictRadius as int)
ParameterType
Parameter
restrictCenter
Type
BlockPos
Parameter
restrictRadius
Type
int
script.zs
Mob.setDropChance(slot as EquipmentSlot, chance as float)
ParameterType
Parameter
slot
Type
EquipmentSlot
Parameter
chance
Type
float
script.zs
Mob.setGuaranteedDrop(slot as EquipmentSlot)
ParameterType
Parameter
slot
Type
EquipmentSlot
script.zs
Mob.setLeashedTo(leashHolder as Entity, broadcastPacket as boolean)
ParameterType
Parameter
leashHolder
Type
Entity
Parameter
broadcastPacket
Type
boolean
script.zs
// Mob.setPersistenceRequired()
myMob.setPersistenceRequired();

Return Type: boolean

script.zs
Mob.wantsToPickUp(stack as ItemStack) as boolean
ParameterType
Parameter
stack
Type
ItemStack

Properties

NameTypeHas GetterHas Setter
Name
aggressive
Type
Mob
Has Getter
true
Has Setter
true
Name
ambientSoundInterval
Type
int
Has Getter
true
Has Setter
false
Name
baby
Type
Mob
Has Getter
false
Has Setter
true
Name
canPickUpLoot
Type
boolean
Has Getter
true
Has Setter
true
Name
getRestrictCenter
Type
BlockPos
Has Getter
true
Has Setter
false
Name
getRestrictRadius
Type
float
Has Getter
true
Has Setter
false
Name
hasRestriction
Type
boolean
Has Getter
true
Has Setter
false
Name
isPersistenceRequired
Type
boolean
Has Getter
true
Has Setter
false
Name
isWithinRestriction
Type
boolean
Has Getter
true
Has Setter
false
Name
leashed
Type
boolean
Has Getter
true
Has Setter
false
Name
leftHanded
Type
Mob
Has Getter
true
Has Setter
true
Name
maxHeadRotSpeed
Type
int
Has Getter
true
Has Setter
false
Name
maxHeadXRot
Type
int
Has Getter
true
Has Setter
false
Name
maxHeadYRot
Type
int
Has Getter
true
Has Setter
false
Name
maxSpawnClusterSize
Type
int
Has Getter
true
Has Setter
false
Name
noAi
Type
Mob
Has Getter
true
Has Setter
true
Name
target
Type
Mob
Has Getter
false
Has Setter
true