Class SprayBottleItem

java.lang.Object
net.minecraft.item.Item
dev.jaxydog.astral.content.item.AstralItem
dev.jaxydog.astral.content.item.custom.SprayBottleItem
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 SprayBottleItem extends AstralItem implements Sprayed
A spray bottle item containing water.
Since:
1.6.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 SoundContext
    The sound played when extinguishing a block.
    static final SoundContext
    The sound played when extinguishing an entity.
    static final int
    The maximum amount of sprays contained within the bottle.
    static final SoundContext
    The sound played when wetting a sponge.

    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
    SprayBottleItem(String path, net.minecraft.item.Item.Settings settings)
    Creates a new item using the given settings.
    SprayBottleItem(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)
     
    Returns a list of behaviors for this spray item.
    void
    onCraft(net.minecraft.item.ItemStack stack, net.minecraft.world.World world, net.minecraft.entity.player.PlayerEntity player)
     
    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.AstralItem

    getItemGroup, getRegistryPath

    Methods inherited from class net.minecraft.item.Item

    asItem, byRawId, canBeNested, canMine, canRepair, damage, finishUsing, fromBlock, getAttributeModifiers, getDefaultStack, getDrinkSound, getEatSound, getEnchantability, getFoodComponent, getItemBarColor, getItemBarStep, getMaxCount, getMaxDamage, getMaxUseTime, getMiningSpeedMultiplier, getName, getName, getOrCreateTranslationKey, getRarity, getRawId, getRecipeRemainder, getRegistryEntry, getRequiredFeatures, getTooltipData, getTranslationKey, getTranslationKey, getUseAction, hasGlint, hasRecipeRemainder, inventoryTick, isDamageable, isEnchantable, isFireproof, isFood, isItemBarVisible, isNbtSynced, isNetworkSynced, isSuitableFor, isUsedOnRelease, onClicked, 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.6.0
      See Also:
    • EXTINGUISH_BLOCK_SOUND

      public static final SoundContext EXTINGUISH_BLOCK_SOUND
      The sound played when extinguishing a block.
      Since:
      2.0.0
    • EXTINGUISH_ENTITY_SOUND

      public static final SoundContext EXTINGUISH_ENTITY_SOUND
      The sound played when extinguishing an entity.
      Since:
      2.0.0
    • SPONGE_SQUISH_SOUND

      public static final SoundContext SPONGE_SQUISH_SOUND
      The sound played when wetting a sponge.
      Since:
      2.0.0
  • Constructor Details

    • SprayBottleItem

      public SprayBottleItem(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
    • SprayBottleItem

      public SprayBottleItem(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.6.0
  • Method Details

    • 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 AstralItem
    • 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.Item
    • 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.Item
    • onCraft

      public void onCraft(net.minecraft.item.ItemStack stack, net.minecraft.world.World world, net.minecraft.entity.player.PlayerEntity player)
      Overrides:
      onCraft in class net.minecraft.item.Item
    • 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: