Interface TurtleUpgradeSerialiser<T extends ITurtleUpgrade>

Type Parameters:
T - The type of turtle upgrade this is responsible for serialising.
All Superinterfaces:
UpgradeSerialiser<T>

public interface TurtleUpgradeSerialiser<T extends ITurtleUpgrade> extends UpgradeSerialiser<T>
Reads a ITurtleUpgrade from disk and reads/writes it to a network packet.

These should be registered in a Registry while the game is loading, much like RecipeSerializers.

If your turtle upgrade doesn't have any associated configurable parameters (like most upgrades), you can use simple(Function) or simpleWithCustomItem(BiFunction) to create a basic upgrade serialiser.

See Also:
  • Method Details

    • registryId

      static net.minecraft.resources.ResourceKey<net.minecraft.core.Registry<TurtleUpgradeSerialiser<?>>> registryId()
      The ID for the associated registry.
      Returns:
      The registry key.
    • simple

      static <T extends ITurtleUpgrade> TurtleUpgradeSerialiser<T> simple(Function<net.minecraft.resources.ResourceLocation,T> factory)
      Create an upgrade serialiser for a simple upgrade. This is similar to a SimpleCraftingRecipeSerializer, but for upgrades.

      If you might want to vary the item, it's suggested you use simpleWithCustomItem(BiFunction) instead.

      Type Parameters:
      T - The type of the generated upgrade.
      Parameters:
      factory - Generate a new upgrade with a specific ID.
      Returns:
      The serialiser for this upgrade
    • simpleWithCustomItem

      static <T extends ITurtleUpgrade> TurtleUpgradeSerialiser<T> simpleWithCustomItem(BiFunction<net.minecraft.resources.ResourceLocation,net.minecraft.world.item.ItemStack,T> factory)
      Create an upgrade serialiser for a simple upgrade whose crafting item can be specified.
      Type Parameters:
      T - The type of the generated upgrade.
      Parameters:
      factory - Generate a new upgrade with a specific ID and crafting item. The returned upgrade's UpgradeBase.getCraftingItem() MUST equal the provided item.
      Returns:
      The serialiser for this upgrade.
      See Also: