Skip to content
Aram edited this page Sep 11, 2025 · 1 revision

CODECs for Cache Objects

Overview

Each cache object in Bluelib has a dedicated CODEC. This allows it to be serialized and deserialized efficiently, either to NBT, JSON, or other dynamic formats. The CODEC acts as a bridge between your in-memory objects and the persistent storage or network representation.

Using a CODEC ensures:

  • Consistency: Every cache can read and write itself in a standardized way.
  • Integration: Works seamlessly with Minecraft’s Dynamic and CompoundTag systems.
  • Extensibility: New caches can define their own CODEC without modifying the core logic.

Key Points

  • Every cache type has its own CODEC.
  • CODECs standardize serialization and deserialization.
  • Using Dynamic and NbtOps ensures compatibility with Minecraft’s data systems.
  • Reading/writing to NBT is handled inside the cache class itself, keeping code clean and maintainable.

Clone this wiki locally