2021-02-14 16:53:44 +01:00
|
|
|
package com.minelittlepony.unicopia.projectile;
|
|
|
|
|
2022-12-04 23:46:45 +01:00
|
|
|
import java.util.function.Function;
|
|
|
|
|
|
|
|
import com.minelittlepony.unicopia.ability.magic.Caster;
|
|
|
|
|
|
|
|
import net.minecraft.util.hit.BlockHitResult;
|
|
|
|
import net.minecraft.util.hit.EntityHitResult;
|
2021-02-14 16:53:44 +01:00
|
|
|
|
2022-09-14 11:53:31 +02:00
|
|
|
public interface ProjectileDelegate {
|
2022-12-04 23:46:45 +01:00
|
|
|
interface ConfigurationListener extends ProjectileDelegate {
|
|
|
|
Function<Object, ConfigurationListener> PREDICATE = a -> a instanceof ConfigurationListener ? (ConfigurationListener)a : null;
|
|
|
|
|
|
|
|
void configureProjectile(MagicProjectileEntity projectile, Caster<?> caster);
|
|
|
|
}
|
|
|
|
|
|
|
|
interface HitListener extends BlockHitListener, EntityHitListener {
|
|
|
|
@Override
|
|
|
|
default void onImpact(MagicProjectileEntity projectile, BlockHitResult hit) {
|
|
|
|
onImpact(projectile);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
default void onImpact(MagicProjectileEntity projectile, EntityHitResult hit) {
|
|
|
|
onImpact(projectile);
|
|
|
|
}
|
|
|
|
|
|
|
|
void onImpact(MagicProjectileEntity projectile);
|
|
|
|
}
|
|
|
|
|
|
|
|
interface BlockHitListener extends ProjectileDelegate {
|
|
|
|
Function<Object, BlockHitListener> PREDICATE = a -> a instanceof BlockHitListener ? (BlockHitListener)a : null;
|
|
|
|
/**
|
|
|
|
* Called once the projectile lands either hitting the ground or an entity.
|
|
|
|
*/
|
|
|
|
void onImpact(MagicProjectileEntity projectile, BlockHitResult hit);
|
|
|
|
}
|
|
|
|
|
|
|
|
interface EntityHitListener extends ProjectileDelegate {
|
|
|
|
Function<Object, EntityHitListener> PREDICATE = a -> a instanceof EntityHitListener ? (EntityHitListener)a : null;
|
|
|
|
/**
|
|
|
|
* Called once the projectile lands either hitting the ground or an entity.
|
|
|
|
*/
|
|
|
|
void onImpact(MagicProjectileEntity projectile, EntityHitResult hit);
|
|
|
|
}
|
2021-02-14 16:53:44 +01:00
|
|
|
}
|