CreatureType - yeelp/Distinct-Damage-Descriptions GitHub Wiki

A CreatureType is a set of information that stores the different creature types a mob was assigned.

Importing the class

You may need to import the class if you encounter any issues.

import mods.ddd.CreatureType;

Iterating

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);
}

in and has operators

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!");
}