Package dev.dhyces.trimmed.api
Record Class KeyResolver.Dynamic<T>
java.lang.Object
java.lang.Record
dev.dhyces.trimmed.api.KeyResolver.Dynamic<T>
- All Implemented Interfaces:
KeyResolver<T>,KeyResolver.RegistryResolver<T>
- Enclosing interface:
KeyResolver<T>
public static record KeyResolver.Dynamic<T>(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> registryKey)
extends Record
implements KeyResolver.RegistryResolver<T>
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.dhyces.trimmed.api.KeyResolver
KeyResolver.Dynamic<T>, KeyResolver.RegistryResolver<T>, KeyResolver.Static<T> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecode(net.minecraft.resources.ResourceLocation resourceLocation, com.mojang.serialization.DynamicOps<?> ops) final booleanIndicates whether some other object is "equal to" this one.net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> getKey()net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, T> final inthashCode()Returns a hash code value for this object.net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> Returns the value of theregistryKeyrecord component.booleanfinal StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
Dynamic
public Dynamic(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> registryKey) Creates an instance of aDynamicrecord class.- Parameters:
registryKey- the value for theregistryKeyrecord component
-
-
Method Details
-
getKey
- Specified by:
getKeyin interfaceKeyResolver.RegistryResolver<T>
-
decode
@Nullable public T decode(net.minecraft.resources.ResourceLocation resourceLocation, com.mojang.serialization.DynamicOps<?> ops) - Specified by:
decodein interfaceKeyResolver<T>
-
getStreamCodec
public net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf,T> getStreamCodec()- Specified by:
getStreamCodecin interfaceKeyResolver<T>
-
requiresActiveWorld
public boolean requiresActiveWorld()- Specified by:
requiresActiveWorldin interfaceKeyResolver<T>
-
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. -
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). -
registryKey
Returns the value of theregistryKeyrecord component.- Returns:
- the value of the
registryKeyrecord component
-