CraftTweaker Events - yeelp/Distinct-Damage-Descriptions GitHub Wiki

There are a handful of events you can listen to with CraftTweaker to change how DDD behaves.

You can use DDD's events in a similar way you use CraftTweaker's events. Much like how CraftTweaker has its own event manager, DDD has its own as well for DDD's events. However, there is no global field for accessing the event manager unlike CraftTweaker's vanilla events. You access DDD's event manager through its own ZenClass.

Importing the class

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

import mods.ddd.events.DDDEvents;

Calling DDD's event manager

You can access DDD's event manager through its ZenClass.

How DDD's events work

They work exactly like how CraftTweaker's events work. You add a function that takes the event (WHICH YOU ALMOST ALWAYS WANT TO CAST TO THE EVENT'S TYPE) as an argument, then go from there. If you don't intend on accessing anything from the event (say you just want to print something), then you don't need to cast the event. But all the same, it's better to be safe than sorry.

mods.ddd.events.DDDEvents.onDetermineDamage(function(event as mods.ddd.events.DetermineDamageEvent) {
   print(event.getDamage(<dddtype:psychic>));
   event.setDamage(<dddtype:radiant>, 6.0));
});

mods.ddd.events.DDDEvents.onShieldBlock(function(event) {
   //Note nothing from the ShieldBlockEvent is accessible, since we didn't cast!
   print("A shield was detected!");
});

//In general, a DDD event handle will look like so
mods.ddd.events.DDDEvents.event_handle_zenmethod(function(event as mods.ddd.events.event_type) {
   //Your code goes here
});

What are DDD's events?

You can consult the following table below, which outlines the events available. The left column is the ZenMethod you call on mods.ddd.events.DDDEvents and the right column is what you should cast the event as. (The events in the right column will link to their respective wiki page).

Note: DDD's AssignMobResistancesEvent was removed as of version 1.7.

ZenMethod DDD Event Class
onDetermineDamage mods.ddd.events.DetermineDamageEvent
onGatherDefenses mods.ddd.events.GatherDefensesEvent
onShieldBlock mods.ddd.events.ShieldBlockEvent
onUpdateAdaptiveResistances mods.ddd.events.UpdateAdaptiveResistanceEvent
onAssignMobResistances mods.ddd.events.AssignMobResistancesEvent