FTB Quests

repository·main·Indexed 41 days ago

https://github.com/ftbteam/ftb-quests

A Minecraft mod for modpack creators to implement complex questing systems. Includes a comprehensive CLI for managing quest progression, reward tables, editing modes, and automated chapter generation via commands such as /change_progress, /generate_chapter, and /block_rewards.

Tokens
4.5K
Snippets
18
Records
20
Agent score
52%

What's inside FTB Quests

  1. Identify quest objects by ID or Tag

    main

    When using FTB Quests commands that require a quest or object identifier, you can specify the target in two ways:

    1. By Tag: Prefix the tag name with a # (e.g., #my_tag). The system will search for the first quest object that contains this tag.
    2. By Hex ID: Provide the raw hexadecimal ID of the object. The system parses this hex string to locate the specific QuestObjectBase.

    Errors:

    • If a tag is provided but no object matches, you will receive a no_object error.
    • If a hex ID is provided but is not a valid hex format or does not exist, you will receive an invalid_id or no_object error.
    # Example usage patterns (conceptual):
    /ftbquests <command> #my_tag
    /ftbquests <command> 1a2b3c4d
  2. Implement the RecipeModHelper interface for recipe integration

    main

    The RecipeModHelper interface is used to integrate recipe-based quest requirements and features (like loot crates) into FTB Quests. Developers implementing this interface can provide support for showing recipes, refreshing quest objects, and managing bookmarks for specific items or fluids.

    Key methods include:

    • getHelperName(): Returns a string identifier for the helper.
    • isRecipeModAvailable(): Indicates if the specific integration is active.
    • showRecipes(ItemStack object) / showRecipes(FluidStack fluid): Logic to display recipes for a specific item or fluid.
    • toggleBookmark(ItemStack stack): Logic to add/remove an item from a bookmark list, returning a Tristate.
    • updateItemsDynamic(Collection<ItemStack> toRemove, Collection<ItemStack> toAdd): Supports dynamic updates to loot crates at runtime.

    Use the NONE constant (an instance of NoOp) if no integration is required.

    public interface RecipeModHelper {
        // Implementation methods
        String getHelperName();
        boolean isRecipeModAvailable();
        void showRecipes(ItemStack object);
        void showRecipes(FluidStack fluid);
        Tristate toggleBookmark(ItemStack stack);
        void updateItemsDynamic(Collection<ItemStack> toRemove, Collection<ItemStack> toAdd);
    }
  3. Change quest progress via CLI

    main

    When using FTB Quests commands, you can specify a progress type using the change_progress argument. This argument accepts a string representing the specific type of progress change you wish to apply. The available types are determined by the ChangeProgress.NAME_MAP keys. If an invalid type is provided, the command will return an error using the translation key commands.ftbquests.change_progress.invalid_type.

    # Note: The exact command structure depends on the parent command calling this argument.
    # The argument itself expects one of the keys from ChangeProgress.NAME_MAP.
    <command> <change_progress_type>
  4. Toggle edit mode with the /editing_mode command

    main

    The /editing_mode command allows players with the appropriate editor permissions to toggle their edit mode status. When edit mode is enabled, players can modify quests within the FTB Quests interface.

    Usage Patterns:

    1. Toggle for yourself: Running the command without arguments toggles your current edit mode state.
    2. Set specific state for yourself: Use the enabled argument to explicitly turn edit mode on (true) or off (false).
    3. Target another player: You can specify a target player and an enabled state to manage edit mode for others (requires appropriate permissions).

    Permissions: This command requires the permission defined by PermissionsHelper::hasEditorPermission.

    # Toggle edit mode for the current player
    /editing_mode
    
    # Explicitly enable edit mode for yourself
    /editing_mode true
    
    # Explicitly disable edit mode for yourself
    /editing_mode false
    
    # Enable edit mode for a specific player
    /editing_mode true <player>
  5. Delete empty reward tables with /delete_empty_reward_tables

    main

    Use the /delete_empty_reward_tables command to scan the current server quest file and remove any reward tables that do not contain any rewards. This is useful for cleaning up quest files and removing unused data.

    Permissions: This command requires editor permissions (checked via PermissionsHelper::hasEditorPermission).

    /delete_empty_reward_tables
  6. Use FTB Quests CLI commands

    main

    FTB Quests provides a suite of commands accessible via the base command /ftbquests (using the FTBQuestsAPI.MOD_ID). These commands allow administrators and developers to manage quest progression, edit modes, reward tables, and chapter generation.

    Available command sub-trees include:

    • edit_mode: Manage editing capabilities.
    • locked: Manage locked quests/chapters.
    • delete_empty_reward_tables: Cleanup unused reward tables.
    • change_progress: Manually adjust player or quest progress.
    • export_reward_table: Export reward tables to files.
    • import_reward_table: Import reward tables from files.
    • generate_chapter: Automate chapter creation.
    • reload: Reload quest files/data.
    • block_rewards: Disable specific rewards.
    • open_book: Open the quest book interface.
    • clear_item_display_cache: Clear cached item displays.
    • pause_progression: Temporarily halt quest progression.
  7. Use the change_progress command to manage quest completion

    main

    The /change_progress command allows administrators with editor permissions to manually modify the progress of players for specific quests or all quests. You can use it to either complete a quest for a player or reset their progress.

    Usage Syntax

    To complete a specific quest: change_progress <players> complete <quest_object>

    To complete all quests for players: change_progress <players> complete-all

    To reset a specific quest: change_progress <players> reset <quest_object>

    To reset all quests for players: change_progress <players> reset-all

    Arguments

    • <players>: A standard Minecraft entity selector (e.g., @a, @p, or a specific username).
    • <quest_object>: The string identifier for the quest or quest object you wish to target.

    Permissions

    This command requires editor permissions (PermissionsHelper::hasEditorPermission).

    # Example: Complete quest 'my_quest_id' for all players
    /change_progress @a complete my_quest_id
    
    # Example: Reset all quests for a specific player
    /change_progress PlayerName reset-all