Record Class BlockComponent

java.lang.Object
java.lang.Record
dev.latvian.mods.kubejs.recipe.component.BlockComponent
All Implemented Interfaces:
RecipeComponent<net.minecraft.world.level.block.Block>

public record BlockComponent(boolean allowEmpty) extends Record implements RecipeComponent<net.minecraft.world.level.block.Block>
  • Field Details

    • BLOCK

      public static final RecipeComponentType<net.minecraft.world.level.block.Block> BLOCK
    • OPTIONAL_BLOCK

      public static final RecipeComponentType<net.minecraft.world.level.block.Block> OPTIONAL_BLOCK
  • Constructor Details

    • BlockComponent

      public BlockComponent(boolean allowEmpty)
      Creates an instance of a BlockComponent record class.
      Parameters:
      allowEmpty - the value for the allowEmpty record component
  • Method Details

    • type

      public RecipeComponentType<?> type()
      Specified by:
      type in interface RecipeComponent<net.minecraft.world.level.block.Block>
    • codec

      public com.mojang.serialization.Codec<net.minecraft.world.level.block.Block> codec()
      Specified by:
      codec in interface RecipeComponent<net.minecraft.world.level.block.Block>
    • typeInfo

      public dev.latvian.mods.rhino.type.TypeInfo typeInfo()
      Description copied from interface: RecipeComponent
      Defines a description for how this component may be constructed. Type descriptions may be comprised of a primitive type such as a string, number or Java class (which may be useful if that that class has an appropriate type wrapper for it already), an array of fixed or dynamic length, a map / object, or a union of multiple types.

      Type descriptions are used by addons like ProbeJS to provide typing hints.

      Specified by:
      typeInfo in interface RecipeComponent<net.minecraft.world.level.block.Block>
      Returns:
      A description of how this component may be constructed
    • wrap

      public net.minecraft.world.level.block.Block wrap(RecipeScriptContext cx, Object from)
      Description copied from interface: RecipeComponent
      Method to read the value contained within this component from an input object; this may be some arbitrary value passed into a schema's constructor(s) or automatically generated builder methods. By default, it will attempt to type wrap based on RecipeComponent.typeInfo()
      Specified by:
      wrap in interface RecipeComponent<net.minecraft.world.level.block.Block>
      Parameters:
      cx - Script context
      from - An object to be converted to a value for this component
      Returns:
      The value read from the input
    • matches

      public boolean matches(RecipeMatchContext cx, net.minecraft.world.level.block.Block value, ReplacementMatchInfo match)
      Specified by:
      matches in interface RecipeComponent<net.minecraft.world.level.block.Block>
      Parameters:
      cx - Script context
      value - The value to check
      match - The replacement match to check against
      Returns:
      true if the given value matches the given replacement match.
    • isEmpty

      public boolean isEmpty(net.minecraft.world.level.block.Block value)
      Description copied from interface: RecipeComponent
      Shallow empty check function
      Specified by:
      isEmpty in interface RecipeComponent<net.minecraft.world.level.block.Block>
    • buildUniqueId

      public void buildUniqueId(UniqueIdBuilder builder, net.minecraft.world.level.block.Block value)
      Specified by:
      buildUniqueId in interface RecipeComponent<net.minecraft.world.level.block.Block>
    • 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
    • toString

      public String toString(OpsContainer ops, net.minecraft.world.level.block.Block value)
      Specified by:
      toString in interface RecipeComponent<net.minecraft.world.level.block.Block>
    • 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. All components in this record class 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.
    • allowEmpty

      public boolean allowEmpty()
      Returns the value of the allowEmpty record component.
      Specified by:
      allowEmpty in interface RecipeComponent<net.minecraft.world.level.block.Block>
      Returns:
      the value of the allowEmpty record component