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

Spawner with weight 0 crashes game

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened
    • Resolution: Unresolved
    • Affects Version/s: Minecraft 1.8.8, Minecraft 15w39c, Minecraft 15w40b, Minecraft 15w45a, Minecraft 15w47c, Minecraft 15w51b, Minecraft 1.9.4, Minecraft 16w35a, Minecraft 1.11, Minecraft 1.11.2, Minecraft 17w06a, Minecraft 1.12 Pre-Release 5, Minecraft 1.12 Pre-Release 7, Minecraft 1.12, Minecraft 18w05a, Minecraft 1.14.3 Pre-Release 2, 1.14.4, 19w38b
    • Fix Version/s: Minecraft 1.12.2
    • Confirmation Status:
      Confirmed

      Description

      A spawner with SpawnPotentials containing an entry with a Weight of 0 causes the game (or server) to crash:

      /setblock ~ ~ ~ spawner{Delay:-1,SpawnPotentials:[{Weight:0,Entity:{id:pig}}]}
      

      Crash log attached.

      1.14.3 pre-2
      Description: Ticking block entity
      
      java.lang.IllegalArgumentException
      	at aaf.a(SourceFile:18)
      	at aaf.a(SourceFile:37)
      	at bgs.i(SourceFile:179)
      	at bgs.c(SourceFile:91)
      	at bup.T_(SourceFile:62)
      	at bhl.K(SourceFile:625)
      	at vi.a(SourceFile:402)
      	at net.minecraft.server.MinecraftServer.b(SourceFile:824)
      	at net.minecraft.server.MinecraftServer.a(SourceFile:763)
      	at dxn.a(SourceFile:128)
      	at net.minecraft.server.MinecraftServer.run(SourceFile:631)
      	at java.lang.Thread.run(Thread.java:745)
      

      The reason for this is that the game throws a IllegalArgumentException in case the sum of all weights is <= 0. This means this bug is also caused when negative weights are provided or when the weights overflow:

      setblock ~ ~1 ~ mob_spawner 0 replace {Delay:-1s,MinSpawnDelay:3s,MaxSpawnDelay:3s,SpawnPotentials:[{Entity:{id:armor_stand},Weight:2147483647},{Entity:{id:armor_stand},Weight:1}]}
      

      This affects also loot tables but only if the weight sum overflows. There it does not crash but prints the exception in the log only.

        Attachments

        1. crash-2015-10-06_02.47.24-server.txt
          3 kB
          Arcensoth
        2. crash-2015-11-05_23.54.01-server.txt
          4 kB
          [Mod] Kumasasa
        3. crash-2016-05-23_14.02.43-server.txt
          3 kB
          Arcensoth
        4. crash-2017-06-04_20.16.54-server.txt
          3 kB
          [Mod] Michael Wobst

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                Arcensoth Arcensoth
              • Votes:
                8 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  CHK: