CreatureTypeDefinition - yeelp/Distinct-Damage-Descriptions GitHub Wiki

A CreatureTypeDefinition is the data associated with a CreatureType.

Importing the package

It might be required for you to import the package if you encounter any issues (like casting a Array), so better be safe that sorry and add the import

import mods.ddd.CreatureTypeDefinition;

How to Get One

You can get a creature type by using DDD's creature type bracket handler. The bracket handler is denoted with dddcreaturetype followed by the creature type name. If the creature type doesn't exist, DDD will create a new, blank creature type. This new creature type can be altered as you wish, making this the way to make new creature types in ZenScript.

<dddcreaturetype:type_name>; //General form

<dddcreaturetype:eldritch>; //A new eldritch creature type will be created if it doesn't already exist!

Methods

ZenGetters

ZenGetter Return Type Notes
name string The type name. The same name used in the bracket handler.

ZenMethods

CreatureTypeDefinition setCritImmunity(boolean);

  • If the argument passed is true, entities that are a part of this creature type will be immune to critical hits. They will still take damage, it will just no longer be a critical hit. If the boolean argument is false, the immunity is removed, if it was already granted.
  • Returns itself for chaining.

CreatureTypeDefinition setPotionImmunity(IPotion, boolean);

  • If the boolean is true, entities will not be able to be affected by the potion effect described by the IPotion. If the boolean is false, the immunity is removed, if it was already granted.
  • Returns itself for chaining.

CreatureTypeDefinition addEntityToType(IEntityDefinition);

  • Adds the entity to this creature type. All entities described by the IEntityDefinition will spawn with this creature type. Existing entities will not be granted this creature type. An entity can have multiple creature types at once.
  • Returns itself for chaining.

CreatureTypeDefinition removeEntityFromType(IEntityDefinition);

  • Removes the entity from this creature type. All entities in game that currently have this type will keep it, but new entities described by the IEntityDefinition will new longer have this creature type on spawning.
  • Returns itself for chaining.

CreatureTypeDefinition setFlammable(boolean);

  • Since DDD 1.7
  • Sets entities of this type to being flammable or not. Flammable (set to true) entities will catch fire as normal, whereas entities that are not flammable (set to false) will not catch fire from any source.
  • defaults to true.
Static ZenMethods

Static ZenMethods have to be called on the class.

List<CreatureTypeDefinition> getAllTypes();

  • Gets all of DDD's creature types.
Chaining?

Chaining is the process of being able to "chain" multiple method calls together. This is only really possible when a method on an object returns itself, so that you can do more things with it in the same line

<dddcreaturetype:eldritch>.setCritImmunity(true).setPotionImmunity(<potion:minecraft:wither>, true).setPotionImmunity(<potion:scalingfeast:softstomach>, true).addEntityToType(<entity:abyssalcraft:lessershoggoth>);