Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load Convertibles from datapack #1211

Merged
merged 14 commits into from
Sep 19, 2023
Merged

Load Convertibles from datapack #1211

merged 14 commits into from
Sep 19, 2023

Conversation

Cheaterpaul
Copy link
Member

@Cheaterpaul Cheaterpaul commented May 9, 2023

Convertibles can now be registered through datapacks. Registering convertibles over the api is still supported, but will always be overridden by datapack changes.

All json files in data/<modid>/vampirism/convertibles are loaded.The entity id is resolved by foldername:filename.

E.g the file data/<modid>/vampirism/convertibles/minecraft/fox.json defines the minecraft:fox entity as convertible.

{
  "handler": {
    "type": "vampirism:special",
    "converted_type": "vampirism:converted_fox"
  },
  "overlay": "vampirism:textures/entity/vanilla/fox_overlay.png"
}

The handler and overlay fields are optional. If no handler is specified it uses the vampirism:default handler. In case of no overlay, no overlay will be rendered.

Available converting handler are:

  • vampirism:default -> adds dummy entity that copies all entity data from the source entity
  • vampirism:special -> replaces entity with the given converted_type

By default some attributes are increased when converting an entity. These are knockback_resistance, max_health, attack_damage and movement_speed.

They can be manually configured

{
  "handler": {
    "type": "vampirism:special",
    "attribute_helper": [
      {
        "attribute": "minecraft:generic.knockback_resistance",
        "fallback_base": 0.0,
        "modifier": 1.3
      },
      {
        "attribute": "minecraft:generic.max_health",
        "modifier": 1.5
      },
      {
        "attribute": "minecraft:generic.attack_damage",
        "modifier": 1.3
      },
      {
        "attribute": "minecraft:generic.movement_speed",
        "modifier": 1.2
      }
    ],
    "converted_type": "vampirism:converted_fox"
  },
  "overlay": "vampirism:textures/entity/vanilla/fox_overlay.png"
}

@maxanier
Copy link
Member

I'm more in favor of "never change a running system", but this is nice to have, if it is properly tested and documented.

@Cheaterpaul Cheaterpaul added the enhancement Any minor tweak that can be introduced in minor releases label May 14, 2023
@Cheaterpaul Cheaterpaul marked this pull request as ready for review September 19, 2023 12:00
@Cheaterpaul Cheaterpaul merged commit 051cae4 into dev Sep 19, 2023
2 checks passed
@Cheaterpaul Cheaterpaul deleted the feature/convertible_datapack branch September 19, 2023 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Any minor tweak that can be introduced in minor releases
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants