Skip to content

Add autoGap module.#261

Open
duccss wants to merge 3 commits intorfresh2:1.21.4from
duccss:autoGap
Open

Add autoGap module.#261
duccss wants to merge 3 commits intorfresh2:1.21.4from
duccss:autoGap

Conversation

@duccss
Copy link

@duccss duccss commented Feb 23, 2026

Adds an autoGap module.

  • Will eat gaps below a set threshold (enchanted preferred)
  • "onFire" option to eat an egap to prevent burning
  • Slightly higher module prio than autoEat

@duccss
Copy link
Author

duccss commented Feb 23, 2026

Might add options to keep each potion effect active in the future (could be useful when spawn patrolling).

@rfresh2
Copy link
Owner

rfresh2 commented Feb 23, 2026

i'm not sure if this needs to be a separate module from autoeat

but i also want to avoid autoeat having too many settings and becoming hard to use and reason about

i can also imagine there being other situation-specific eat logic someone could want. not possible to cover all possible logic without user code, but maybe a configurable rules based system could cover some.

i'll think about it

@duccss
Copy link
Author

duccss commented Feb 24, 2026

I did consider adding to autoEat but decided against it. I do need some logic to eat an egap when on fire for my highway flyer plugin, this is from that. Just thought some other people might also benefit from that when not using plugins.

@rfresh2
Copy link
Owner

rfresh2 commented Feb 26, 2026

rules based solution sketch (as config.json):

{
  "autoEat": {
    "enabled": true,
    "warning": true,
    "warningMention": false,
    "rules": [
      {
        "id": "fire_emergency_gap",
        "enabled": true,
        "when": [
          {
            "state": "is_on_fire",
            "op": "eq",
            "value": true
          },
          {
            "state": "has_effect",
            "effect": "fire_resistance",
            "op": "eq",
            "value": false
          }
        ],
        "prefer": {
          "foods": [
            "enchanted_golden_apple"
          ],
          "strategy": "first_available"
        }
      },
      {
        "id": "very_low_health",
        "enabled": true,
        "when": [
          {
            "state": "health",
            "op": "lte",
            "value": 6
          }
        ],
        "prefer": {
          "strategy": "max_food_points"
        }
      },
      {
        "id": "low_health",
        "enabled": true,
        "when": [
          {
            "state": "health",
            "op": "lte",
            "value": 10
          }
        ],
        "prefer": {
          "strategy": "first_available"
        }
      },
      {
        "id": "omen",
        "enabled": true,
        "when": [
          {
            "state": "has_effect",
            "effect": "bad_omen",
            "op": "eq",
            "value": false
          }
        ],
        "prefer": {
          "foods": [
            "ominous_bottle"
          ],
          "strategy": "first_available"
        }
      }
    ]
  }
}

might be too hard for users to configure tho

@duccss
Copy link
Author

duccss commented Feb 26, 2026

Looks good! Will definitely be confusing for some players but you cant hand hold everyone and nothings perfect. Most players will never touch it.
As long as there's a is_on_fire state I'm happy :)
Tbh the only rule I can imagine that isn't covered by this pr is using chorus fruit on fire instead of egap so def go with your implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants