Class SerializerEnum<T extends Enum<T>>
java.lang.Object
net.darkhax.bookshelf.api.serialization.SerializerEnum<T>
- All Implemented Interfaces:
ISerializer<T>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSerializerEnum(Class<T> enumClass) SerializerEnum(Class<T> enumClass, T defaultValue) -
Method Summary
Modifier and TypeMethodDescriptionfromByteBuf(net.minecraft.network.FriendlyByteBuf buffer) Reads a value from a byte buffer.fromJSON(com.google.gson.JsonElement json) Reads the value from a specific JSON element.fromNBT(net.minecraft.nbt.Tag nbt) Reads a value from a named binary tag (NBT).voidWrites a value to a byte buffer.com.google.gson.JsonElementWrites a value to a JSON element.net.minecraft.nbt.TagWrites a value to a named binary tag (NBT).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.darkhax.bookshelf.api.serialization.ISerializer
fromByteBufList, fromByteBufNullable, fromByteBufOptional, fromByteBufWeighted, fromByteBufWeightedList, fromJSON, fromJSON, fromJSON, fromJSONList, fromJSONList, fromJSONList, fromJSONList, fromJSONNullable, fromJSONNullable, fromJSONOptional, fromJSONOptional, fromJSONSet, fromJSONSet, fromJSONSet, fromJSONSet, fromJSONString, fromJSONWeighted, fromJSONWeightedList, fromNBT, fromNBT, fromNBTList, fromNBTList, readByteBufSet, toByteBufList, toByteBufNullable, toByteBufOptional, toByteBufWeighted, toByteBufWeightedList, toJSON, toJSONList, toJSONList, toJSONNullable, toJSONNullable, toJSONOptional, toJSONOptional, toJSONOptional, toJSONSet, toJSONString, toJSONWeighted, toJSONWeightedList, toNBT, toNBTList, toNBTList, writeByteBufSet
-
Field Details
-
defaultValue
-
-
Constructor Details
-
SerializerEnum
-
SerializerEnum
-
-
Method Details
-
fromJSON
Description copied from interface:ISerializerReads the value from a specific JSON element.- Specified by:
fromJSONin interfaceISerializer<T extends Enum<T>>- Parameters:
json- The JSON element to read data from.- Returns:
- The value that was read.
-
toJSON
Description copied from interface:ISerializerWrites a value to a JSON element.- Specified by:
toJSONin interfaceISerializer<T extends Enum<T>>- Parameters:
toWrite- The object to serialize into JSON data.- Returns:
- The serialized JSON element.
-
fromByteBuf
Description copied from interface:ISerializerReads a value from a byte buffer. This is commonly used for networking.- Specified by:
fromByteBufin interfaceISerializer<T extends Enum<T>>- Parameters:
buffer- The byte buffer to read from.- Returns:
- The value that was read.
-
toByteBuf
Description copied from interface:ISerializerWrites a value to a byte buffer. This is commonly used for networking.- Specified by:
toByteBufin interfaceISerializer<T extends Enum<T>>- Parameters:
buffer- The byte buffer to write to.toWrite- The value to write.
-
toNBT
Description copied from interface:ISerializerWrites a value to a named binary tag (NBT).- Specified by:
toNBTin interfaceISerializer<T extends Enum<T>>- Parameters:
toWrite- The value to write.- Returns:
- The serialized NBT data.
-
fromNBT
Description copied from interface:ISerializerReads a value from a named binary tag (NBT).- Specified by:
fromNBTin interfaceISerializer<T extends Enum<T>>- Parameters:
nbt- The tag to read data from.- Returns:
- The value that was read from the data.
-