MobDamageModifierBuilder - yeelp/Distinct-Damage-Descriptions GitHub Wiki
DDD's MobDamageModifierBuilder lets you alter the damage of mobs dynamically! This can include players too, but you'll need definedEntitiesOnly set to false in the config since players get a default damage distribution.
Importing the class
You might need to import the class to avoid any errors.
import mods.ddd.modifiers.MobDamageModifierBuilder;
Extending ModifierBuilder
This ZenClass extends ModifierBuilder. So anything accessible from that ZenClass is accessible from MobDamageModifierBuilder, including all ZenProperties.
Creating a mob damage modifier
To create a mob damage modifier, use the static create(string)
ZenMethod. Note the modifier will scale the resulting damage distribution to 100% total weight. See The ModifierBuilder section on how the modifier applies. Also note that before 1.8, the internal names of mob damage modifiers are shared with projectile modifiers and must be unique.
The modifier function
The MobDamageModifierBuilder uses an additional ZenProperty of the type IsModifierApplicableForEntityLivingBase to determine if the modifier is applicable to the mob.
ZenProperties
ZenProperty Name | Type | Notes |
---|---|---|
isModifierApplicable | IsModifierApplicableForEntityLivingBase | This function determines if the modifier is applicable for the given entity living base. |
Static ZenMethod
MobDamageModifierBuilder create(string)
- Create a new MobDamageModifierBuilder with the specified name as its internal name. Note that *before 1.8", this must be unique between mob damage modifiers and projectile modifiers.
Example
This script causes mobs in the End to reallocate 25% of their damage as psychic damage.
#loader contenttweaker
#modloaded distinctdamagedescriptions
import mods.ddd.modifiers.MobDamageModifierBuilder;
val builder = mods.ddd.modifiers.MobDamageModifierBuilder.create("end");
builder.shouldReallocate = true;
builder.setMod("psychic", 0.25);
builder.isModifierApplicable = function(entityLivingBase) {
return entityLivingBase.dimension == 1;
};
builder.build();