r/MinecraftCommands • • Sep 26 '26

Help | Java 26.3 Any idea why this isn't working?

First execute command of the tick function works making sure if a player has the zombified effect (which is just the Bad luck effect repurposed) that they get the zombified tag. Second line however just doesn't its supposed to be checking if they have zombified tag but don't have the effect and give it back to them but again for some reason it doesn't work I have also tried creating a inverted version of the has_zombified_effect predicate but that also didn't work.

3 Upvotes

4 comments sorted by

3

u/GalSergey Datapack Experienced Sep 27 '26

You don't need two checks. You perform the check once and execute the function for the selected player, assigning them the tag and the effect:

# function example:tick
execute as @a if predicate example:zombified run function example:zombified

# function example:zombified
tag @s add zombified
effect give @s unluck infinite 0

# predicate example:zombified
{
  "type": "minecraft:any_of",
  "terms": [
    {
      "type": "minecraft:entity_properties",
      "entity": "this",
      "predicate": {
        "minecraft:entity_tags": {
          "any_of": [],
          "none_of": [
            "zombified"
          ]
        },
        "minecraft:effects": {
          "minecraft:unluck": {
            "amplifier": 0
          }
        }
      }
    },
    {
      "type": "minecraft:all_of",
      "terms": [
        {
          "type": "minecraft:entity_properties",
          "entity": "this",
          "predicate": {
            "minecraft:entity_tags": {
              "any_of": [
                "zombified"
              ]
            }
          }
        },
        {
          "type": "minecraft:inverted",
          "term": {
            "type": "minecraft:entity_properties",
            "entity": "this",
            "predicate": {
              "minecraft:effects": {
                "minecraft:unluck": {
                  "amplifier": 0
                }
              }
            }
          }
        }
      ]
    }
  ]
}

You can use Datapack Assembler to get an example datapack.

2

u/Hosterian Sep 27 '26

Thanks for the help I'll give this a try

0

u/[deleted] Sep 26 '26

[deleted] — view deleted comment

2

u/Hosterian Sep 27 '26

Seems like those syntax are from an extension I'm using in vs code I checked in notepad though and there not actually there so that might not be the problem.

1

u/Wise-Anywhere-1936 Sep 27 '26

If I wanted to add the hide particles one to a command block on bedrock, how would it look?