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

Some tags for spawners are only set if other tags are provided as well

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • Minecraft 1.8.6, Minecraft 15w34d, Minecraft 15w51b, Minecraft 1.9, Minecraft 1.9.1 Pre-Release 3, Minecraft 1.9.2, Minecraft 1.9.3 Pre-Release 3, Minecraft 1.10.2, Minecraft 16w39c, Minecraft 16w44a, Minecraft 1.11.2, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 1.13.2, Minecraft 19w04b, 1.15.2, 21w03a, 1.16.5, 21w05b, 21w06a, 21w07a, 21w08b, 21w15a, 1.17, 1.17.1, 1.18.2, 1.20.3 Release Candidate 1
    • Confirmed
    • Commands
    • Low
    • Platform

      The bug

      When you create a spawner or use the /blockdata command to modify the NBT data of a spawner (or spawner minecart) some of the tags are only set if other tags are provided as well.

      Affected tags
      • MaxSpawnDelay and SpawnCount: only set when MinSpawnDelay is provided
      • RequiredPlayerRange: only set when MaxNearbyEntities is provided

      The reason

      In 1.8 the game tests if these tags are provided and then set the other tags. In my opinion this should be done for every tag and not only for one single tag.

      Affected method: public void readFromNBT(NBTTagCompound p_98270_1_) of the net.minecraft.tileentity.MobSpawnerBaseLogic class (MCP 1.8 names)

      public void readFromNBT(NBTTagCompound p_98270_1_)
      {
      	//...
      
      	if (p_98270_1_.hasKey("MinSpawnDelay", 99))
      	{
      		this.minSpawnDelay = p_98270_1_.getShort("MinSpawnDelay");
      		this.maxSpawnDelay = p_98270_1_.getShort("MaxSpawnDelay");
      		this.spawnCount = p_98270_1_.getShort("SpawnCount");
      	}
      
      	if (p_98270_1_.hasKey("MaxNearbyEntities", 99))
      	{
      		this.maxNearbyEntities = p_98270_1_.getShort("MaxNearbyEntities");
      		this.activatingRangeFromPlayer = p_98270_1_.getShort("RequiredPlayerRange");
      	}
      	
      	//...
      }
      

      How to reproduce

      1. Use the following command
        /setblock ~ ~1 ~ minecraft:spawner{SpawnData:{entity:{id:"armor_stand"}},RequiredPlayerRange:10s,MinSpawnDelay:5s,MaxSpawnDelay:5s}
        
      2. Inspect the NBT data with for example the /data get block command
        NBT data
        {
            SpawnData: {
                entity: {
                    id:"armor_stand"
                }
            },
            MaxNearbyEntities:6s,
            RequiredPlayerRange:16s,
            SpawnCount:0s,
            MaxSpawnDelay:5s,
            SpawnRange:4s,
            Delay:0s,
            MinSpawnDelay:5s
        }
        

        The required player range was defaulted to 16

        1. MC-80690.mp4
          3.90 MB
        2. MC-80690.png
          MC-80690.png
          836 kB

            Unassigned Unassigned
            marcono1234 [Mod] Marcono1234
            Votes:
            15 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              CHK: