Create a handler to listen to LivingAttackEvent with highest priority.
Use reflection to read ItemBLShield#EventHandler.INSTANCE.ignoreEvent. Don't do anything if it is set to true.
Do the same checks Betweenlands does to determine if the event should be canceled.
If the event should be canceled by Betweenlands, set a flag.
Within the same handler, listen to LivingAttackEvent again but this time at LOW priority while also receiving canceled events.
If the flag is set, unset it and unset the canceled state of the event. We need the event to not be canceled else further calculations and damage and hurt events won't be fired.
Betweenlands shields don't play nicely with DDD as
ItemBLShield.java
in Betweenlands cancelsLivingAttackEvent
s when handling their own shields. https://github.com/Angry-Pixel/The-Betweenlands/blob/7e54e8f64dee155e649ddcf7512dce69af557ea7/src/main/java/thebetweenlands/common/item/tools/ItemBLShield.java#L231Here's the solution:
LivingAttackEvent
with highest priority.ItemBLShield#EventHandler.INSTANCE.ignoreEvent
. Don't do anything if it is set to true.LivingAttackEvent
again but this time at LOW priority while also receiving canceled events.