team-abnormals / personality

Introduces sitting, crawling, and various 'gamefeel' enhancements
https://www.curseforge.com/minecraft/mc-mods/personality
Other
12 stars 12 forks source link

Register Personality config values with config condition #25

Closed flowerfugue closed 3 years ago

flowerfugue commented 3 years ago

This is a PR I've been meaning to do for ages, but I haven't got around to until now. A while ago a config condition system was added to Abnormals Core which lets recipes, advancement/loot modifiers, loot tables and whatever else use the value of a config entry as a json condition, like this:

"conditions": [
  {
    "type": "abnormals_core:config",
    "value": "potato_poison_chance",
    "predicates": [
      {
        "type": "abnormals_core:greater_than_or_equal_to",
        "value": 0.1,
        "inverted": true
      }
    ]
  }
],
//Loot pool/modifier/etc. here

To support this, mods need to register their config objects in the DataUtil#registerConfigCondition method and annotate all the ConfigValue fields with @ConfigKey which specifies the string key for that value in json. I've done that for this PR, and I'll change the specific strings used for the config values if anyone requests.