Record Class CachedComponentObject<T extends RegistryObjectKJS<T>,S>

java.lang.Object
java.lang.Record
dev.latvian.mods.kubejs.util.CachedComponentObject<T,S>

public record CachedComponentObject<T extends RegistryObjectKJS<T>,S>(UUID cacheKey, T extends RegistryObjectKJS<T> value, S stack, net.minecraft.core.component.DataComponentPatch components, org.apache.commons.lang3.mutable.Mutable<String> iconPath) extends Record
  • Constructor Summary

    Constructors
    Constructor
    Description
    CachedComponentObject(UUID cacheKey, T value, S stack, net.minecraft.core.component.DataComponentPatch components, org.apache.commons.lang3.mutable.Mutable<String> iconPath)
    Creates an instance of a CachedComponentObject record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the cacheKey record component.
    net.minecraft.core.component.DataComponentPatch
    Returns the value of the components record component.
    boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    org.apache.commons.lang3.mutable.Mutable<String>
    Returns the value of the iconPath record component.
    static <T extends RegistryObjectKJS<T>, S>
    CachedComponentObject<T,S>
    of(T value, S stack, net.minecraft.core.component.DataComponentPatch components)
     
    static CachedComponentObject<net.minecraft.world.level.material.Fluid,net.neoforged.neoforge.fluids.FluidStack>
    ofFluidStack(net.neoforged.neoforge.fluids.FluidStack stack, boolean visual)
     
    static CachedComponentObject<net.minecraft.world.item.Item,net.minecraft.world.item.ItemStack>
    ofItemStack(net.minecraft.world.item.ItemStack stack, boolean visual)
     
    Returns the value of the stack record component.
    final String
    Returns a string representation of this record class.
    Returns the value of the value record component.
    static <T extends RegistryObjectKJS<T>>
    void
    writeCacheKey(net.minecraft.network.FriendlyByteBuf buf, T value, net.minecraft.core.component.DataComponentPatch components)
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • CachedComponentObject

      public CachedComponentObject(UUID cacheKey, T value, S stack, net.minecraft.core.component.DataComponentPatch components, org.apache.commons.lang3.mutable.Mutable<String> iconPath)
      Creates an instance of a CachedComponentObject record class.
      Parameters:
      cacheKey - the value for the cacheKey record component
      value - the value for the value record component
      stack - the value for the stack record component
      components - the value for the components record component
      iconPath - the value for the iconPath record component
  • Method Details

    • writeCacheKey

      public static <T extends RegistryObjectKJS<T>> void writeCacheKey(net.minecraft.network.FriendlyByteBuf buf, T value, net.minecraft.core.component.DataComponentPatch components)
    • of

      public static <T extends RegistryObjectKJS<T>, S> CachedComponentObject<T,S> of(T value, S stack, net.minecraft.core.component.DataComponentPatch components)
    • ofItemStack

      public static CachedComponentObject<net.minecraft.world.item.Item,net.minecraft.world.item.ItemStack> ofItemStack(net.minecraft.world.item.ItemStack stack, boolean visual)
    • ofFluidStack

      public static CachedComponentObject<net.minecraft.world.level.material.Fluid,net.neoforged.neoforge.fluids.FluidStack> ofFluidStack(net.neoforged.neoforge.fluids.FluidStack stack, boolean visual)
    • 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.
    • 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
    • cacheKey

      public UUID cacheKey()
      Returns the value of the cacheKey record component.
      Returns:
      the value of the cacheKey record component
    • value

      public T value()
      Returns the value of the value record component.
      Returns:
      the value of the value record component
    • stack

      public S stack()
      Returns the value of the stack record component.
      Returns:
      the value of the stack record component
    • components

      public net.minecraft.core.component.DataComponentPatch components()
      Returns the value of the components record component.
      Returns:
      the value of the components record component
    • iconPath

      public org.apache.commons.lang3.mutable.Mutable<String> iconPath()
      Returns the value of the iconPath record component.
      Returns:
      the value of the iconPath record component