Some tags for spawners are only set if other tags are provided as well
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
- Use the following command
/setblock ~ ~1 ~ minecraft:spawner{SpawnData:{entity:{id:"armor_stand"}},RequiredPlayerRange:10s,MinSpawnDelay:5s,MaxSpawnDelay:5s} - 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
Created Issue:
Spawner without MaxNearbyEntities defaults RequiredPlayerRange
When you create a spawner without setting a MaxNearbyEntities, Minecraft defaults the MaxNearbyEntities value as well as the RequiredPlayerRange:
Command/setblock ~ ~1 ~ minecraft:mob_spawner 0 replace {EntityId:Zombie,RequiredPlayerRange:10,MinSpawnDelay:5,MaxSpawnDelay:5}Blockdata {}{ EntityId:"Zombie", MaxNearbyEntities:6s, RequiredPlayerRange:16s, SpawnCount:0s, MaxSpawnDelay:5s, SpawnRange:4s, Delay:0s, MinSpawnDelay:5s }
Spawner without MaxNearbyEntitiesdefaultsRequiredPlayerRangeSpawner without MaxNearbyEntities set RequiredPlayerRange to default value despite being provided
Intended, see constructor
public abstract class MobSpawnerBaseLogic { private int maxNearbyEntities = 6; private int activatingRangeFromPlayer = 16;
Yes. Class members must be initialized.
relates to
duplicates
Spawner without MaxNearbyEntities set RequiredPlayerRange to default value despite being providedSome tags for spawners are only set if other tags are provided as well
When you create a spawner without setting a MaxNearbyEntities, Minecraft defaults the MaxNearbyEntities value as well as the RequiredPlayerRange
:Command/setblock ~ ~1 ~ minecraft:mob_spawner 0 replace {EntityId:Zombie,RequiredPlayerRange:10,MinSpawnDelay:5,MaxSpawnDelay:5}Blockdata {}{ EntityId:"Zombie", MaxNearbyEntities:6s, RequiredPlayerRange:16s, SpawnCount:0s, MaxSpawnDelay:5s, SpawnRange:4s, Delay:0s, MinSpawnDelay:5s }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
- Use the following command
/setblock ~ ~1 ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"ArmorStand"},RequiredPlayerRange:10s,MinSpawnDelay:5s,MaxSpawnDelay:5s}- Inspect the NBT data with for example the /blockdata command
NBT data{ SpawnData:{ id:"ArmorStand" }, MaxNearbyEntities:6s, RequiredPlayerRange:16s, SpawnCount:0s, MaxSpawnDelay:5s, SpawnRange:4s, Delay:0s, MinSpawnDelay:5s }
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
- Use the following command
/setblock ~ ~1 ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"ArmorStand"},RequiredPlayerRange:10s,MinSpawnDelay:5s,MaxSpawnDelay:5s}- Inspect the NBT data with for example the /blockdata command
NBT data{ SpawnData:{ id:"ArmorStand" }, MaxNearbyEntities:6s, RequiredPlayerRange:16s, SpawnCount:0s, MaxSpawnDelay:5s, SpawnRange:4s, Delay:0s, MinSpawnDelay:5s }The required player range defaulted to 16
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
- Use the following command
/setblock ~ ~1 ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"ArmorStand"},RequiredPlayerRange:10s,MinSpawnDelay:5s,MaxSpawnDelay:5s}- Inspect the NBT data with for example the /blockdata command
NBT data{ SpawnData:{ id:"ArmorStand" }, MaxNearbyEntities:6s, RequiredPlayerRange:16s, SpawnCount:0s, MaxSpawnDelay:5s, SpawnRange:4s, Delay:0s, MinSpawnDelay:5s }The required player range was defaulted to 16
is duplicated by
relates to
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
- Use the following command
/setblock ~ ~1 ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"ArmorStand"},RequiredPlayerRange:10s,MinSpawnDelay:5s,MaxSpawnDelay:5s}- Inspect the NBT data with for example the /blockdata command
NBT data{ SpawnData:{ id:"ArmorStand" }, MaxNearbyEntities:6s, RequiredPlayerRange:16s, SpawnCount:0s, MaxSpawnDelay:5s, SpawnRange:4s, Delay:0s, MinSpawnDelay:5s }The required player range was defaulted to 16
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
- Use the following command
/setblock ~ ~1 ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"armor_stand"},RequiredPlayerRange:10s,MinSpawnDelay:5s,MaxSpawnDelay:5s}- Inspect the NBT data with for example the /blockdata command
NBT data{ SpawnData:{ 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
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
- Use the following command
/setblock ~ ~1 ~ minecraft:mob_spawner0 replace{SpawnData:{id:"armor_stand"},RequiredPlayerRange:10s,MinSpawnDelay:5s,MaxSpawnDelay:5s}- Inspect the NBT data with for example the /block
datacommandNBT data{ SpawnData:{ 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
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
- Use the following command
/setblock ~ ~1 ~ minecraft:spawner{SpawnData:{id:"armor_stand"},RequiredPlayerRange:10s,MinSpawnDelay:5s,MaxSpawnDelay:5s}- Inspect the NBT data with for example the /data get block command
NBT data{ SpawnData:{ 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
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
- Use the following command
/setblock ~ ~1 ~ minecraft:spawner{SpawnData:{id:"armor_stand"},RequiredPlayerRange:10s,MinSpawnDelay:5s,MaxSpawnDelay:5s}- Inspect the NBT data with for example the /data get block command
NBT data{SpawnData:{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
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
- Use the following command
/setblock ~ ~1 ~ minecraft:spawner{SpawnData:{entity:{id:"armor_stand"}},RequiredPlayerRange:10s,MinSpawnDelay:5s,MaxSpawnDelay:5s}- 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

Is there any reason for that?
But why is it overwriting then RequiredPlayerRange and not only sets MaxNearbyEntities?
Got it
Duplicate of
MC-31115Looks like it. Good catch, gerbil.
Please reopen this report as it explains the main problem more in detail or reopen
MC-31115Reopened. Please make sure the ticket is up to date for 15w47c.
Confirmed for 1.9
Still in 1.9.1-pre3
Still in 1.9.3-pre3
Still exists in 16w39c (1.11)
Still exists in 16w44a (1.11)
Still Exists in 1.11.2
Exists in 19w04b (1.14), /setblock ~ ~ ~ spawner
{RequiredPlayerRange:1s}doesn't work, the RequiredPlayerRange is still 16s. But the RequiredPlayerRange can be set by /data merge.
1.14.2 pre 4.
/setblock 11 50 0 minecraft:spawner{SpawnData:
{id:"minecraft:armor_stand"},RequiredPlayerRange:0s} destroy
sets the armor stand but not range
Affects 1.16.4 Release Candidate 1
Can confirm in 21w03a.
Can confirm in 21w05b.
Can confirm in 21w06a.
Can confirm in 21w07a. Video attached.
Can confirm in 1.16.5 and 21w08b.
Can confirm in 21w15a.
Can confirm in 1.17.
Can confirm in 1.17.1.
Can confirm in 1.18.1
Confirmed in 1.20.3-rc1