Class EffectIngredient

java.lang.Object
org.moddingx.libx.crafting.ingredient.EffectIngredient
All Implemented Interfaces:
net.neoforged.neoforge.common.crafting.ICustomIngredient

public class EffectIngredient extends Object implements net.neoforged.neoforge.common.crafting.ICustomIngredient
An ingredient that checks for potion effects to be present on a potion. This does not check for a potion but for the effects. So potions with the CustomPotionEffects nbt tag will also be detected. And you can match a for example a potion of the turtle master and a potion of slowness as both have the slowness effect.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.MapCodec<EffectIngredient>
     
    final List<net.minecraft.world.effect.MobEffectInstance>
    A list of effects that an ItemStack needs.
    final boolean
    Whether potions with more effects than the ones specified in this ingredient are matched.
    final boolean
    Whether potions with a higher amplifier as specified in this ingredient are matched.
    final boolean
    Whether potions with a higher duration as specified in this ingredient are matched.
    final net.minecraft.world.item.Item
    The item required for the potion.
    static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,EffectIngredient>
     
    static final net.neoforged.neoforge.common.crafting.IngredientType<EffectIngredient>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    EffectIngredient(net.minecraft.world.item.Item potionItem, List<net.minecraft.world.effect.MobEffectInstance> effects)
     
    EffectIngredient(net.minecraft.world.item.Item potionItem, List<net.minecraft.world.effect.MobEffectInstance> effects, boolean extraEffects, boolean higherAmplifier, boolean higherDuration)
     
    EffectIngredient(net.minecraft.world.item.ItemStack potionStack)
     
    EffectIngredient(net.minecraft.world.item.ItemStack potionStack, boolean extraEffects, boolean higherAmplifier, boolean higherDuration)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Stream<net.minecraft.world.item.ItemStack>
     
    net.neoforged.neoforge.common.crafting.IngredientType<?>
     
    boolean
     
    boolean
    test(net.minecraft.world.item.ItemStack stack)
     

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface net.neoforged.neoforge.common.crafting.ICustomIngredient

    toVanilla
  • Field Details

    • CODEC

      public static final com.mojang.serialization.MapCodec<EffectIngredient> CODEC
    • STREAM_CODEC

      public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,EffectIngredient> STREAM_CODEC
    • TYPE

      public static final net.neoforged.neoforge.common.crafting.IngredientType<EffectIngredient> TYPE
    • potionItem

      @Nullable public final net.minecraft.world.item.Item potionItem
      The item required for the potion. Can be null t match any item.
    • effects

      public final List<net.minecraft.world.effect.MobEffectInstance> effects
      A list of effects that an ItemStack needs.
    • extraEffects

      public final boolean extraEffects
      Whether potions with more effects than the ones specified in this ingredient are matched.
    • higherAmplifier

      public final boolean higherAmplifier
      Whether potions with a higher amplifier as specified in this ingredient are matched.
    • higherDuration

      public final boolean higherDuration
      Whether potions with a higher duration as specified in this ingredient are matched.
  • Constructor Details

    • EffectIngredient

      public EffectIngredient(net.minecraft.world.item.ItemStack potionStack)
    • EffectIngredient

      public EffectIngredient(net.minecraft.world.item.ItemStack potionStack, boolean extraEffects, boolean higherAmplifier, boolean higherDuration)
    • EffectIngredient

      public EffectIngredient(@Nullable net.minecraft.world.item.Item potionItem, List<net.minecraft.world.effect.MobEffectInstance> effects)
    • EffectIngredient

      public EffectIngredient(@Nullable net.minecraft.world.item.Item potionItem, List<net.minecraft.world.effect.MobEffectInstance> effects, boolean extraEffects, boolean higherAmplifier, boolean higherDuration)
  • Method Details

    • getType

      @Nonnull public net.neoforged.neoforge.common.crafting.IngredientType<?> getType()
      Specified by:
      getType in interface net.neoforged.neoforge.common.crafting.ICustomIngredient
    • getItems

      @Nonnull public Stream<net.minecraft.world.item.ItemStack> getItems()
      Specified by:
      getItems in interface net.neoforged.neoforge.common.crafting.ICustomIngredient
    • test

      public boolean test(@Nullable net.minecraft.world.item.ItemStack stack)
      Specified by:
      test in interface net.neoforged.neoforge.common.crafting.ICustomIngredient
    • isSimple

      public boolean isSimple()
      Specified by:
      isSimple in interface net.neoforged.neoforge.common.crafting.ICustomIngredient