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
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.SettingsNested classes/interfaces inherited from interface dev.jaxydog.astral.register.Registered
Registered.All, Registered.Client, Registered.Common, Registered.Generated, Registered.ServerNested 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
FieldsModifier and TypeFieldDescriptionstatic final floatThe multiplier used to lessen the duration of the stored potion effects.static final intThe 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_STEPSFields inherited from interface dev.jaxydog.astral.content.item.custom.Sprayed
EMPTY_MODEL_ID, REFILL_SOUND, SPRAY_SOUNDFields inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
FEATURE_ENABLED_REGISTRY_KEYS -
Constructor Summary
ConstructorsConstructorDescriptionSprayPotionItem(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 TypeMethodDescription<T extends Sprayed.SprayTarget>
voidaddBehavior(Class<T> type, Sprayed.Behavior<T> behavior) Adds a new behavior to this spray item.voidappendTooltip(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.ItemStackfinishUsing(net.minecraft.item.ItemStack stack, net.minecraft.world.World world, net.minecraft.entity.LivingEntity user) <T extends Sprayed.SprayTarget>
List<Sprayed.Behavior<T>> getBehaviors(Class<T> type) Returns a list of behaviors for this spray item.intgetColor(net.minecraft.item.ItemStack stack, int index) Returns the item stack's color modifier at the given index.intgetMaxUseTime(net.minecraft.item.ItemStack stack) voidRegisters this value on the client environment.voidRegisters 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.ActionResultuseOnBlock(net.minecraft.item.ItemUsageContext context) net.minecraft.util.ActionResultuseOnEntity(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, getRegistryPathMethods inherited from class net.minecraft.item.PotionItem
getDefaultStack, getTranslationKey, getUseActionMethods 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, usageTickMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.jaxydog.astral.content.item.Custom
getItemGroupMethods inherited from interface net.fabricmc.fabric.api.item.v1.FabricItem
allowContinuingBlockBreaking, allowNbtUpdateAnimation, getAttributeModifiers, getRecipeRemainder, isSuitableForMethods inherited from interface net.minecraft.item.ItemConvertible
asItemMethods inherited from interface dev.jaxydog.astral.content.item.LoreHolder
formatLoreText, getLoreTooltipsMethods inherited from interface dev.jaxydog.astral.register.Registered
getRegistryId, getRegistryPathMethods inherited from interface dev.jaxydog.astral.content.item.custom.Sprayed
canSpray, canSpray, getCharges, getCooldown, getDuration, getEmptyModelData, getMaxCharges, isEmpty, isFilled, isRefillable, isSprayable, isSprayable, onSpray, onSpray, refill, setCharges, spray, spray, sprayMethods inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
isEnabled
-
Field Details
-
MAX_USES
public static final int MAX_USESThe maximum amount of sprays contained within the bottle.- Since:
- 1.7.0
- See Also:
-
DURATION_MULTIPLIER
public static final float DURATION_MULTIPLIERThe 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
preferredGroupsupplier isnull, 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
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:SprayedAdds a new behavior to this spray item.- Specified by:
addBehaviorin interfaceSprayed- Type Parameters:
T- The behavior's target type.- Parameters:
type- The class of the behavior's target type.behavior- The entity behavior.
-
getBehaviors
Description copied from interface:SprayedReturns a list of behaviors for this spray item.- Specified by:
getBehaviorsin interfaceSprayed- 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:
appendTooltipin classAstralPotionItem
-
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:
usein classnet.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:
finishUsingin classnet.minecraft.item.PotionItem
-
getMaxUseTime
public int getMaxUseTime(net.minecraft.item.ItemStack stack) - Overrides:
getMaxUseTimein classnet.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:
useOnEntityin classnet.minecraft.item.Item
-
useOnBlock
public net.minecraft.util.ActionResult useOnBlock(net.minecraft.item.ItemUsageContext context) - Overrides:
useOnBlockin classnet.minecraft.item.PotionItem
-
registerCommon
public void registerCommon()Description copied from interface:Registered.CommonRegisters 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:
registerCommonin interfaceCustom- Specified by:
registerCommonin interfaceRegistered.Common- See Also:
-
registerClient
public void registerClient()Description copied from interface:Registered.ClientRegisters 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:
registerClientin interfaceRegistered.Client- Specified by:
registerClientin interfaceSprayed- See Also:
-