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

Players can't remove items from invulnerable item frames

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.20.2, 23w45a, 1.20.4 Release Candidate 1, 1.21.1
    • Confirmed
    • Commands, Entities
    • Low
    • Platform

      The Bug

      Although players remove items via left-clicking, it shouldn't be thought as damaging the item frames and cancel it.

      How to Reproduce

      1. Place a item frame.
      2. Insert a item into that item frame.
      3. Change the invulnerable field to be true:
        /data modify entity <item_frame> Invulnerable set value 1b
        
      4. Try to remove the item.

       

      It doesn't affect insertion and rotation.

      Code Analysis

      This was due to the lack of further detection (decompiled 1.20.2 using vanilla mapping):

      net.minecraft.world.entity.decoration.ItemFrame.class
      public boolean hurt(DamageSource $$0, float $$1) {
          ...
          if (isInvulnerableTo($$0)) return false; 
          ...
      }
      

            Unassigned Unassigned
            ccJerrycc ccJerrycc
            Votes:
            3 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              CHK: