minecraft-access / minecraft-access

A mod for minecraft java (fabric/neoforge) that adds accessibility feature
GNU General Public License v3.0
51 stars 12 forks source link

Custom POI groups: all, ore, interactive blocks, entities. Let player switch between groups. #267

Open boholder opened 9 months ago

boholder commented 9 months ago

By introducing configurable POI Groups, players can choose what to scan and lock more accurately, creating suitable groups for different playing scenarios. This feature will replace currently hard-coded POI targets.

I hope I can get enough time to finish this and move on to

then modding new features in version 1.21, which will be released at July I think. Busy work has drained me recently :(

Key Bindings

I think reuse the keybindings of Slot Group will lower the user learning curve:

Single Key Default Keybinding Description
Group Key C Select next Sub Group in current Main Group
Key Combination Description
Left Shift + Group Key Select previous Sub Group in current Main Group
Tab + Group Key Loop selecting the next Main Group

Data Structure

POI Groups are composed as a two-layer structure, two layers are referred to "Main Groups" and "Sub Groups", I choose two layers because a flat structure becomes inconvenient as the number of groups increases, introducing a sub layer can solve this problem, giving players more flexibility. Each Main Group has an invisible "All" Sub Group as the first Sub Group, which contains all targets of Sub Groups under this Main Group.

From the point of view of the source, there are two types of POI Groups : pre-defined groups and custom groups, both of them can be defined as a Main Group or Sub Group.

Pre-defined groups are programmatically defined by developers as the form of code. As they are programmatically defined, their names can be pre-translated, and we can change the logic of POI Scan/Locking to suit the needs of specific scenes. Each pre-defined group has a unique meaningful "id", players can add them in the configuration by referencing the ids. We as developers can listen to user feedback and add more pre-defined groups in the future. Only a few pre-defined groups are included in default configuration.

Custom groups are user-defined groups, each custom group must be defined with a unique "name" in contrast with the pre-defined groups, the "name" value will be narrated by the mod as the group name, players can reuse defined Sub Groups under many Main Groups by only referencing the "name" value without duplicate other configurations. For each custom group, players must define what they want to scan as a list called "targets" in the Minecraft resource location format in the json configuration file.

Json Configuration Format

The json format of POI Group configuration will be like:

{
  "Points of Interest": {
    "...": "...",
    "Groups": {
      "Other": " POI Group Configs",
      "Main Groups": [
        {
          "id": "pre_defined_main_group",
          "groups": [
            {
              "name": "add more pre-defined or custom sub group under 'groups' field"
            }
          ]
        },
        {
          "name": "Custom Main Group",
          "groups": [
            {
              "id": "pre_defined_sub_group"
            },
            {
              "name": "Custom Sub Group: Pets",
              "targets": [
                "cat",
                "wolf",
                "parrot"
              ]
            }
          ]
        }
      ]
    }
  }
}

Pre-defined Groups

Included in default configuration:

ID Type Description
blocks Main Ore blocks and functional blocks you can interact with, contains functional, workstation, ore, log.
functional Sub Interactive blocks without a screen, e.g. Door, Bell, Bee Hive.
workstation Sub Interactive blocks with a screen, e.g. Crafting Table, Chest, Furnace.
ore Sub Ore blocks.
log Sub Switch to this group if you want to find trees. Trees in the Minecraft are typically a pile of Log blocks decorated with Leaves Blocks on the top.
entities Main Monsters, animals, vehicles, players, contains creature, monster, vehicle, player.
creature Sub Passive creatures that won't attack you and neutral creatures that won't attack you first until you provoke them, note that Enderman and Piglin are included in this group.
monster Sub Hostile creatures that actively attack you. Note that some monsters are classified as neutral creatures but we'll put them in this group instead since they'll be attacking the player at most of the time, including Spider, Cave Spider and Drowned.
vehicle Sub Boat and mine cart.
player Sub Other players.
boss Sub Ender Dragon and Wither
blocks_and_entities Main This group contains targets in blocks and entities.

Not included in default configuration:

ID Type Description
explore Main contains ore,log,vehicle,creature,monster,player,functional

Default Configuration

  1. blocks: functional, workstation, ore, log
  2. entities: creature, monster, vehicle, player, boss
  3. blocks_and_entities: blocks, entities

Note to myself:

boholder commented 8 months ago

Create a built in main group that has no ALL option, then put boss, log sort of thing under this group.