Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-70754

testfor cannot test for ActiveEffects because Duration is ticking down

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • Minecraft 1.8
    • None
    • Windows 7 (x86) version 6.1
      Java 8.11, Oracle Corporation
    • Plausible

      I tried to give a score to players with a specific status effect as well as testing for players with a specific status effect.

      However, the commands I used don't ever find a player with the specified NBT Data. /testfor doesn't work as well.

      Further testing showed it is the same with mobs.

      The commands are:

      /scoreboard players set @a canSwim {ActiveEffects:[{Id:17}]}
      /testfor @a {ActiveEffects:[{Id:17}]}
      

      Commands for testing purposes:

      /scoreboard players set @a canSwim 1 {ActiveEffects:[{Id:17,Amplifier:0,Duration:595,Ambient:0,ShowParticles:1}]}
      /testfor @a {ActiveEffects:[{Id:17,Amplifier:0,Duration:595,Ambient:0,ShowParticles:1}]}
      

      EDIT
      Since, as Aaron Rhodes said, it might be confusing to see a score name of canSwim and the hunger effect in one command:

      I was trying to create a permanent world rule which only lets you swim or dive if you have the hunger effect on you. Otherwise it kills the player trying. It is a part of an ongoing series on YouTube.

      EDIT2
      Alright, I found a solution, I needed to use "17b" instead of "17". You need to specify the type of the tag. I am not sure if it is intended, however, it is not the bug I posted this issue about. Thank you!

      Commands:

      /scoreboard players set @a canSwim {ActiveEffects:[{Id:17b}]}
      /testfor @a {ActiveEffects:[{Id:17b}]}
      

            Unassigned Unassigned
            Loghaire Tomasz WIśniewski
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: