-
-
Notifications
You must be signed in to change notification settings - Fork 5
CreatureType
Yeelp edited this page Feb 15, 2024
·
1 revision
A CreatureType is a set of information that stores the different creature types a mob was assigned.
You may need to import the class if you encounter any issues.
import mods.ddd.CreatureType;The CreatureType ZenClass is marked as IterableSimple. What that means is that you can iterate over CreatureType with a simple for-loop. You iterate over the different CreatureTypeDefinitions that this mob has.
//Here, creatureTypes is an instance of the CreatureType ZenClass that you retrieved from the mob in question.
for cType in creatureTypes {
//cType is a CreatureTypeDefinition
print(cType.name);
}CreatureTypes support CraftTweaker in and has operators. You can check if a mob has a creature type using this operator.
if(creatureType in <dddcreaturetype:monster>) {
print("They're a monster!");
}
//This does the same check, but this just makes more grammatical sense.
if(creatureType has <dddcreaturetype:monster>) {
print("They're a monster!");
}