Class ActionOnSprayPower
java.lang.Object
io.github.apace100.apoli.power.Power
dev.jaxydog.astral.content.power.AstralPower
dev.jaxydog.astral.content.power.custom.ActionOnSprayPower
Runs an action when a block or entity is sprayed.
This is the inverse of ActionWhenSprayedPower.
- Since:
- 1.6.0
-
Field Summary
Fields inherited from class io.github.apace100.apoli.power.Power
conditions, entity, type -
Constructor Summary
ConstructorsConstructorDescriptionActionOnSprayPower(io.github.apace100.apoli.power.PowerType<?> type, net.minecraft.entity.LivingEntity entity, int priority, int charges, @Nullable Consumer<net.minecraft.util.Pair<net.minecraft.world.World, net.minecraft.item.ItemStack>> itemAction, @Nullable Predicate<net.minecraft.item.ItemStack> itemCondition, @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<org.apache.commons.lang3.tuple.Triple<net.minecraft.world.World, net.minecraft.util.math.BlockPos, net.minecraft.util.math.Direction>> blockAction, @Nullable Predicate<net.minecraft.block.pattern.CachedBlockPosition> blockCondition) Creates a new action on sprayed power. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanSpray(net.minecraft.entity.Entity target, net.minecraft.item.ItemStack stack) Returns whether the given entity may be sprayed using the given stack.booleancanSpray(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos, net.minecraft.item.ItemStack stack) Returns whether the given entity may be sprayed using the given stack.intReturns the total number of charges to consume when a spray is successful.static AstralPowerFactory<ActionOnSprayPower> 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 target, net.minecraft.item.ItemStack stack) Attempts to spray the target entity.voidonSpray(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos, net.minecraft.util.math.Direction direction, net.minecraft.item.ItemStack stack) Attempts to spray the target block.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
-
ActionOnSprayPower
public ActionOnSprayPower(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.world.World, net.minecraft.item.ItemStack>> itemAction, @Nullable @Nullable Predicate<net.minecraft.item.ItemStack> itemCondition, @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<org.apache.commons.lang3.tuple.Triple<net.minecraft.world.World, net.minecraft.util.math.BlockPos, net.minecraft.util.math.Direction>> blockAction, @Nullable @Nullable Predicate<net.minecraft.block.pattern.CachedBlockPosition> blockCondition) Creates a new action on sprayed power.- Parameters:
type- The power type.entity- The holding entity.priority- The execution priority.charges- The charges consumed when the action is run.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.bientityAction- An action run on both entities when spraying.bientityCondition- A predicate that only allows the action to be run if it resolves totrue.blockAction- An action run on the targeted block when spraying.blockCondition- A predicate that only allows the action to be run if it resolves totrue.- Since:
- 1.6.0
-
-
Method Details
-
getFactory
Returns this power's default factory.- Returns:
- This power's default factory.
- Since:
- 1.6.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.6.0
-
getCharges
public int getCharges()Returns the total number of charges to consume when a spray is successful.- Returns:
- The expended charges.
- Since:
- 1.6.0
-
canSpray
public boolean canSpray(net.minecraft.entity.Entity target, net.minecraft.item.ItemStack stack) Returns whether the given entity may be sprayed using the given stack.- Parameters:
target- The target entity.stack- The item stack.- Returns:
- Whether the entity may be sprayed.
- Since:
- 1.6.0
-
canSpray
public boolean canSpray(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos, net.minecraft.item.ItemStack stack) Returns whether the given entity may be sprayed using the given stack.- Parameters:
world- The current world.pos- The block's position.stack- The item stack.- Returns:
- Whether the block may be sprayed.
- Since:
- 1.6.0
-
onSpray
public void onSpray(net.minecraft.entity.Entity target, net.minecraft.item.ItemStack stack) Attempts to spray the target entity.- Parameters:
target- The target entity.stack- The item stack.- Since:
- 1.6.0
-
onSpray
public void onSpray(net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos, net.minecraft.util.math.Direction direction, net.minecraft.item.ItemStack stack) Attempts to spray the target block.- Parameters:
world- The current world.pos- The block's position.direction- The side of the block that was sprayed.stack- The item stack.- Since:
- 1.6.0
-