Spawner with missing "minecraft:" in entity id (or with not lowercased entity id) spawns this entity until you reload the world
If you use the following commands (same happens if you change id:creeper to be id:minecraft:Creeper)
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:creeper}}
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnPotentials:[{Entity:{id:creeper},Weight:1}]}
you get 2 spawners, each of which has a pig inside and has default NBT data, but it works like the command has "minecraft:creeper" instead of "creeper" (the first spawner spawns creepers right away and the second one will do that after pigs spawn from it one time) This behavior fixes itself when you reload the world (spawners will spawn only pigs).
Expected behavior
- Capitalization should not matter, for example minecraft:CreEper should be valid as well
- The restriction for the id should apply to reading and saving NBT, not only saving
Code analysis
The following is based on a decompiled version of Minecraft 16w43a using JD-GUI 1.4.0
The method ajd.g() which does this check is only called when the NBT of a spawner is written and prevents writing any other tags as well, even if they are valid. In previous versions it tested if the id was empty or null. In general it might be better to replace the entry with the default (pig) instead of just skipping all other tags.
Linked Issues
Created Issue:
Spawner with missing "minecraft:" in entity id spawns this entity until you reload the world
If you use the following commands
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:creeper}}/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnPotentials:[{Entity:{id:creeper},Weight:1}]}you get 2 spawners, each of which has a pig inside and has default NBT data but works like the command has "minecraft:creeper" instead of "creeper" (the first spawner spawns creepers right away and the second one will do that after pigs spawn from it one time) This behavior fixes itself when you reload the world (spawners will spawn only pigs).
relates to
If you use the following commands
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:creeper}}/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnPotentials:[{Entity:{id:creeper},Weight:1}]}you get 2 spawners, each of which has a pig inside and has default NBT data but works like the command has "minecraft:creeper" instead of "creeper" (the first spawner spawns creepers right away and the second one will do that after pigs spawn from it one time) This behavior fixes itself when you reload the world (spawners will spawn only pigs).
If you use the following commands (same happens if you change id:creeper to be id:minecraft:Creeper)
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:creeper}}/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnPotentials:[{Entity:{id:creeper},Weight:1}]}you get 2 spawners, each of which has a pig inside and has default NBT data, but it works like the command has "minecraft:creeper" instead of "creeper" (the first spawner spawns creepers right away and the second one will do that after pigs spawn from it one time) This behavior fixes itself when you reload the world (spawners will spawn only pigs).
Spawner with missing "minecraft:" in entity id (or with not lowercased entity id) spawns this entity until you reload the world
It looks like it is not saving that data to the NBT tag. Using for example /blockdata ~ ~-1 ~ {} on the spawner after placing it does not show the SpawnData and SpawnPotentials tags.
If you use the following commands (same happens if you change id:creeper to be id:minecraft:Creeper)
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:creeper}}/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnPotentials:[{Entity:{id:creeper},Weight:1}]}you get 2 spawners, each of which has a pig inside and has default NBT data, but it works like the command has "minecraft:creeper" instead of "creeper" (the first spawner spawns creepers right away and the second one will do that after pigs spawn from it one time) This behavior fixes itself when you reload the world (spawners will spawn only pigs).
Code analysis
The following is based on a decompiled version of Minecraft 16w43a using JD-GUI 1.4.0
The method ajd.g() which does this check is only called when the NBT of a spawner is written and prevents writing any other tags as well, even if they are valid. It looks like this existed
If you use the following commands (same happens if you change id:creeper to be id:minecraft:Creeper)
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:creeper}}/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnPotentials:[{Entity:{id:creeper},Weight:1}]}you get 2 spawners, each of which has a pig inside and has default NBT data, but it works like the command has "minecraft:creeper" instead of "creeper" (the first spawner spawns creepers right away and the second one will do that after pigs spawn from it one time) This behavior fixes itself when you reload the world (spawners will spawn only pigs).
Code analysisThe following is based on a decompiled version of Minecraft 16w43a using JD-GUI 1.4.0
The method ajd.g() which does this check is only called when the NBT of a spawner is written and prevents writing any other tags as well, even if they are valid. I
t looks like this existedIf you use the following commands (same happens if you change id:creeper to be id:minecraft:Creeper)
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:creeper}}/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnPotentials:[{Entity:{id:creeper},Weight:1}]}you get 2 spawners, each of which has a pig inside and has default NBT data, but it works like the command has "minecraft:creeper" instead of "creeper" (the first spawner spawns creepers right away and the second one will do that after pigs spawn from it one time) This behavior fixes itself when you reload the world (spawners will spawn only pigs).
Expected behavior
- Capitalization should not matter, for example minecraft:CreEper should be valid as well
- The restriction for the id should apply to reading and saving NBT, not only saving
Code analysis
The following is based on a decompiled version of Minecraft 16w43a using JD-GUI 1.4.0
The method ajd.g() which does this check is only called when the NBT of a spawner is written and prevents writing any other tags as well, even if they are valid. In previous versions it tested if the id was empty or null. In general it might be better to replace the entry with the default (pig) instead of just skipping all other tags.
Relates to
MC-106199