Class RandomEffectItem

java.lang.Object
net.minecraft.item.Item
dev.jaxydog.astral.content.item.AstralItem
dev.jaxydog.astral.content.item.custom.RandomEffectItem
All Implemented Interfaces:
Custom, LoreHolder, Registered, Registered.Common, Registered.Generated, net.fabricmc.fabric.api.item.v1.FabricItem, net.minecraft.item.ItemConvertible, net.minecraft.resource.featuretoggle.ToggleableFeature

public class RandomEffectItem extends AstralItem implements Registered.Generated
A custom item that randomly applies a specified effect.
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
  • Field Summary

    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 net.minecraft.resource.featuretoggle.ToggleableFeature

    FEATURE_ENABLED_REGISTRY_KEYS
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    void
    Generates game assets or data.
    void
    inventoryTick(net.minecraft.item.ItemStack stack, net.minecraft.world.World world, net.minecraft.entity.Entity entity, int slot, boolean selected)
     

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

    appendTooltip, 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, isDamageable, isEnchantable, isFireproof, isFood, isItemBarVisible, isNbtSynced, isNetworkSynced, isSuitableFor, isUsedOnRelease, onClicked, onCraft, onItemEntityDestroyed, onStackClicked, onStoppedUsing, postHit, postMine, postProcessNbt, raycast, toString, usageTick, use, useOnBlock, useOnEntity

    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

    registerCommon

    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
  • Constructor Details

    • RandomEffectItem

      public RandomEffectItem(String path, net.minecraft.item.Item.Settings settings, @Nullable @Nullable Supplier<net.minecraft.registry.RegistryKey<net.minecraft.item.ItemGroup>> preferredGroup, float effectChance, net.minecraft.entity.effect.StatusEffect effect)
      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.
      effectChance - The chance that the effect will be applied.
      effect - The status effect to be given to the living entity.
      Since:
      2.0.0
    • RandomEffectItem

      public RandomEffectItem(String path, net.minecraft.item.Item.Settings settings, float effectChance, net.minecraft.entity.effect.StatusEffect effect)
      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.
      effectChance - The chance that the effect will be applied.
      effect - The status effect to be given to the living entity.
      Since:
      1.7.0
  • Method Details

    • inventoryTick

      public void inventoryTick(net.minecraft.item.ItemStack stack, net.minecraft.world.World world, net.minecraft.entity.Entity entity, int slot, boolean selected)
      Overrides:
      inventoryTick in class net.minecraft.item.Item
    • generate

      public void generate()
      Description copied from interface: Registered.Generated
      Generates game assets or data.

      It should be assumed that the contained code will only ever run on the server environment.

      Specified by:
      generate in interface Registered.Generated