Combit/src/main/java/io/gitlab/jfronny/combit/events/EntityKnockbackEvent.java

23 lines
843 B
Java
Raw Normal View History

2021-12-29 23:36:10 +01:00
package io.gitlab.jfronny.combit.events;
2020-10-27 20:13:31 +01:00
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.ActionResult;
2021-12-29 23:36:10 +01:00
public interface EntityKnockbackEvent {
Event<EntityKnockbackEvent> EVENT = EventFactory.createArrayBacked(EntityKnockbackEvent.class,
2020-10-27 20:13:31 +01:00
(listeners) -> (entity, amp, dx, dz) -> {
2021-12-29 23:36:10 +01:00
for (EntityKnockbackEvent event : listeners) {
2020-10-27 20:13:31 +01:00
ActionResult result = event.takeKnockback(entity, amp, dx, dz);
if (result != ActionResult.PASS) {
return result;
}
}
return ActionResult.PASS;
});
2021-12-29 23:36:10 +01:00
ActionResult takeKnockback(LivingEntity entity, double amp, double dx, double dz);
2020-10-27 20:13:31 +01:00
}