Serializer

Serializer

Abstract base class for piece serializers.

For each piece type there is a serializer that can convert the piece back and forth to a key, and that also provides metadata about the type for the map editor. Mirrors the Java Serializer interface exactly.

create() and tag() are implemented by every registered serializer with no exceptions, so they're enforced at compile time. store()/example()/template() default to throwing since not every serializer needs to implement all three directly (see TypeOnlySerializer).

Constructor

new Serializer()

Source:

Methods

example()

Description:
  • Return a representative instance of this type for display in the map editor.

Source:

store()

Description:
  • Return the canonical serialized key for this piece, e.g. "Door|Blue|off". The key must be parseable back via create().

Source:

template()

Description:
  • Given the typeId, return a human-readable template showing the key format, e.g. "Door|{color}|{state}". Used by the editor to guide authoring.

Source: