Interface IPropertyType<T>
- Type Parameters:
T- The type of the property value.
- All Known Implementing Classes:
PropertyType
public interface IPropertyType<T>
Interface defining methods for serializing and deserializing spell properties to and from JSON and NBT formats. This
is used as an interface just to give the possibility of having different and custom implementations of property types,
not just with primitive types but also for complex objects. (e.g. for handling multiple related values in a single property).
-
Method Summary
Modifier and TypeMethodDescriptiondeserialize(com.google.gson.JsonElement jsonElement, String location) Deserializes a spell property from a JSON element.deserialize(net.minecraft.nbt.CompoundTag tag, String location) Deserializes a spell property from a compound NBT tag.voidserialize(com.google.gson.JsonObject json, SpellProperty<T> property) Serializes a spell property to a JSON object.voidserialize(net.minecraft.nbt.CompoundTag tag, SpellProperty<T> property) Serializes a spell property to a compound NBT tag.
-
Method Details
-
deserialize
Deserializes a spell property from a JSON element.- Parameters:
jsonElement- The JSON element to deserialize from.location- The location or identifier for the property.- Returns:
- The deserialized spell property.
-
deserialize
Deserializes a spell property from a compound NBT tag.- Parameters:
tag- The NBT tag to deserialize from.location- The location or identifier for the property.- Returns:
- The deserialized spell property.
-
serialize
Serializes a spell property to a JSON object.- Parameters:
json- The JSON object to serialize to.property- The spell property to serialize.
-
serialize
Serializes a spell property to a compound NBT tag.- Parameters:
tag- The NBT tag to serialize to.property- The spell property to serialize.
-