Players can't remove items from invulnerable item frames
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
- Place a item frame.
- Insert a item into that item frame.
- Change the invulnerable field to be true:
/data modify entity <item_frame> Invulnerable set value 1b
- 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; ... }