Package com.mojang.serialization.codecs
Class SimpleMapCodec<K,V>
- All Implemented Interfaces:
BaseMapCodec<K,
,V> Compressable
,Keyable
,MapDecoder<Map<K,
,V>> MapEncoder<Map<K,
V>>
- Mojang-Added Docs:
Key and value decoded independently, statically known set of keys
-
Nested Class Summary
Nested classes/interfaces inherited from class com.mojang.serialization.MapCodec
MapCodec.MapCodecCodec<A>, MapCodec.ResultFunction<A>
Nested classes/interfaces inherited from interface com.mojang.serialization.MapDecoder
MapDecoder.Implementation<A>
Nested classes/interfaces inherited from interface com.mojang.serialization.MapEncoder
MapEncoder.Implementation<A>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T> DataResult<Map<K,
V>> decode
(DynamicOps<T> ops, MapLike<T> input) <T> RecordBuilder<T>
encode
(Map<K, V> input, DynamicOps<T> ops, RecordBuilder<T> prefix) boolean
int
hashCode()
keyCodec()
<T> Stream<T>
keys
(DynamicOps<T> ops) Returns a stream of keys this map codec may write or read.toString()
Methods inherited from class com.mojang.serialization.MapCodec
codec, dependent, deprecated, fieldOf, flatXmap, forGetter, mapResult, of, of, orElse, orElse, orElse, orElseGet, orElseGet, orElseGet, setPartial, stable, unit, unit, withLifecycle, xmap
Methods inherited from class com.mojang.serialization.CompressorHolder
compressor
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.mojang.serialization.MapDecoder
ap, compressedDecode, compressor, decoder, flatMap, map
Methods inherited from interface com.mojang.serialization.MapEncoder
comap, compressedBuilder, compressor, encoder, flatComap
-
Constructor Details
-
SimpleMapCodec
-
-
Method Details
-
keyCodec
- Specified by:
keyCodec
in interfaceBaseMapCodec<K,
V>
-
elementCodec
- Specified by:
elementCodec
in interfaceBaseMapCodec<K,
V>
-
keys
Description copied from class:MapCodec
Returns a stream of keys this map codec may write or read. This stream should contain any key that may be written or read, even ones that are optional. The codec need not read or write all of these keys on any given occasion, but all keys that might be read or written should be included, as this stream is used to form the number-based indexing used withDynamicOps.compressMaps()
.Note: if a map codec writes a key that is not returned by this method, it will not work correctly with a
DynamicOps
that hasDynamicOps.compressMaps()
. -
decode
- Specified by:
decode
in interfaceBaseMapCodec<K,
V> - Specified by:
decode
in interfaceMapDecoder<K>
-
encode
- Specified by:
encode
in interfaceBaseMapCodec<K,
V> - Specified by:
encode
in interfaceMapEncoder<K>
-
equals
-
hashCode
public int hashCode() -
toString
-