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

Item frame won't empty the item when game rule doEntityDrops set to false

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • None
    • 1.16.1, 1.16.2 Pre-release 1
    • None
    • Java 1.8.0_202, Windows 10, CPU: i7-8700K, GPU: Geforce GTX 1660, RAM: 16GB
    • Unconfirmed
    • (Unassigned)

      How to trigger this bug:

      1. Set game rule doEntityDrops to false
      2. Place an item frame and place an item in the frame
      3. Click the frame using the "Attack/Destroy" button
      4. Then you will find that the item is still in the frame

      I found that this bug has existed for a long time, and the first version the bug appeared was 18w22c.

       

      Because item cannot be emptied, the frame cannot be destroyed either, the only way to destroy the frame is to break the block the frame hanging

      Code Analytics(Based on 1.16.1 and Mojang "official" mappings, decompiled by Fernflower)

      In class net.minecraft.world.entity.decoration.ItemFrame:

      Method: private void dropItem(net.minecraft.world.entity.Entity entity, boolean b)

      Code fragment:

      if (!level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
          if (entity == null) {
              removeFramedMap(getItem());
          }
      }
      

      May change to: 

      if (!level.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
          setItem(ItemStack.EMPTY);
          if (entity == null) {
              removeFramedMap(getItem());
          }
      }
      

            Ulraf [Mojang] Ulraf
            xiaopangxie732 XiaoPangxie
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: