Skip to content
CleverNucleus edited this page Apr 17, 2022 · 4 revisions

First please see the Data Attributes wiki.

Reverting Melee Crit Behaviour to Vanilla

PlayerEx subtly changes Minecraft's melee crit to be chanced based, instead of on-jump. Furthermore, melee crit damage is also changed to be attribute based, instead of a flat x1.5. This behaviour can be reverted with a datapack - this section covers how to do this.

Step 1 - File-Folder Structure.

You need to create the following file-folder structure:

anything.zip
├ pack.mcmeta
└ data
    └ playerex
        └ attributes
            ├ entity_types.json
            ├ modifiers.json
            └ functions.json

Step 2 - pack.mcmeta.

Your pack.mcmeta file needs the following json code:

{
    "pack": {
        "pack_format": 8,
        "description": [
            {
                "text": "ExamplePack",
                "color":"gold"
            },
            {
                "text": "\nCleverNucleus/PlayerEx",
                "color":"yellow"
            }
        ]
    }
}

Step 3 - entity_types.json.

Your entity_types.json file needs the following json code:

{
    "values": {
        "minecraft:player": {
            "playerex:level": 0.0,
            "playerex:constitution": 0.0,
            "playerex:strength": 0.0,
            "playerex:dexterity": 0.0,
            "playerex:intelligence": 0.0,
            "playerex:luckiness": 0.0,
            "playerex:evasion": 0.0,
            "playerex:lifesteal": 0.0,
            "playerex:health_regeneration": 0.0,
            "playerex:heal_amplification": 0.0,
            "playerex:ranged_crit_damage": 0.0,
            "playerex:ranged_crit_chance": 0.0,
            "playerex:ranged_damage": 0.0,
            "playerex:fire_resistance": 0.0,
            "playerex:freeze_resistance": 0.0,
            "playerex:lightning_resistance": 0.0,
            "playerex:poison_resistance": 0.0,
            "playerex:wither_resistance": 0.0,
            "playerex:breaking_speed": 1.0
        }
    }
}

Step 4 - modifiers.json.

Your modifiers.json file needs the following json code:

{
    "values": {
        "minecraft:generic.max_health": "2bd543c8-b3e9-4a10-bac3-ef74bebe0c70",
        "minecraft:generic.knockback_resistance": "316b3dc5-33bb-49d8-a046-1551ae6d09c8",
        "minecraft:generic.movement_speed": "b36f3f15-898f-43d3-a3cc-db782fa1dc04",
        "minecraft:generic.attack_damage": "93cc9059-10a9-4770-830f-86c6835e0e72",
        "minecraft:generic.attack_speed": "53b32a08-4fac-4d9e-956f-65def94aa5f7",
        "minecraft:generic.armor": "a2c06963-1ca4-4d65-81ba-2ca18db1a509",
        "minecraft:generic.luck": "1c5eb054-0a6a-4e56-a1c9-63c679856598",
        "playerex:constitution": "27f1a648-150e-49fa-96cb-e73cf71d7bfc",
        "playerex:strength": "cd1b0adf-b662-42b3-a8c5-c422fac7ac98",
        "playerex:dexterity": "7792eee9-d3e7-4c3e-8517-e4d4f06da247",
        "playerex:intelligence": "d98d4414-d932-4f45-9880-e77597ee5276",
        "playerex:luckiness": "07aeea2f-03d6-4ad0-be6b-d2d8d57338f1",
        "playerex:level": "0f61af4e-4548-4c6f-8b1d-48e271973f15",
        "playerex:health_regeneration": "f1bbede2-63b3-47df-bf48-9c23e96a5f69",
        "playerex:heal_amplification": "844c2bbf-6f33-4b60-9735-527d0d8f1ee5",
        "playerex:evasion": "c491d167-a465-4f06-b902-d19aa1a4f0a8",
        "playerex:lifesteal": "a38b696b-93d8-44df-8373-df6441948407",
        "playerex:ranged_crit_chance": "73a28b70-337d-48d3-96f0-2cf17350856e",
        "playerex:ranged_crit_damage": "e9f76c83-25c2-4976-9566-b70839996565",
        "playerex:ranged_damage": "62c434c0-bb1d-472b-893d-70cb94b7f038",
        "playerex:fire_resistance": "a4d38846-0b46-4556-9c57-6df0e4a1d4d9",
        "playerex:freeze_resistance": "dce46b2e-456c-4df7-9332-9c59d951f77c",
        "playerex:lightning_resistance": "dc13a8ef-da77-41da-9b95-2739a371d4fa",
        "playerex:poison_resistance": "fbdd140f-e273-4beb-9314-b0bc36d1f444",
        "playerex:wither_resistance": "e16ee641-33be-4bfb-9351-f518bd0fe3c9",
        "playerex:breaking_speed": "0a4eb3ad-6e75-48cd-b067-e951394ad0f8"
    }
}

Step 5 - functions.json.

Your functions.json file needs the following json code:

{
    "values": {
        "playerex:constitution": {
            "minecraft:generic.max_health": 1.0,
            "minecraft:generic.knockback_resistance": 0.01,
            "playerex:poison_resistance": 0.01
        },
        "playerex:strength": {
            "minecraft:generic.attack_damage": 0.25,
            "minecraft:generic.armor": 0.5,
            "playerex:health_regeneration": 0.01
        },
        "playerex:dexterity": {
            "minecraft:generic.attack_speed": 0.1,
            "playerex:ranged_damage": 0.25,
            "playerex:lightning_resistance": 0.01
        },
        "playerex:intelligence": {
            "playerex:heal_amplification": 0.02,
            "playerex:ranged_crit_damage": 0.005,
            "playerex:wither_resistance": 0.01
        },
        "playerex:luckiness": {
            "minecraft:generic.luck": 0.1,
            "playerex:evasion": 0.02,
            "playerex:ranged_crit_chance": 0.02
        }
    }
}

Steps 3, 4 and 5 have the same files as the default PlayerEx, but have removed the attributes playerex:melee_crit_chance and playerex:melee_crit_damage. If you wish to only revert melee crit chance but not the damage, you can leave the latter in.

Step 6 - Using the datapack

Now all you need to do is use the datapack when creating the world. Note that if creating a multiplayer world, you should start the server and generate the world, making sure no one joins, and then close the server and put the datapack in the relevant world folder before restarting the server and allowing players to join. Alternatively you could use a global datapack mod or similar.

This datapack does not remove the melee critical chance/damage attributes from the game, it just removes them from the player (which is the only entity that these attributes apply to anyway). By removing these attributes from the player, the player automatically reverts to vanilla crit behaviour. Note that melee crit chance and melee crit damage are independent of each other, and can function by themselves - i.e. you could have vanilla crit behaviour (on-jump) but the damage is PlayerEx based; or you could have chance based PlayerEx crit chance but the damage is vanilla (x1.5).

Setting your starting health

By default, PlayerEx does not modify your starting health. However, it can if you want it to. For this example, we are changing the starting health from the default 20 (10 Hearts) to 6 (3 Hearts).

Step 1 - File-Folder Structure.

You need to create the following file-folder structure:

anything.zip
├ pack.mcmeta
└ data
    ├ anything
    |   └ attributes
    |       └ entity_types.json
    └ minecraft
        └ attributes
            └ overrides
                └ generic.max_health.json

Where anything can be named as you like - but it must not be playerex or minecraft.

Step 2 - pack.mcmeta.

Your pack.mcmeta file needs the following json code:

{
    "pack": {
        "pack_format": 8,
        "description": [
            {
                "text": "ExamplePack",
                "color":"gold"
            },
            {
                "text": "\nCleverNucleus/PlayerEx",
                "color":"yellow"
            }
        ]
    }
}

Step 3 - entity_types.json.

Your entity_types.json file needs the following json code:

{
    "values": {
        "minecraft:player": {
            "minecraft:generic.max_health": 6.0
        }
    }
}

Step 4 - generic.max_health.json.

Your generic.max_health.json file needs the following json code:

{
    "fallbackValue": 6.0,
    "minValue": 1.0,
    "maxValue": 2147483647.0,
    "translationKey": "attribute.name.generic.max_health",
    "stackingBehaviour": "FLAT"
}

Step 5 - Using the datapack

Now all you need to do is use the datapack when creating the world. Note that if creating a multiplayer world, you should start the server and generate the world, making sure no one joins, and then close the server and put the datapack in the relevant world folder before restarting the server and allowing players to join. Alternatively you could use a global datapack mod or similar.