ProjectileModifierBuilder - yeelp/Distinct-Damage-Descriptions GitHub Wiki
DDD's ProjectileModifierBuilder is used for altering the damage distributions of projectiles.
Importing the class
You might need to import the class to avoid any errors.
import mods.ddd.modifiers.ProjectileModifierBuilder;
Extending ModifierBuilder
This ZenClass extends ModifierBuilder. So anything accessible from that ZenClass is accessible from ProjectileModifierBuilder, including all ZenProperties.
Creating a projectile modifier
To create a projectile 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 projectile modifiers are shared with mob damage modifiers and must be unique.
The modifier function
The ProjectileModifierBuilder uses an additional ZenProperty of type IsModifierApplicableForEntity to determine if the modifier is applicable to the entity.
ZenProperties
ZenProperty Name | Type | Notes |
---|---|---|
isModifierApplicable | IsModifierApplicableForEntity | This function determines if the modifier is applicable for the given entity (which would be a projectile) |
Static ZenMethod
ProjectileModifierBuilder create(string);
- Creates a new ProjectileModifierBuilder with the internal name specified. Note that before 1.8, this must be unique between projectile and mob damage modifiers.
Example
This script causes projectiles shot during a lightning storm to inflict 100% lightning damage instead of whatever damage they normally do.
#loader contenttweaker
#modloaded distinctdamagedescriptions
import mods.ddd.modifiers.ProjectileModifierBuilder;
val builder = mods.ddd.modifiers.ProjectileModifierBuilder.create("lightning");
builder.shouldReallocate = true;
builder.setMod("lightning", 1);
builder.isModifierApplicable = function(entity) {
val world = entity.world;
return world.isSurfaceWorld() && world.worldInfo.isThundering() && entity.isWet();
};
builder.priority = -2;
builder.build();