Interface PocketUpgradeSerialiser<T extends IPocketUpgrade>

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

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

This follows the same format as TurtleUpgradeSerialiser - consult the documentation there for more information.

See Also:
  • Method Details

    • registryId

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

      static <T extends IPocketUpgrade> PocketUpgradeSerialiser<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 IPocketUpgrade> PocketUpgradeSerialiser<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: