Interface EntityElytraEvents.Custom
- Enclosing class:
EntityElytraEvents
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanuseCustomElytra(net.minecraft.world.entity.LivingEntity entity, boolean tickElytra) Try to use a custom elytra for an entity.
-
Method Details
-
useCustomElytra
boolean useCustomElytra(net.minecraft.world.entity.LivingEntity entity, boolean tickElytra) Try to use a custom elytra for an entity. A custom elytra is anything that allows an entity to enter and continue elytra flight when some condition is met. Listeners should follow the following pattern:EntityElytraEvents.CUSTOM.register((entity, tickElytra) -> { if (check if condition for custom elytra is met) { if (tickElytra) { // Optionally consume some resources that are being used up in order to fly, for example damaging an item. // Optionally perform other side effects of elytra flight, for example playing a sound. } // Allow entering/continuing elytra flight with this custom elytra return true; } // Condition for the custom elytra is not met: don't let players enter or continue elytra flight (unless another elytra is available). return false; });- Parameters:
entity- the entitytickElytra- false if this is just to check if the custom elytra can be used, true if the custom elytra should also be ticked, i.e. perform side-effects of flying such as using resources.- Returns:
- true to use a custom elytra, enabling elytra flight for the entity and cancelling subsequent handlers
-