24 lines
890 B
Java
24 lines
890 B
Java
package io.gitlab.jfronny.combit.nodami;
|
|
|
|
import net.fabricmc.fabric.api.event.Event;
|
|
import net.fabricmc.fabric.api.event.EventFactory;
|
|
import net.minecraft.entity.Entity;
|
|
import net.minecraft.entity.LivingEntity;
|
|
import net.minecraft.util.ActionResult;
|
|
|
|
public interface EntityKnockbackCallback {
|
|
Event<EntityKnockbackCallback> EVENT = EventFactory.createArrayBacked(EntityKnockbackCallback.class,
|
|
(listeners) -> (entity, amp, dx, dz) -> {
|
|
for (EntityKnockbackCallback event : listeners) {
|
|
ActionResult result = event.takeKnockback(entity, amp, dx, dz);
|
|
if (result != ActionResult.PASS) {
|
|
return result;
|
|
}
|
|
}
|
|
|
|
return ActionResult.PASS;
|
|
});
|
|
|
|
ActionResult takeKnockback(LivingEntity entity, float amp, double dx, double dz);
|
|
}
|