Team NBT tag adds entity to team even if it was not spawned in the world
The bug
The Team tag directly adds the entity to the provided team even if the entity is not spawned in the world. This should not happen because the entities are sometimes created to test if they can be spawned in the world before actually spawning them, for example to test if they collide with blocks or other entities.
How to reproduce
- Create a scoreboard team
/team add testTeam
- Set the time to night
/time set night
- Place a spawner which would spawn a mob and add it to a team
/setblock ~ ~ ~ spawner{Delay:0s,MinSpawnDelay:0s,MaxSpawnDelay:0s,MaxNearbyEntities:0s,SpawnRange:10s,RequiredPlayerRange:32s,SpawnCount:10s,SpawnData:{id:"zombie",Team:"testTeam"}} - Look at the team size
/team list testTeam
→ You should see that the number of entities in the team is greater than 0 even though no entity was spawned
Note: The reproduction steps changed slightly. Previously all spawning conditions were checked after loading the entity, now all spawning checks are performed before loading the entity, except the MaxNearbyEntities check.
Code analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
The method net.minecraft.entity.EntityLivingBase.readEntityFromNBT(NBTTagCompound) directly adds the entity to the team. This could be solved for example with a new method onEntityAddedToWorld which could be called when an entity was actually spawned in the world. Then the method readEntityFromNBT could store the team temporarily in a field until the method onEntityAddedToWorld is called.
Linked Issues
Created Issue:
Mob Spawners rapidly overload scoreboards if Team applied to SpawnData
There appears to be an issue with UUID creation involving scoreboards. This may apply to mobs spawned without scoreboards, but I was not able to test for this. Below are my steps to reproduce the problem in two scenarios:
Create team ABC
This scoreboard is used for all tests below:/scoreboard teams add ABC
Test 1: Friendly and Neutral mobs
Create a spawner for Chicken on team "ABC":/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Chicken",Team:"ABC"}}
Result: One or two Chicken entities will spawn (random?), while Team "ABC" is populated with four (4) UUIDs for each visible Chicken spawn.
(reset Team "ABC" for next test)
Create a spawner for Wolf on team "ABC":
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Wolf",Team:"ABC"}}
Result: One Wolf entity will spawn, while Team "ABC" is populated with four (4) UUIDs.
(reset Team "ABC" for next test)
Create a spawner for Horse on team "ABC":
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"EntityHorse",Team:"ABC"}}
Result: One or two EntityHorse entities will spawn (random?), while Team "ABC" is populated with four (4) UUIDs for each visible EntityHorse spawn.
ALSO, Team "ABC" seems to randomly populate with additional UUIDs not correlating to the visible spawning of visible EntityHorse. Always in multiples of four, suggesting that EntityHorse is periodically attempting and failing to spawn.
(reset Team "ABC" for next test)
Test 2: Hostile mobs
The symptoms of the problem are more serious with all Hostile mobs that were tested.Create a spawner for Zombie on team "ABC":
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Zombie",Team:"ABC"}}
Result: No Zombie entities ever spawn. Scoreboard constantly fills with UUIDs under Team ABC. This appears to be four per tick.
Conclusion
It is apparent that Mob Spawners are making multiple attempts to spawn the subject entity, at least four times per successful "cycle". This has only been tested for entities with Team applied to SpawnData, but it may also apply to ALL Mob Spawner scenarios.With Team applied to SpawnData, hostile mobs seem completely unable to spawn. Despite this, there are constant attempts made (many per tick) to create the entity. Regardless of success, in all cases a very large number of UUIDs are written to scoreboard.dat under the Team and can only be removed via:
/scoreboard teams empty ABC
In the case of a hostile mob, if the Mob Spawner is left visibly idle, the scoreboard will fill up rapidly until a server failure occurs, at which point this netty error will appear for any player attempting to connect:
[19:47:22] [Server thread/INFO]: draconicus lost connection: TranslatableComponent{key='disconnect.genericReason', args=[Internal Exception: io.netty.handler.codec.EncoderException: java.lang.IllegalArgumentException: unable to fit 3372107 into 3], siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}
Unknown macro: {/quote}This results in either an ambiguous "Disconnected" message for players attempting to join the server, or more commonly this message:
Internal Exception: java.io.IOException: Error while read(...): Connection reset by peer
{/quote}During the discovery of this problem, server failure occurred when a Team reached 158,728+ entries after the Mob Spawner went unnoticed for approximately 15 minutes.
Unrelated note: When the failure occurred, existing players were able to maintain connection despite being part of the scoreboard data. Only new connections failed.
Environment
Mint (Ubuntu) Linux, Oracle Java build 1.8.0_77-b03 (64bit)
There appears to be an issue with UUID creation involving scoreboards. This may apply to mobs spawned without scoreboards, but I was not able to test for this. Below are my steps to reproduce the problem in two scenarios:
Create team ABC
This scoreboard is used for all tests below:/scoreboard teams add ABC
Test 1: Friendly and Neutral mobs
Create a spawner for Chicken on team "ABC":/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Chicken",Team:"ABC"}}
Result: One or two Chicken entities will spawn (random?), while Team "ABC" is populated with four (4) UUIDs for each visible Chicken spawn.
(reset Team "ABC" for next test)
Create a spawner for Wolf on team "ABC":
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Wolf",Team:"ABC"}}
Result: One Wolf entity will spawn, while Team "ABC" is populated with four (4) UUIDs.
(reset Team "ABC" for next test)
Create a spawner for Horse on team "ABC":
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"EntityHorse",Team:"ABC"}}
Result: One or two EntityHorse entities will spawn (random?), while Team "ABC" is populated with four (4) UUIDs for each visible EntityHorse spawn.
ALSO, Team "ABC" seems to randomly populate with additional UUIDs not correlating to the visible spawning of visible EntityHorse. Always in multiples of four, suggesting that EntityHorse is periodically attempting and failing to spawn.
(reset Team "ABC" for next test)
Test 2: Hostile mobs
The symptoms of the problem are more serious with all Hostile mobs that were tested.Create a spawner for Zombie on team "ABC":
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Zombie",Team:"ABC"}}
Result: No Zombie entities ever spawn. Scoreboard constantly fills with UUIDs under Team ABC. This appears to be four per tick.
Conclusion
It is apparent that Mob Spawners are making multiple attempts to spawn the subject entity, at least four times per successful "cycle". This has only been tested for entities with Team applied to SpawnData, but it may also apply to ALL Mob Spawner scenarios.With Team applied to SpawnData, hostile mobs seem completely unable to spawn. Despite this, there are constant attempts made (many per tick) to create the entity. Regardless of success, in all cases a very large number of UUIDs are written to scoreboard.dat under the Team and can only be removed via:
/scoreboard teams empty ABC
In the case of a hostile mob, if the Mob Spawner is left visibly idle, the scoreboard will fill up rapidly until a server failure occurs, at which point this netty error will appear for any player attempting to connect:
[19:47:22] [Server thread/INFO]: draconicus lost connection: TranslatableComponent{key='disconnect.genericReason', args=[Internal Exception: io.netty.handler.codec.EncoderException: java.lang.IllegalArgumentException: unable to fit 3372107 into 3], siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}
Unknown macro: {/quote}This results in either an ambiguous "Disconnected" message for players attempting to join the server, or more commonly this message:
{/quote}
Internal Exception: java.io.IOException: Error while read(...): Connection reset by peerDuring the discovery of this problem, server failure occurred when a Team reached 158,728+ entries after the Mob Spawner went unnoticed for approximately 15 minutes.
Unrelated note: When the failure occurred, existing players were able to maintain connection despite being part of the scoreboard data. Only new connections failed.
There appears to be an issue with UUID creation involving scoreboards. This may apply to mobs spawned without scoreboards, but I was not able to test for this. Below are my steps to reproduce the problem in two scenarios:
Create team ABC
This scoreboard is used for all tests below:/scoreboard teams add ABC
Test 1: Friendly and Neutral mobs
Create a spawner for Chicken on team "ABC":/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Chicken",Team:"ABC"}}
Result: One or two Chicken entities will spawn (random?), while Team "ABC" is populated with four (4) UUIDs for each visible Chicken spawn.
(reset Team "ABC" for next test)
Create a spawner for Wolf on team "ABC":
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Wolf",Team:"ABC"}}
Result: One Wolf entity will spawn, while Team "ABC" is populated with four (4) UUIDs.
(reset Team "ABC" for next test)
Create a spawner for Horse on team "ABC":
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"EntityHorse",Team:"ABC"}}
Result: One or two EntityHorse entities will spawn (random?), while Team "ABC" is populated with four (4) UUIDs for each visible EntityHorse spawn.
ALSO, Team "ABC" seems to randomly populate with additional UUIDs not correlating to the visible spawning of visible EntityHorse. Always in multiples of four, suggesting that EntityHorse is periodically attempting and failing to spawn.
(reset Team "ABC" for next test)
Test 2: Hostile mobs
The symptoms of the problem are more serious with all Hostile mobs that were tested.Create a spawner for Zombie on team "ABC":
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Zombie",Team:"ABC"}}
Result: No Zombie entities ever spawn. Scoreboard constantly fills with UUIDs under Team ABC. This appears to be four per tick.
Conclusion
It is apparent that Mob Spawners are making multiple attempts to spawn the subject entity, at least four times per successful "cycle". This has only been tested for entities with Team applied to SpawnData, but it may also apply to ALL Mob Spawner scenarios.With Team applied to SpawnData, hostile mobs seem completely unable to spawn. Despite this, there are constant attempts made (many per tick) to create the entity. Regardless of success, in all cases a very large number of UUIDs are written to scoreboard.dat under the Team and can only be removed via:
/scoreboard teams empty ABC
In the case of a hostile mob, if the Mob Spawner is left visibly idle, the scoreboard will fill up rapidly until a server failure occurs, at which point this netty error will appear for any player attempting to connect:
[19:47:22] [Server thread/INFO]: draconicus lost connection: TranslatableComponent{key='disconnect.genericReason', args=[Internal Exception: io.netty.handler.codec.EncoderException: java.lang.IllegalArgumentException: unable to fit 3372107 into 3], siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}
This results in either an ambiguous "Disconnected" message for players attempting to join the server, or more commonly this message:
Internal Exception: java.io.IOException: Error while read(...): Connection reset by peer
During the discovery of this problem, server failure occurred when a Team reached 158,728+ entries after the Mob Spawner went unnoticed for approximately 15 minutes.
Unrelated note: When the failure occurred, existing players were able to maintain connection despite being part of the scoreboard data. Only new connections failed.
There appears to be an issue with UUID creation involving scoreboards. This may apply to mobs spawned without scoreboards, but I was not able to test for this. Below are my steps to reproduce the problem in two scenarios:
Create team ABC
This scoreboard is used for all tests below:/scoreboard teams add ABC
Test 1: Friendly and Neutral mobs
Create a spawner for Chicken on team "ABC":/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Chicken",Team:"ABC"}}
Result: One or two Chicken entities will spawn (random?), while Team "ABC" is populated with four (4) UUIDs for each visible Chicken spawn.
(reset Team "ABC" for next test)
Create a spawner for Wolf on team "ABC":
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Wolf",Team:"ABC"}}
Result: One Wolf entity will spawn, while Team "ABC" is populated with four (4) UUIDs.
(reset Team "ABC" for next test)
Create a spawner for Horse on team "ABC":
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"EntityHorse",Team:"ABC"}}
Result: One or two EntityHorse entities will spawn (random?), while Team "ABC" is populated with four (4) UUIDs for each visible EntityHorse spawn.
ALSO, Team "ABC" seems to randomly populate with additional UUIDs not correlating to the visible spawning of visible EntityHorse. Always in multiples of four, suggesting that EntityHorse is periodically attempting and failing to spawn.
(reset Team "ABC" for next test)
Test 2: Hostile mobs
The symptoms of the problem are more serious with all Hostile mobs that were tested.Create a spawner for Zombie on team "ABC":
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Zombie",Team:"ABC"}}
Result: No Zombie entities ever spawn. Scoreboard constantly fills with UUIDs under Team ABC. This appears to be four per tick.
Conclusion
It is apparent that Mob Spawners are making multiple attempts to spawn the subject entity, at least four times per successful "cycle". This has only been tested for entities with Team applied to SpawnData, but it may also apply to ALL Mob Spawner scenarios.With Team applied to SpawnData, hostile mobs seem completely unable to spawn. Despite this, there are constant attempts made (many per tick) to create the entity. Regardless of success, in all cases a very large number of UUIDs are written to scoreboard.dat under the Team and can only be removed via:
/scoreboard teams empty ABC
In the case of a hostile mob, if the Mob Spawner is left visibly idle, the scoreboard will fill up rapidly until a server failure occurs, at which point this netty error will appear for any player attempting to connect:
[19:47:22] [Server thread/INFO]: draconicus lost connection: TranslatableComponent{key='disconnect.genericReason', args=[Internal Exception: io.netty.handler.codec.EncoderException: java.lang.IllegalArgumentException: unable to fit 3372107 into 3], siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}
This results in either an ambiguous "Disconnected" message for players attempting to join the server, or more commonly this message:
Internal Exception: java.io.IOException: Error while read(...): Connection reset by peer
During the discovery of this problem, server failure occurred when a Team reached 158,728+ entries after the Mob Spawner went unnoticed for approximately 15 minutes.
Unrelated note: When the failure occurred, existing players were able to maintain connection despite being part of the scoreboard data. Only new connections failed.
There appears to be an issue with UUID creation involving scoreboards. This may apply to mobs spawned without scoreboards, but I was not able to test for this. Below are my steps to reproduce the problem in two scenarios:
Create team ABC
This scoreboard is used for all tests below:/scoreboard teams add ABC
Test 1: Friendly and Neutral mobs
Create a spawner for Chicken on team "ABC":/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Chicken",Team:"ABC"}}
Result: One or two Chicken entities will spawn (random?), while Team "ABC" is populated with four (4) UUIDs for each visible Chicken spawn.
(reset Team "ABC" for next test)
Create a spawner for Wolf on team "ABC":
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Wolf",Team:"ABC"}}
Result: One Wolf entity will spawn, while Team "ABC" is populated with four (4) UUIDs.
(reset Team "ABC" for next test)
Create a spawner for Horse on team "ABC":
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"EntityHorse",Team:"ABC"}}
Result: One or two EntityHorse entities will spawn (random?), while Team "ABC" is populated with four (4) UUIDs for each visible EntityHorse spawn.
ALSO, Team "ABC" seems to randomly populate with additional UUIDs not correlating to the visible spawning of visible EntityHorse. Always in multiples of four, suggesting that EntityHorse is periodically attempting and failing to spawn.
(reset Team "ABC" for next test)
Test 2: Hostile mobs
The symptoms of the problem are more serious with all Hostile mobs that were tested.Create a spawner for Zombie on team "ABC":
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Zombie",Team:"ABC"}}
Result: No Zombie entities ever spawn. Scoreboard constantly fills with UUIDs under Team ABC. This appears to be four per tick.
Conclusion
It is apparent that Mob Spawners are making multiple attempts to spawn the subject entity, at least four times per successful "cycle". This has only been tested for entities with Team applied to SpawnData, but it may also apply to ALL Mob Spawner scenarios.With Team applied to SpawnData, hostile mobs seem completely unable to spawn. Despite this, there are constant attempts made (many per tick) to create the entity. Regardless of success, in all cases a very large number of UUIDs are written to scoreboard.dat under the Team and can only be removed via:
/scoreboard teams empty ABC
In the case of a hostile mob, if the Mob Spawner is left visibly idle, the scoreboard will fill up rapidly until a server failure occurs, at which point this netty error will appear for any player attempting to connect:
[19:47:22] [Server thread/INFO]: draconicus lost connection: TranslatableComponent{key='disconnect.genericReason', args=[Internal Exception: io.netty.handler.codec.EncoderException: java.lang.IllegalArgumentException: unable to fit 3372107 into 3], siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}
This results in either an ambiguous "Disconnected" message for players attempting to join the server, or more commonly this message:
Internal Exception: java.io.IOException: Error while read(...): Connection reset by peer
During the discovery of this problem, server failure occurred within 15 minutes of a Mob Spawner in this condition going unnoticed.
When the failure occurred, existing players were able to maintain connection despite being part of the scoreboard data. Only new connections failed.
After around 30 minutes, the Mob Spawner was destroyed as server administrators looked for the source of the connection problem.
When the scoreboard was recovered and examined, the Team had reached 158,728+ entries.
Mob Spawners rapidly overload scoreboards if Team applied to SpawnDataTeam NBT tag adds entity to team even if it was not spawned in the world
Mint (Ubuntu) Linux, Oracle Java build 1.8.0_77-b03 (64bit)
There appears to be an issue with UUID creation involving scoreboards. This may apply to mobs spawned without
scoreboards, but I was not able to test for this. Below are my steps to reproduce the problem in two scenarios:Create team ABC
This scoreboard is used for all tests below:/scoreboard teams add ABC
Test 1: Friendly and Neutral mobs
Create a spawner for Chicken on team "ABC":/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Chicken",Team:"ABC"}}
Result: One or two Chicken entities will spawn (random?), while Team "ABC" is populated with four (4) UUIDs for each visible Chicken spawn.
(reset Team "ABC" for next test)
Create a spawner for Wolf on team "ABC":
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Wolf",Team:"ABC"}}
Result: One Wolf entity will spawn, while Team "ABC" is populated with four (4) UUIDs.
(reset Team "ABC" for next test)
Create a spawner for Horse on team "ABC":
/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"EntityHorse",Team:"ABC"}}
Result: One or two EntityHorse entities will spawn (random?), while Team "ABC" is populated with four (4) UUIDs for each visible EntityHorse spawn.
ALSO, Team "ABC" seems to randomly populate with additional UUIDs not correlating to the visible spawning of visible EntityHorse. Always in multiples of four, suggesting that EntityHorse is periodically attempting and failing to spawn.
(reset Team "ABC" for next test)
Test 2: Hostile mobs
The symptoms of the problem are more serious with all Hostile mobs that were tested.
Create a spawner for Zombie on team "ABC":/setblock ~ ~ ~ minecraft:mob_spawner 0 replace {SpawnData:{id:"Zombie",Team:"ABC"}}
Result: No Zombie entities ever spawn. Scoreboard constantly fills with UUIDs under Team ABC. This appears to be four per tick.
Conclusion
It is apparent that Mob Spawners are making multiple attempts to spawn the subject entity, at least four times per successful "cycle". This has only been tested for entities with Team applied to SpawnData, but it may also apply to ALL Mob Spawner scenarios.With Team applied to SpawnData, hostile mobs seem completely unable to spawn. Despite this, there are constant attempts made (many per tick) to create the entity. Regardless of success, in all cases a very large number of UUIDs are written to scoreboard.dat under the Team and can only be removed via:
/scoreboard teams empty ABC
In the case of a hostile mob, if the Mob Spawner is left visibly idle, the scoreboard will fill up rapidly until a server failure occurs, at which point this netty error will appear for any player attempting to connect:
[19:47:22] [Server thread/INFO]: draconicus lost connection: TranslatableComponent{key='disconnect.genericReason', args=[Internal Exception: io.netty.handler.codec.EncoderException: java.lang.IllegalArgumentException: unable to fit 3372107 into 3], siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}
This results in either an ambiguous "Disconnected" message for players attempting to join the server, or more commonly this message:
Internal Exception: java.io.IOException: Error while read(...): Connection reset by peer
During the discovery of this problem, server failure occurred within 15 minutes of a Mob Spawner in this condition going unnoticed.
When the failure occurred, existing players were able to maintain connection despite being part of the scoreboard data. Only new connections failed.
After around 30 minutes, the Mob Spawner was destroyed as server administrators looked for the source of the connection problem.
When the scoreboard was recovered and examined, the Team had reached 158,728+ entries.The bug
The Team tag directly adds the entity to the provided team even if the entity is not spawned in the world. This should not happen because the entities are sometimes created to test if they can be spawned in the world before actually spawning them, for example to test if they collide with blocks or other entities.
How to reproduce
- Create a scoreboard team
/scoreboard teams add testTeam- Set the time to day
/time set day- Place a spawner which would spawn a mob and add it to a team
/setblock ~ ~ ~ mob_spawner default replace {SpawnData:{id:"zombie",Team:"testTeam"}}- Look at the team size
/scoreboard teams list→ You should see that the number of entities in the team is greater than 0
Code analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
The method net.minecraft.entity.EntityLivingBase.readEntityFromNBT(NBTTagCompound) directly adds the entity to the team. This could be solved for example with a new method onEntityAddedToWorld which could be called when an entity was actually spawned in the world. Then the method readEntityFromNBT could store the team temporarily in a field until the method onEntityAddedToWorld is called.
The bug
The Team tag directly adds the entity to the provided team even if the entity is not spawned in the world. This should not happen because the entities are sometimes created to test if they can be spawned in the world before actually spawning them, for example to test if they collide with blocks or other entities.
How to reproduce
- Create a scoreboard team
/scoreboard teams add testTeam- Set the time to day
/time set day- Place a spawner which would spawn a mob and add it to a team
/setblock ~ ~ ~ mob_spawner default replace {SpawnData:{id:"zombie",Team:"testTeam"}}- Look at the team size
/scoreboard teams list→ You should see that the number of entities in the team is greater than 0 even though no entity was spawned
Code analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
The method net.minecraft.entity.EntityLivingBase.readEntityFromNBT(NBTTagCompound) directly adds the entity to the team. This could be solved for example with a new method onEntityAddedToWorld which could be called when an entity was actually spawned in the world. Then the method readEntityFromNBT could store the team temporarily in a field until the method onEntityAddedToWorld is called.
The bug
The Team tag directly adds the entity to the provided team even if the entity is not spawned in the world. This should not happen because the entities are sometimes created to test if they can be spawned in the world before actually spawning them, for example to test if they collide with blocks or other entities.
How to reproduce
- Create a scoreboard team
/scoreboardteamsadd testTeam- Set the time to day
/time set day- Place a spawner which would spawn a mob and add it to a team
/setblock ~ ~ ~ mob_spawnerdefaultreplace {SpawnData:{id:"zombie",Team:"testTeam"}}- Look at the team size
/scoreboardteamslist→ You should see that the number of entities in the team is greater than 0 even though no entity was spawned
Code analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
The method net.minecraft.entity.EntityLivingBase.readEntityFromNBT(NBTTagCompound) directly adds the entity to the team. This could be solved for example with a new method onEntityAddedToWorld which could be called when an entity was actually spawned in the world. Then the method readEntityFromNBT could store the team temporarily in a field until the method onEntityAddedToWorld is called.
The bug
The Team tag directly adds the entity to the provided team even if the entity is not spawned in the world. This should not happen because the entities are sometimes created to test if they can be spawned in the world before actually spawning them, for example to test if they collide with blocks or other entities.
How to reproduce
- Create a scoreboard team
/team add testTeam- Set the time to day
/time set day- Place a spawner which would spawn a mob and add it to a team
/setblock ~ ~ ~ mob_spawner{SpawnData:{id:"zombie",Team:"testTeam"}}- Look at the team size
/team list testTeam→ You should see that the number of entities in the team is greater than 0 even though no entity was spawned
Code analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
The method net.minecraft.entity.EntityLivingBase.readEntityFromNBT(NBTTagCompound) directly adds the entity to the team. This could be solved for example with a new method onEntityAddedToWorld which could be called when an entity was actually spawned in the world. Then the method readEntityFromNBT could store the team temporarily in a field until the method onEntityAddedToWorld is called.
The bug
The Team tag directly adds the entity to the provided team even if the entity is not spawned in the world. This should not happen because the entities are sometimes created to test if they can be spawned in the world before actually spawning them, for example to test if they collide with blocks or other entities.
How to reproduce
- Create a scoreboard team
/team add testTeam- Set the time to day
/time set day- Place a spawner which would spawn a mob and add it to a team
/setblock ~ ~ ~mob_spawner{SpawnData:{id:"zombie",Team:"testTeam"}}- Look at the team size
/team list testTeam→ You should see that the number of entities in the team is greater than 0 even though no entity was spawned
Code analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
The method net.minecraft.entity.EntityLivingBase.readEntityFromNBT(NBTTagCompound) directly adds the entity to the team. This could be solved for example with a new method onEntityAddedToWorld which could be called when an entity was actually spawned in the world. Then the method readEntityFromNBT could store the team temporarily in a field until the method onEntityAddedToWorld is called.
relates to
The bug
The Team tag directly adds the entity to the provided team even if the entity is not spawned in the world. This should not happen because the entities are sometimes created to test if they can be spawned in the world before actually spawning them, for example to test if they collide with blocks or other entities.
How to reproduce
- Create a scoreboard team
/team add testTeam- Set the time to
day/time setday- Place a spawner which would spawn a mob and add it to a team
/setblock ~ ~ ~ spawner{SpawnData:{id:"zombie",Team:"testTeam"}}- Look at the team size
/team list testTeam→ You should see that the number of entities in the team is greater than 0 even though no entity was spawned
Code analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
The method net.minecraft.entity.EntityLivingBase.readEntityFromNBT(NBTTagCompound) directly adds the entity to the team. This could be solved for example with a new method onEntityAddedToWorld which could be called when an entity was actually spawned in the world. Then the method readEntityFromNBT could store the team temporarily in a field until the method onEntityAddedToWorld is called.
The bug
The Team tag directly adds the entity to the provided team even if the entity is not spawned in the world. This should not happen because the entities are sometimes created to test if they can be spawned in the world before actually spawning them, for example to test if they collide with blocks or other entities.
How to reproduce
- Create a scoreboard team
/team add testTeam- Set the time to night
/time set night- Place a spawner which would spawn a mob and add it to a team
/setblock ~ ~ ~ spawner{Delay:0s,MinSpawnDelay:0s,MaxSpawnDelay:0s,MaxNearbyEntities:0s,SpawnRange:10s,RequiredPlayerRange:32s,SpawnCount:10s,SpawnData:{id:"zombie",Team:"testTeam"}}- Look at the team size
/team list testTeam→ You should see that the number of entities in the team is greater than 0 even though no entity was spawned
Note: The reproduction steps change slightly. Previously all spawning conditions were checked after loading the entity, now all spawning checks are performed before loading the entity, except the MaxNearbyEntities check.
Code analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
The method net.minecraft.entity.EntityLivingBase.readEntityFromNBT(NBTTagCompound) directly adds the entity to the team. This could be solved for example with a new method onEntityAddedToWorld which could be called when an entity was actually spawned in the world. Then the method readEntityFromNBT could store the team temporarily in a field until the method onEntityAddedToWorld is called.
The bug
The Team tag directly adds the entity to the provided team even if the entity is not spawned in the world. This should not happen because the entities are sometimes created to test if they can be spawned in the world before actually spawning them, for example to test if they collide with blocks or other entities.
How to reproduce
- Create a scoreboard team
/team add testTeam- Set the time to night
/time set night- Place a spawner which would spawn a mob and add it to a team
/setblock ~ ~ ~ spawner{Delay:0s,MinSpawnDelay:0s,MaxSpawnDelay:0s,MaxNearbyEntities:0s,SpawnRange:10s,RequiredPlayerRange:32s,SpawnCount:10s,SpawnData:{id:"zombie",Team:"testTeam"}}- Look at the team size
/team list testTeam→ You should see that the number of entities in the team is greater than 0 even though no entity was spawned
Note: The reproduction steps changed slightly. Previously all spawning conditions were checked after loading the entity, now all spawning checks are performed before loading the entity, except the MaxNearbyEntities check.
Code analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
The method net.minecraft.entity.EntityLivingBase.readEntityFromNBT(NBTTagCompound) directly adds the entity to the team. This could be solved for example with a new method onEntityAddedToWorld which could be called when an entity was actually spawned in the world. Then the method readEntityFromNBT could store the team temporarily in a field until the method onEntityAddedToWorld is called.
Is this still an issue in the most recent versions (currently that is 1.10.2, or 16w43a) of Minecraft? If so, please update the affected versions and help us keeping this ticket updated from time to time. If you are the owner/reporter of this ticket, you can modify the affected version(s) yourself.
Changed report to be about the general problem.
Confirmed for 1.13.1.
Can confirm that this is still an issue in 21w05b.