Home Commands Examples Getting Started With Scripts Global Keywords

AbstractVillager

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.villager.AbstractVillager;

Extending AgeableMob

AbstractVillager extends AgeableMob. That means all methods available in AgeableMob are also available in AbstractVillager

Implemented Interfaces

AbstractVillager implements the following interfaces. That means all methods defined in these interfaces are also available in AbstractVillager

Methods

Return Type: int

script.zs
// AbstractVillager.getUnhappyCounter() as int
myAbstractVillager.getUnhappyCounter();

Return Type: boolean

script.zs
// AbstractVillager.isTrading() as boolean
myAbstractVillager.isTrading();
script.zs
// AbstractVillager.playCelebrateSound()
myAbstractVillager.playCelebrateSound();
script.zs
AbstractVillager.setUnhappyCounter(unhappyCounter as int)
ParameterType
Parameter
unhappyCounter
Type
int

Properties

NameTypeHas GetterHas Setter
Name
isTrading
Type
boolean
Has Getter
true
Has Setter
false
Name
unhappyCounter
Type
int
Has Getter
true
Has Setter
true