PlayerEx

PlayerEx

5M Downloads

Overriding default starting critical damage prevents them from increasing when leveling

jujoka opened this issue ยท 2 comments

commented

Overriding default critical damage values with a datapack will cause the critical damage attributes to not increase normally when leveling up their respective skills. They only start increasing like they should when the new default critical damage would be reached with points put in them.

The default critical damage was overrided with this (datapack) for 130% default critical damage:

{
    "defaultValue": 0.3,
    "minValue": 0.3,
    "maxValue": 10.0,
    "translationKey": "playerex.attribute.name.melee_crit_damage"
}

In the 130% example it would take 7 points in dexterity to increase it to 132.8%, having no effect before that point.

commented

Hi there,
I've verified the issue, and am working towards a fix. Although, I suspect this is actually a problem with Data Attributes.

In the mean time, you can instead use entity_types.json in your datapack to set the player's default value for melee crit damage. Just make sure to include the rest of the attributes in your entity_types.json file (another bug just found; you should be able to just have the single attribute entry).
Thanks.

Edit: Scorethrough'd that last bit; it's not a bug, I was just using the default playerex namespace in the datapack. Make sure to use your own namespace (can be anything) in your datapack; for context: namespace.

commented

Turns out this actually wasn't a bug, but rather a design oversight. Also, this was an issue with Data Attributes, not PlayerEx, but I've left this here because it's all solved now.

There are three ways an attribute's values are set initially:

  • setting the default value in <namespace>/attributes/overrides/melee_crit_damage.json;
  • setting the minimum value in <namespace>/attributes/overrides/melee_crit_damage.json;
  • setting the starting value when the attribute is attached to an entity's attribute container in <namespace>/attributes/entity_types.json.

Most of the time, these are in agreement (i.e. the default value is not less then the minimum value etc.). This strange behaviour was caused because you were setting the minimum and default values to 0.3, while in entity_types.json the attribute was being attached to the player with an initial value of 0.0 - i.e. below its minimum value; hence the values disagreed.

What you needed to do was add <namespace>/attributes/entity_types.json, containing the following:

{
    "values": {
        "minecraft:player": {
            "playerex:melee_crit_damage": 0.3
        }
    }
}

Where <namespace> would be replaced by anything that wasn't playerex or minecraft.

This issue had such strange symptoms that it took me a while to figure out what was actually going on. None of this is your fault of course, it's my responsibility to have safeguards against this kind of thing. So I've released an update that means no matter what the value is set to in entity_types.json, it will default to the attribute's minimum value if it is below.

Thanks for bringing this to my attention, it should all be resolved now.