Class ActionWhenSprayedPower
java.lang.Object
io.github.apace100.apoli.power.Power
dev.jaxydog.astral.content.power.AstralPower
dev.jaxydog.astral.content.power.custom.ActionWhenSprayedPower
Runs an action when the holding entity is sprayed.
This is the inverse of ActionOnSprayPower.
- Since:
- 1.7.0
-
Field Summary
Fields inherited from class io.github.apace100.apoli.power.Power
conditions, entity, type -
Constructor Summary
ConstructorsConstructorDescriptionActionWhenSprayedPower(io.github.apace100.apoli.power.PowerType<?> type, net.minecraft.entity.LivingEntity entity, int priority, int charges, @Nullable Consumer<net.minecraft.util.Pair<net.minecraft.entity.Entity, net.minecraft.entity.Entity>> bientityAction, @Nullable Predicate<net.minecraft.util.Pair<net.minecraft.entity.Entity, net.minecraft.entity.Entity>> bientityCondition, @Nullable Consumer<net.minecraft.util.Pair<net.minecraft.world.World, net.minecraft.item.ItemStack>> itemAction, @Nullable Predicate<net.minecraft.item.ItemStack> itemCondition) Creates a new action when sprayed power. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanSpray(net.minecraft.entity.Entity actor, net.minecraft.item.ItemStack stack) Returns whether this entity may be sprayed using the given stack and actor entity.intReturns the total number of charges to consume when a spray is successful.Returns this power's default factory.intReturns the power's execution priority, which is used to determine when this power is triggered compared to other held powers.voidonSpray(net.minecraft.entity.Entity actor, net.minecraft.item.ItemStack stack) Attempts to spray the entity that holds this power.Methods inherited from class io.github.apace100.apoli.power.Power
addCondition, createSimpleFactory, fromTag, getType, isActive, onAdded, onGained, onLost, onRemoved, onRespawn, setTicking, setTicking, shouldTick, shouldTickWhenInactive, tick, toTag
-
Constructor Details
-
ActionWhenSprayedPower
public ActionWhenSprayedPower(io.github.apace100.apoli.power.PowerType<?> type, net.minecraft.entity.LivingEntity entity, int priority, int charges, @Nullable @Nullable Consumer<net.minecraft.util.Pair<net.minecraft.entity.Entity, net.minecraft.entity.Entity>> bientityAction, @Nullable @Nullable Predicate<net.minecraft.util.Pair<net.minecraft.entity.Entity, net.minecraft.entity.Entity>> bientityCondition, @Nullable @Nullable Consumer<net.minecraft.util.Pair<net.minecraft.world.World, net.minecraft.item.ItemStack>> itemAction, @Nullable @Nullable Predicate<net.minecraft.item.ItemStack> itemCondition) Creates a new action when sprayed power.- Parameters:
type- The power type.entity- The holding entity.priority- The execution priority.charges- The charges consumed when the action is run.bientityAction- An action run on both entities when spraying.bientityCondition- A predicate that only allows the action to be run if it resolves totrue.itemAction- An action run on the held item when spraying.itemCondition- A predicate that only allows the action to be run if it resolves totrue.- Since:
- 1.7.0
-
-
Method Details
-
getFactory
Returns this power's default factory.- Returns:
- This power's default factory.
- Since:
- 1.7.0
-
getPriority
public int getPriority()Returns the power's execution priority, which is used to determine when this power is triggered compared to other held powers.- Returns:
- The execution priority.
- Since:
- 1.7.0
-
getCharges
public int getCharges()Returns the total number of charges to consume when a spray is successful.- Returns:
- The expended charges.
- Since:
- 1.7.0
-
canSpray
public boolean canSpray(net.minecraft.entity.Entity actor, net.minecraft.item.ItemStack stack) Returns whether this entity may be sprayed using the given stack and actor entity.- Parameters:
actor- The actor entity.stack- The item stack.- Returns:
- Whether this entity may be sprayed.
- Since:
- 1.7.0
-
onSpray
public void onSpray(net.minecraft.entity.Entity actor, net.minecraft.item.ItemStack stack) Attempts to spray the entity that holds this power.- Parameters:
actor- The actor entity.stack- The item stack.- Since:
- 1.7.0
-