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

Using /testfor with SelectedItem tag sometimes fails



    • Type: Bug
    • Status: Resolved
    • Resolution: Duplicate
    • Affects Version/s: Minecraft 1.11.2
    • Fix Version/s: None
    • Labels:
    • Environment:
      Mac OS X 10.11.6, Latest Java
    • Confirmation Status:


      I'm trying to make a system that allows players to two-hand certain weapons when they do not have an item in their off hand. That is, when the player's off hand is empty and they are holding a specific item in their main hand, that main hand item will be replaced with a different version. When the player has a two-handed item in their inventory but is not holding it, it is cleared and the player is given the one handed version. For the sake of efficiency (This is a small part of a very, very large system), I am using conditional repeating command blocks. This has resulted in a particularly interesting circumstance in which a command that testfors an item in the player's hand continually returns true, even when it is clearly false. i.e. the SelectedItem virtual tag was not updated (Or the client and server are out of sync). This is semi-consistent. It is obviously a bug, but I can't figure out what causes it. Also, if you select a different item slot or reload the world while in this invalid state, the item is duplicated, which also doesn't make sense.
      World download: dl.dropboxusercontent.com/s/5wgfqulb01c9ati/1_11%20Stuff.zip?dl=0
      Instructions to reproduce: Hold the diamond axe in your hand, in the first slot of your hotbar. Drag the diamond axe into your inventory (Where it will be removed and placed back into your hand) repeatedly until it stays where you put it. Check the output of the command block that testfors you holding a diamond axe, and you will see that it is true, even though you are holding nothing.


          Issue Links



              • Assignee:
                avantir_yihn Avantir_Yihn
              • Votes:
                0 Vote for this issue
                2 Start watching this issue


                • Created: