Package org.spongepowered.api.data.type
Interface ItemAction
- All Known Subinterfaces:
ItemAction.ApplyEffects,ItemAction.ClearEffects,ItemAction.PlaySound,ItemAction.RemoveEffects,ItemAction.TeleportRandomly
public interface ItemAction
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAppliesPotionEffects with chance.static interfaceClears allPotionEffects.static interfacestatic interfacePlaysSoundType.static interfaceRemovesPotionEffects with matchingPotionEffectTypes.static interfaceTeleports randomly within maximum distance. -
Method Summary
Modifier and TypeMethodDescriptiondefault booleanApplies this effect withItemStack.empty().booleanapply(Living entity, ItemStackLike stack) Tries to apply this effect and returns whether it was successfully applied.static ItemAction.ApplyEffectsapplyEffects(double chance, Collection<PotionEffect> effects) static ItemAction.ApplyEffectsapplyEffects(double chance, PotionEffect... effects) static ItemAction.ApplyEffectsapplyEffects(Collection<PotionEffect> effects) static ItemAction.ApplyEffectsapplyEffects(PotionEffect... effects) static ItemAction.ClearEffectsstatic ItemAction.PlaySoundstatic ItemAction.PlaySoundstatic ItemAction.RemoveEffectsremoveEffects(Collection<PotionEffectType> effectTypes) static ItemAction.RemoveEffectsremoveEffects(Supplier<PotionEffectType>... effectTypes) static ItemAction.RemoveEffectsremoveEffects(PotionEffectType... effectTypes) static ItemAction.RemoveEffectsremoveEffects(Tag<PotionEffectType> effectTypeTag) static ItemAction.TeleportRandomlyteleportRandomly(double distance) type()Returns the type of this effect.
-
Method Details
-
applyEffects
-
applyEffects
-
applyEffects
-
applyEffects
-
removeEffects
-
removeEffects
-
removeEffects
@SafeVarargs static ItemAction.RemoveEffects removeEffects(Supplier<PotionEffectType>... effectTypes) -
removeEffects
-
clearEffects
-
playSound
-
playSound
-
teleportRandomly
-
type
ItemActionType type()Returns the type of this effect.- Returns:
- The type of this effect
-
apply
Tries to apply this effect and returns whether it was successfully applied. The definition of success is purely left up to the implementation.- Parameters:
entity- The entity to apply effect tostack- The item to apply effect with- Returns:
- true if effect was successfully applied
-
apply
Applies this effect withItemStack.empty().- Parameters:
entity- The entity to apply effect to- Returns:
- true if effect was successfully applied
- See Also:
-