Class EffectIngredient

java.lang.Object
net.minecraft.world.item.crafting.Ingredient
org.moddingx.libx.crafting.ingredient.EffectIngredient
All Implemented Interfaces:
Predicate<net.minecraft.world.item.ItemStack>

public class EffectIngredient extends net.minecraft.world.item.crafting.Ingredient
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.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     

    Nested classes/interfaces inherited from class net.minecraft.world.item.crafting.Ingredient

    net.minecraft.world.item.crafting.Ingredient.ItemValue, net.minecraft.world.item.crafting.Ingredient.TagValue, net.minecraft.world.item.crafting.Ingredient.Value
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    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.

    Fields inherited from class net.minecraft.world.item.crafting.Ingredient

    EMPTY, values
  • 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
    net.minecraft.world.item.ItemStack[]
     
    net.minecraftforge.common.crafting.IIngredientSerializer<? extends net.minecraft.world.item.crafting.Ingredient>
     
     
    boolean
     
    boolean
     
    boolean
    test(net.minecraft.world.item.ItemStack stack)
     
     

    Methods inherited from class net.minecraft.world.item.crafting.Ingredient

    checkInvalidation, fromJson, fromJson, fromNetwork, fromValues, invalidate, invalidateAll, isVanilla, markValid, merge, of, of, of, of, of, toNetwork, valueFromJson

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface java.util.function.Predicate

    and, negate, or
  • Field Details

    • 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

    • getItems

      @Nonnull public net.minecraft.world.item.ItemStack[] getItems()
      Overrides:
      getItems in class net.minecraft.world.item.crafting.Ingredient
    • test

      public boolean test(@Nullable net.minecraft.world.item.ItemStack stack)
      Specified by:
      test in interface Predicate<net.minecraft.world.item.ItemStack>
      Overrides:
      test in class net.minecraft.world.item.crafting.Ingredient
    • getStackingIds

      @Nonnull public IntList getStackingIds()
      Overrides:
      getStackingIds in class net.minecraft.world.item.crafting.Ingredient
    • isSimple

      public boolean isSimple()
      Overrides:
      isSimple in class net.minecraft.world.item.crafting.Ingredient
    • getSerializer

      @Nonnull public net.minecraftforge.common.crafting.IIngredientSerializer<? extends net.minecraft.world.item.crafting.Ingredient> getSerializer()
      Overrides:
      getSerializer in class net.minecraft.world.item.crafting.Ingredient
    • isEmpty

      public boolean isEmpty()
      Overrides:
      isEmpty in class net.minecraft.world.item.crafting.Ingredient
    • toJson

      @Nonnull public JsonElement toJson()
      Overrides:
      toJson in class net.minecraft.world.item.crafting.Ingredient