Record Class NativeTypeInfo

java.lang.Object
java.lang.Record
com.blamejared.crafttweaker.api.natives.NativeTypeInfo
Record Components:
name - The fully qualified name of the class as exposed to ZenCode. It does not have to match the actual name.
targetedType - The native class this native type information is for.
constructors - NativeTypeInfo.Constructors that ZenCode should know about, allowing them to be used in scripts.
methods - NativeTypeInfo.Methods that ZenCode should know about, allowing them to be used in scripts.

public record NativeTypeInfo(String name, Class<?> targetedType, NativeTypeInfo.Constructor[] constructors, NativeTypeInfo.Method[] methods) extends Record
Holds information relative to a specific native type that is yet to be registered to ZenCode.

This record is used as a holder to store all information related to a specific native type, providing thus a uniform interface from which CraftTweaker is able to read information and bake data necessary to properly provide information to the ZenCode scripting engine.

Once all information has been used to build a well-formed type, instances of the ZenCode data will be available through the INativeTypeRegistry.

Since:
9.1.0
  • Constructor Details

    • NativeTypeInfo

      public NativeTypeInfo(String name, Class<?> targetedType, NativeTypeInfo.Constructor... constructors)
      Creates an instance holding information relative to a specific native type that should be exposed to ZenCode.

      The created instance will not expose any native methods.

      Parameters:
      name - The fully qualified name of the class as exposed to ZenCode. It does not have to match the actual name.
      targetedType - The native class this native type information is for.
      constructors - NativeTypeInfo.Constructors that ZenCode should know about, allowing them to be used in scripts.
      Since:
      9.1.0
    • NativeTypeInfo

      public NativeTypeInfo(String name, Class<?> targetedType, NativeTypeInfo.Constructor[] constructors, NativeTypeInfo.Method... methods)
      Creates an instance of a NativeTypeInfo record class.
      Parameters:
      name - the value for the name record component
      targetedType - the value for the targetedType record component
      constructors - the value for the constructors record component
      methods - the value for the methods record component
  • Method Details

    • 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. 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.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • targetedType

      public Class<?> targetedType()
      Returns the value of the targetedType record component.
      Returns:
      the value of the targetedType record component
    • constructors

      public NativeTypeInfo.Constructor[] constructors()
      Returns the value of the constructors record component.
      Returns:
      the value of the constructors record component
    • methods

      public NativeTypeInfo.Method[] methods()
      Returns the value of the methods record component.
      Returns:
      the value of the methods record component