Interface LegacyHoverEventSerializer
- All Known Subinterfaces:
NBTLegacyHoverEventSerializer
public interface LegacyHoverEventSerializer
Adapter to convert between modern and legacy hover event formats.
- Since:
- 4.14.0
-
Method Summary
Modifier and TypeMethodDescriptiondeserializeShowEntity(Component input, Codec.Decoder<Component, String, ? extends RuntimeException> componentDecoder) Convert a legacy hover eventshow_entityvalue to its modern format.deserializeShowItem(Component input) Convert a legacy hover eventshow_itemvalue to its modern format.serializeShowEntity(HoverEvent.ShowEntity input, Codec.Encoder<Component, String, ? extends RuntimeException> componentEncoder) Convert a modern hover eventshow_entityvalue to its legacy format.Convert a modern hover eventshow_itemvalue to its legacy format.
-
Method Details
-
deserializeShowItem
Convert a legacy hover eventshow_itemvalue to its modern format.- Parameters:
input- component whose plain-text value is a SNBT string- Returns:
- the deserialized event
- Throws:
IOException- if the input is improperly formatted- Since:
- 4.14.0
-
serializeShowItem
Convert a modern hover eventshow_itemvalue to its legacy format.- Parameters:
input- modern hover event- Returns:
- component with the legacy value as a SNBT string
- Throws:
IOException- if the input is improperly formatted- Since:
- 4.14.0
-
deserializeShowEntity
HoverEvent.ShowEntity deserializeShowEntity(Component input, Codec.Decoder<Component, String, ? extends RuntimeException> componentDecoder) throws IOException Convert a legacy hover eventshow_entityvalue to its modern format.- Parameters:
input- component whose plain-text value is a SNBT stringcomponentDecoder- A decoder that can take a JSON string and return a deserialized component- Returns:
- the deserialized event
- Throws:
IOException- if the input is improperly formatted- Since:
- 4.14.0
-
serializeShowEntity
Component serializeShowEntity(HoverEvent.ShowEntity input, Codec.Encoder<Component, String, ? extends RuntimeException> componentEncoder) throws IOException Convert a modern hover eventshow_entityvalue to its legacy format.- Parameters:
input- modern hover eventcomponentEncoder- An encoder that can take aComponentand return a JSON string- Returns:
- component with the legacy value as a SNBT string
- Throws:
IOException- if the input is improperly formatted- Since:
- 4.14.0
-