Record Class Conversion.ItemStackComponentConversion<T>

java.lang.Object
java.lang.Record
com.petrolpark.util.Conversion.ItemStackComponentConversion<T>
All Implemented Interfaces:
Conversion<net.minecraft.world.item.ItemStack>, Conversion.ItemStackConversion
Enclosing interface:
Conversion<T>

public static record Conversion.ItemStackComponentConversion<T>(Predicate<net.minecraft.world.item.ItemStack> predicate, Supplier<net.minecraft.core.component.DataComponentType<T>> component, BiFunction<net.minecraft.world.level.Level,T,T> map, boolean pass) extends Record implements Conversion.ItemStackConversion
  • Constructor Details

    • ItemStackComponentConversion

      public ItemStackComponentConversion(Predicate<net.minecraft.world.item.ItemStack> predicate, Supplier<net.minecraft.core.component.DataComponentType<T>> component, BiFunction<net.minecraft.world.level.Level,T,T> map, boolean pass)
      Creates an instance of a ItemStackComponentConversion record class.
      Parameters:
      predicate - the value for the predicate record component
      component - the value for the component record component
      map - the value for the map record component
      pass - the value for the pass record component
  • Method Details

    • convert

      public Conversion.ConversionResult<net.minecraft.world.item.ItemStack> convert(net.minecraft.world.level.Level level, net.minecraft.world.item.ItemStack object, @Nullable net.minecraft.world.entity.player.Player player)
      Specified by:
      convert in interface Conversion<T>
    • toString

      public final 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
    • hashCode

      public final 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
    • equals

      public final 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • predicate

      public Predicate<net.minecraft.world.item.ItemStack> predicate()
      Returns the value of the predicate record component.
      Returns:
      the value of the predicate record component
    • component

      public Supplier<net.minecraft.core.component.DataComponentType<T>> component()
      Returns the value of the component record component.
      Returns:
      the value of the component record component
    • map

      public BiFunction<net.minecraft.world.level.Level,T,T> map()
      Returns the value of the map record component.
      Returns:
      the value of the map record component
    • pass

      public boolean pass()
      Returns the value of the pass record component.
      Returns:
      the value of the pass record component