Class FoliosObjective

java.lang.Object
net.ixdarklord.folios.api.client.FoliosObjective

public final class FoliosObjective extends Object
A condition the player makes progress on: an objective of a quest page, shown with a bar, and what a lock ("requires", FoliosLock) waits for. In JSON it is an object naming what it follows, with an optional "label" (text with marks, or a translation key) in place of the one it makes for itself:
  • {"advancement": "minecraft:story/mine_stone"}: done once the advancement is;
  • {"read": "basics/first_steps"}: an entry of the book read;
  • {"read_category": "basics"}: how much of a category has been read;
  • {"read_book": true}: how much of the whole book has been read;
  • {"quest": "basics/first_quest"}: a quest of the book (an entry with quest pages) done; or, written with its namespace ("mymod:first_quest"), one of the server's (data packs' folios/quests);
  • {"flag": "mymod:met_the_wizard"}: a flag set in code (FoliosGuides.setFlag(String, BooleanSupplier); a leading ! reverses it);
  • {"carried": "minecraft:diamond", "goal": 5}: items carried now (an item, a #tag or a list);
  • {"obtained": "minecraft:diamond"}: done once any of these items has been in the inventory, whatever became of it after;
  • {"source": "mymod:mana", "goal": 100}: a value a mod reports (FoliosObjectives.register(Identifier, FoliosObjectives.Source)), done when it reaches the goal;
  • {"any": [{...}, {...}]}: done once any one of these is.
"hidden": true shows it as ??? until it is done.
  • Field Details

    • CODEC

      public static final com.mojang.serialization.Codec<FoliosObjective> CODEC
  • Method Details

    • read

      public static FoliosObjective read(com.google.gson.JsonObject json)
      A condition as JSON writes it.
    • readAll

      public static List<FoliosObjective> readAll(com.google.gson.JsonElement json)
      One condition, or a list of them all of which must hold.
    • inOrder

      public static List<FoliosObjective> inOrder(List<FoliosObjective> objectives)
      These objectives, each counting only once all before it are done (a quest's "in_order").
    • progress

      public float progress(FoliosBook book)
      How far along it is, 0 to 1.
    • isDone

      public boolean isDone(FoliosBook book)
    • isWaiting

      public boolean isWaiting(FoliosBook book)
      Whether it waits on others before it counts (an objective of an "in_order" quest after one not done).
    • isAllOrNothing

      public boolean isAllOrNothing()
      Whether it is done or not done, with nothing between: no bar of its own is shown for it.
    • label

      public net.minecraft.network.chat.Component label(FoliosBook book)
      What it says, with how far along it is where that is a count; ??? while it is hidden and not done.
    • items

      public @Nullable FoliosStack items()
      The items it counts, for an icon; null for objectives that aren't about items.
    • obtained

      public List<FoliosStack> obtained()
      The items "obtained" conditions ask for, this one's and any it holds ("any").
    • progress

      public static float progress(FoliosBook book, List<FoliosObjective> objectives)
      How far along several objectives are together: the average of each.
    • json

      public com.google.gson.JsonObject json()
      The JSON it was read from, for writing it back.