Class SprayPotionItem

java.lang.Object
net.minecraft.item.Item
net.minecraft.item.PotionItem
dev.jaxydog.astral.content.item.AstralPotionItem
dev.jaxydog.astral.content.item.custom.SprayPotionItem
All Implemented Interfaces:
Custom, Sprayed, LoreHolder, Registered, Registered.Client, Registered.Common, net.fabricmc.fabric.api.item.v1.FabricItem, net.minecraft.item.ItemConvertible, net.minecraft.resource.featuretoggle.ToggleableFeature

public class SprayPotionItem extends AstralPotionItem implements Sprayed
A spray bottle item containing potion effects.
Since:
1.7.0
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.minecraft.item.Item

    net.minecraft.item.Item.Settings

    Nested classes/interfaces inherited from interface dev.jaxydog.astral.register.Registered

    Registered.All, Registered.Client, Registered.Common, Registered.Generated, Registered.Server

    Nested classes/interfaces inherited from interface dev.jaxydog.astral.content.item.custom.Sprayed

    Sprayed.Behavior<T extends Sprayed.SprayTarget>, Sprayed.BlockTarget, Sprayed.EntityTarget, Sprayed.RefillContext, Sprayed.Source, Sprayed.SprayResult, Sprayed.SprayTarget
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final float
    The multiplier used to lessen the duration of the stored potion effects.
    static final int
    The maximum amount of sprays contained within the bottle.

    Fields inherited from class net.minecraft.item.Item

    ATTACK_DAMAGE_MODIFIER_ID, ATTACK_SPEED_MODIFIER_ID, BLOCK_ITEMS, DEFAULT_MAX_COUNT, DEFAULT_MAX_USE_TIME, ITEM_BAR_STEPS

    Fields inherited from interface dev.jaxydog.astral.content.item.custom.Sprayed

    EMPTY_MODEL_ID, REFILL_SOUND, SPRAY_SOUND

    Fields inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature

    FEATURE_ENABLED_REGISTRY_KEYS
  • Constructor Summary

    Constructors
    Constructor
    Description
    SprayPotionItem(String path, net.minecraft.item.Item.Settings settings)
    Creates a new item using the given settings.
    SprayPotionItem(String path, net.minecraft.item.Item.Settings settings, @Nullable Supplier<net.minecraft.registry.RegistryKey<net.minecraft.item.ItemGroup>> preferredGroup)
    Creates a new item using the given settings.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T extends Sprayed.SprayTarget>
    void
    addBehavior(Class<T> type, Sprayed.Behavior<T> behavior)
    Adds a new behavior to this spray item.
    void
    appendTooltip(net.minecraft.item.ItemStack stack, net.minecraft.world.World world, List<net.minecraft.text.Text> tooltip, net.minecraft.client.item.TooltipContext context)
     
    net.minecraft.item.ItemStack
    finishUsing(net.minecraft.item.ItemStack stack, net.minecraft.world.World world, net.minecraft.entity.LivingEntity user)
     
    Returns a list of behaviors for this spray item.
    int
    getColor(net.minecraft.item.ItemStack stack, int index)
    Returns the item stack's color modifier at the given index.
    int
    getMaxUseTime(net.minecraft.item.ItemStack stack)
     
    void
    Registers this value on the client environment.
    void
    Registers this value on both the client and server environments.
    net.minecraft.util.TypedActionResult<net.minecraft.item.ItemStack>
    use(net.minecraft.world.World world, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand)
     
    net.minecraft.util.ActionResult
    useOnBlock(net.minecraft.item.ItemUsageContext context)
     
    net.minecraft.util.ActionResult
    useOnEntity(net.minecraft.item.ItemStack stack, net.minecraft.entity.player.PlayerEntity player, net.minecraft.entity.LivingEntity entity, net.minecraft.util.Hand hand)
     

    Methods inherited from class dev.jaxydog.astral.content.item.AstralPotionItem

    getItemGroup, getRegistryPath

    Methods inherited from class net.minecraft.item.PotionItem

    getDefaultStack, getTranslationKey, getUseAction

    Methods inherited from class net.minecraft.item.Item

    asItem, byRawId, canBeNested, canMine, canRepair, damage, fromBlock, getAttributeModifiers, getDrinkSound, getEatSound, getEnchantability, getFoodComponent, getItemBarColor, getItemBarStep, getMaxCount, getMaxDamage, getMiningSpeedMultiplier, getName, getName, getOrCreateTranslationKey, getRarity, getRawId, getRecipeRemainder, getRegistryEntry, getRequiredFeatures, getTooltipData, getTranslationKey, hasGlint, hasRecipeRemainder, inventoryTick, isDamageable, isEnchantable, isFireproof, isFood, isItemBarVisible, isNbtSynced, isNetworkSynced, isSuitableFor, isUsedOnRelease, onClicked, onCraft, onItemEntityDestroyed, onStackClicked, onStoppedUsing, postHit, postMine, postProcessNbt, raycast, toString, usageTick

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface dev.jaxydog.astral.content.item.Custom

    getItemGroup

    Methods inherited from interface net.fabricmc.fabric.api.item.v1.FabricItem

    allowContinuingBlockBreaking, allowNbtUpdateAnimation, getAttributeModifiers, getRecipeRemainder, isSuitableFor

    Methods inherited from interface net.minecraft.item.ItemConvertible

    asItem

    Methods inherited from interface dev.jaxydog.astral.content.item.LoreHolder

    formatLoreText, getLoreTooltips

    Methods inherited from interface dev.jaxydog.astral.register.Registered

    getRegistryId, getRegistryPath

    Methods inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature

    isEnabled
  • Field Details

    • MAX_USES

      public static final int MAX_USES
      The maximum amount of sprays contained within the bottle.
      Since:
      1.7.0
      See Also:
    • DURATION_MULTIPLIER

      public static final float DURATION_MULTIPLIER
      The multiplier used to lessen the duration of the stored potion effects.
      Since:
      1.7.0
      See Also:
  • Constructor Details

    • SprayPotionItem

      public SprayPotionItem(String path, net.minecraft.item.Item.Settings settings, @Nullable @Nullable Supplier<net.minecraft.registry.RegistryKey<net.minecraft.item.ItemGroup>> preferredGroup)
      Creates a new item using the given settings.

      If the preferredGroup supplier is null, this item will not be added to any item groups.

      Parameters:
      path - The item's identifier path.
      settings - The item's settings.
      preferredGroup - The item's preferred item group.
      Since:
      2.0.0
    • SprayPotionItem

      public SprayPotionItem(String path, net.minecraft.item.Item.Settings settings)
      Creates a new item using the given settings.

      This item will be added to the default item group.

      Parameters:
      path - The item's identifier path.
      settings - The item's settings.
      Since:
      1.7.0
  • Method Details

    • getColor

      public int getColor(net.minecraft.item.ItemStack stack, int index)
      Returns the item stack's color modifier at the given index.
      Parameters:
      stack - The item stack.
      index - The color index.
      Returns:
      The color as an integer.
      Since:
      1.7.0
    • addBehavior

      public <T extends Sprayed.SprayTarget> void addBehavior(Class<T> type, Sprayed.Behavior<T> behavior)
      Description copied from interface: Sprayed
      Adds a new behavior to this spray item.
      Specified by:
      addBehavior in interface Sprayed
      Type Parameters:
      T - The behavior's target type.
      Parameters:
      type - The class of the behavior's target type.
      behavior - The entity behavior.
    • getBehaviors

      public <T extends Sprayed.SprayTarget> List<Sprayed.Behavior<T>> getBehaviors(Class<T> type)
      Description copied from interface: Sprayed
      Returns a list of behaviors for this spray item.
      Specified by:
      getBehaviors in interface Sprayed
      Type Parameters:
      T - The behavior's expected target type.
      Parameters:
      type - The class of the behavior's expected target type.
      Returns:
      A list of behaviors.
    • appendTooltip

      public void appendTooltip(net.minecraft.item.ItemStack stack, net.minecraft.world.World world, List<net.minecraft.text.Text> tooltip, net.minecraft.client.item.TooltipContext context)
      Overrides:
      appendTooltip in class AstralPotionItem
    • use

      public net.minecraft.util.TypedActionResult<net.minecraft.item.ItemStack> use(net.minecraft.world.World world, net.minecraft.entity.player.PlayerEntity player, net.minecraft.util.Hand hand)
      Overrides:
      use in class net.minecraft.item.PotionItem
    • finishUsing

      public net.minecraft.item.ItemStack finishUsing(net.minecraft.item.ItemStack stack, net.minecraft.world.World world, net.minecraft.entity.LivingEntity user)
      Overrides:
      finishUsing in class net.minecraft.item.PotionItem
    • getMaxUseTime

      public int getMaxUseTime(net.minecraft.item.ItemStack stack)
      Overrides:
      getMaxUseTime in class net.minecraft.item.PotionItem
    • useOnEntity

      public net.minecraft.util.ActionResult useOnEntity(net.minecraft.item.ItemStack stack, net.minecraft.entity.player.PlayerEntity player, net.minecraft.entity.LivingEntity entity, net.minecraft.util.Hand hand)
      Overrides:
      useOnEntity in class net.minecraft.item.Item
    • useOnBlock

      public net.minecraft.util.ActionResult useOnBlock(net.minecraft.item.ItemUsageContext context)
      Overrides:
      useOnBlock in class net.minecraft.item.PotionItem
    • registerCommon

      public void registerCommon()
      Description copied from interface: Registered.Common
      Registers this value on both the client and server environments.

      The contained code will run for both environments. If you only want one or the other, see its sister interfaces.

      Specified by:
      registerCommon in interface Custom
      Specified by:
      registerCommon in interface Registered.Common
      See Also:
    • registerClient

      public void registerClient()
      Description copied from interface: Registered.Client
      Registers this value on the client environment.

      The contained code will only ever run on the game client. If you only want the server or want both, see its sister interfaces.

      Specified by:
      registerClient in interface Registered.Client
      Specified by:
      registerClient in interface Sprayed
      See Also: