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

Hopper creating a furnace blockentity by transferring an item crashes the game

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: 19w38b, 19w40a
    • Fix Version/s: 19w41a
    • Labels:
      None
    • Confirmation Status:
      Confirmed
    • Category:
      Crash
    • Mojang Priority:
      Very Important

      Description

      Loading a chunk with a hopper and a furnace will crash the game if the hopper transfers an item into the furnace under rare circumstances.

      If the furnace blockentity doesn't exist for some reason, the hopper's getBlockEntity call will create the missing blockentity and add it to the pending blockentity list (as currently iterating over blockentities). As the world field is only initialized later, the hopper accessing the world field of the furnace causes a null pointer exception.

      The defect seems to be that the world field of a block entity may not be initialized, even though it is accessible to things that happen in the world. There are probably more bugs related to the world field not being initialized and being used without a nullcheck. A simple nullcheck in the furnace code is likely not enough, as other blockentities (e.g. beacons playing their sound when broken) might be affected by this (not limited to hopper interactions) as well.

      Suggested fix: Make sure that all newly created blockentities have their world field initialized when/before becoming accessible to the rest of the world. I suggest doing this always at the same time as setting their blockPos field.

       

      Edit: I attached a worlddownload with a region file that demonstrates this crash. (Furnace block without blockentity accessed by a hopper that tries to transfer an item)

      Note: Updated worlddownload to an equivalent world that was created with vanilla server and client only.

      Crash report

      19w38b: crash-2019-09-23_16.29.14-server.txt
      Description: Ticking block entity
      
      java.lang.NullPointerException: Ticking block entity
      	at bve.h(SourceFile:359)
      	at bve.a(SourceFile:434)
      	at bwd.a(SourceFile:310)
      	at bwd.a(SourceFile:274)
      	at bwd.t(SourceFile:180)
      	at bwd.a(SourceFile:122)
      	at bwd.Y_(SourceFile:109)
      	at bjc.K(SourceFile:597)
      	at wq.a(SourceFile:407)
      	at net.minecraft.server.MinecraftServer.b(SourceFile:843)
      	at net.minecraft.server.MinecraftServer.a(SourceFile:782)
      	at ebv.a(SourceFile:128)
      	at net.minecraft.server.MinecraftServer.run(SourceFile:650)
      	at java.lang.Thread.run(Thread.java:748)
      

        Attachments

          Activity

            People

            • Assignee:
              boq [Mojang] Bartosz Bok
              Reporter:
              2No2Name 2No2Name
            • Votes:
              9 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                CHK: