Wiki 9Minecraft Wiki 9Minecraft
Event Wrapper Wiki › Guides › Cancel or Modify Events in Dual-Loader Mods

Cancel or Modify Events in Dual-Loader Mods

Check Wrapper Event Capabilities

Not all events can be cancelled. Before attempting to cancel, verify that your wrapper event type supports cancellation. Check the wrapper's documentation or try accessing the cancel method.

Cancel an Event

If the wrapper supports it, call the cancel method on the event parameter:

`java

@SubscriberEventWrapper

public static void onHeal(LivingHealEventWrapper event) {

if (shouldPreventHealing(event)) {

event.cancel();

}

}

`

Modify Event Values

Some wrappers let you change values before they take effect. Use setter methods if available:

`java

event.setHealAmount(newAmount);

`

Test Both Platforms

Run your mod on Forge and Fabric separately. Event cancellation and modification behavior should match on both loaders. If behavior differs, check that you're using the correct wrapper type and that your logic doesn't rely on loader-specific features.