Record Class RegistryDataMapSyncPayload<T>
java.lang.Object
java.lang.Record
net.neoforged.neoforge.network.payload.RegistryDataMapSyncPayload<T>
- All Implemented Interfaces:
CustomPacketPayload
@Internal
public record RegistryDataMapSyncPayload<T>(ResourceKey<? extends Registry<T>> registryKey, Map<ResourceLocation,Map<ResourceKey<T>,?>> dataMaps)
extends Record
implements CustomPacketPayload
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.minecraft.network.protocol.common.custom.CustomPacketPayload
CustomPacketPayload.FallbackProvider<B extends FriendlyByteBuf>, CustomPacketPayload.Type<T extends CustomPacketPayload>, CustomPacketPayload.TypeAndCodec<B extends FriendlyByteBuf,
T extends CustomPacketPayload> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map
<ResourceLocation, Map<ResourceKey<T>, ?>> The field for thedataMaps
record component.private static final com.google.gson.Gson
private final ResourceKey
<? extends Registry<T>> The field for theregistryKey
record component.static final StreamCodec
<RegistryFriendlyByteBuf, RegistryDataMapSyncPayload<?>> static final CustomPacketPayload.Type
<RegistryDataMapSyncPayload<?>> -
Constructor Summary
ConstructorsConstructorDescriptionRegistryDataMapSyncPayload
(ResourceKey<? extends Registry<T>> registryKey, Map<ResourceLocation, Map<ResourceKey<T>, ?>> dataMaps) Creates an instance of aRegistryDataMapSyncPayload
record class. -
Method Summary
Modifier and TypeMethodDescriptionMap
<ResourceLocation, Map<ResourceKey<T>, ?>> dataMaps()
Returns the value of thedataMaps
record component.static <T> RegistryDataMapSyncPayload
<T> final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.private static <T> T
readJsonWithRegistryCodec
(RegistryFriendlyByteBuf buf, com.mojang.serialization.Codec<T> codec) ResourceKey
<? extends Registry<T>> Returns the value of theregistryKey
record component.final String
toString()
Returns a string representation of this record class.type()
void
private static <T> void
writeJsonWithRegistryCodec
(RegistryFriendlyByteBuf buf, com.mojang.serialization.Codec<T> codec, T value) Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.minecraft.network.protocol.common.custom.CustomPacketPayload
toVanillaClientbound, toVanillaServerbound
-
Field Details
-
registryKey
The field for theregistryKey
record component. -
dataMaps
The field for thedataMaps
record component. -
TYPE
-
STREAM_CODEC
-
GSON
private static final com.google.gson.Gson GSON
-
-
Constructor Details
-
RegistryDataMapSyncPayload
public RegistryDataMapSyncPayload(ResourceKey<? extends Registry<T>> registryKey, Map<ResourceLocation, Map<ResourceKey<T>, ?>> dataMaps) Creates an instance of aRegistryDataMapSyncPayload
record class.- Parameters:
registryKey
- the value for theregistryKey
record componentdataMaps
- the value for thedataMaps
record component
-
-
Method Details
-
decode
-
write
-
type
- Specified by:
type
in interfaceCustomPacketPayload
-
readJsonWithRegistryCodec
private static <T> T readJsonWithRegistryCodec(RegistryFriendlyByteBuf buf, com.mojang.serialization.Codec<T> codec) -
writeJsonWithRegistryCodec
private static <T> void writeJsonWithRegistryCodec(RegistryFriendlyByteBuf buf, com.mojang.serialization.Codec<T> codec, T value) -
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 theregistryKey
record component.- Returns:
- the value of the
registryKey
record component
-
dataMaps
Returns the value of thedataMaps
record component.- Returns:
- the value of the
dataMaps
record component
-