Package dev.latvian.mods.kubejs.util
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
ConstructorsConstructorDescriptionCachedComponentObject(UUID cacheKey, T value, S stack, net.minecraft.core.component.DataComponentPatch components, org.apache.commons.lang3.mutable.Mutable<String> iconPath) Creates an instance of aCachedComponentObjectrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncacheKey()Returns the value of thecacheKeyrecord component.net.minecraft.core.component.DataComponentPatchReturns the value of thecomponentsrecord component.booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.org.apache.commons.lang3.mutable.Mutable<String> iconPath()Returns the value of theiconPathrecord 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) stack()Returns the value of thestackrecord component.final StringtoString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.static <T extends RegistryObjectKJS<T>>
voidwriteCacheKey(net.minecraft.network.FriendlyByteBuf buf, T value, net.minecraft.core.component.DataComponentPatch components)
-
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 aCachedComponentObjectrecord class.- Parameters:
cacheKey- the value for thecacheKeyrecord componentvalue- the value for thevaluerecord componentstack- the value for thestackrecord componentcomponents- the value for thecomponentsrecord componenticonPath- the value for theiconPathrecord 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
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 withObjects::equals(Object,Object). -
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. -
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. -
cacheKey
Returns the value of thecacheKeyrecord component.- Returns:
- the value of the
cacheKeyrecord component
-
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-
stack
Returns the value of thestackrecord component.- Returns:
- the value of the
stackrecord component
-
components
public net.minecraft.core.component.DataComponentPatch components()Returns the value of thecomponentsrecord component.- Returns:
- the value of the
componentsrecord component
-
iconPath
Returns the value of theiconPathrecord component.- Returns:
- the value of the
iconPathrecord component
-