Record Class RegExIngredient

java.lang.Object
java.lang.Record
dev.latvian.mods.kubejs.ingredient.RegExIngredient
All Implemented Interfaces:
KubeJSIngredient, Predicate<net.minecraft.world.item.ItemStack>, net.neoforged.neoforge.common.crafting.ICustomIngredient

public record RegExIngredient(Pattern pattern, String patternString) extends Record implements KubeJSIngredient
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.MapCodec<RegExIngredient>
     
    static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,RegExIngredient>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    RegExIngredient(Pattern pattern, String patternString)
    Creates an instance of a RegExIngredient record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Indicates whether some other object is "equal to" this one.
    net.neoforged.neoforge.common.crafting.IngredientType<?>
     
    int
    Returns a hash code value for this object.
    Returns the value of the pattern record component.
    Returns the value of the patternString record component.
    boolean
    test(@Nullable net.minecraft.world.item.ItemStack stack)
     
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

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

    toVanilla

    Methods inherited from interface dev.latvian.mods.kubejs.ingredient.KubeJSIngredient

    getItems, isSimple

    Methods inherited from interface java.util.function.Predicate

    and, negate, or
  • Field Details

    • CODEC

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

      public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf,RegExIngredient> STREAM_CODEC
  • Constructor Details

    • RegExIngredient

      public RegExIngredient(Pattern pattern)
    • RegExIngredient

      public RegExIngredient(Pattern pattern, String patternString)
      Creates an instance of a RegExIngredient record class.
      Parameters:
      pattern - the value for the pattern record component
      patternString - the value for the patternString record component
  • Method Details

    • getType

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

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

      public boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • hashCode

      public int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • pattern

      public Pattern pattern()
      Returns the value of the pattern record component.
      Returns:
      the value of the pattern record component
    • patternString

      public String patternString()
      Returns the value of the patternString record component.
      Returns:
      the value of the patternString record component