The bug
When zombie villagers, husks, drowned or zombified piglins take damage, there is a chance (depending on difficulty setting it seems) that a zombie will spawn.
It is not clear what the expected behavior for these zombie types should be: Spawning zombies of the same type or not being able to spawn reinforcements at all.
However, for zombie villagers spawning zombie villager reinforcements might allow building a farm based on this, which might or might not be desired.
Note: For zombified piglins ("zombie pigmen" at the time) this was partially fixed in 20w14a by setting their base zombie.spawn_reinforcements
value to 0. However, it appears that if a zombified piglin spawns as leader ("Leader zombie bonus"), then it is still possible for it to spawn zombies. The same also applies when setting a custom zombie.spawn_reinforcements
value in the NBT or via commands.
How to reproduce
Be in the nether or the end (the overworld works too, but there will be natural zombie spawning as well)
Set the game difficulty to hard, and ensure the gamerule
mobGriefing
is set totrue
Spawn a bunch of zombie villagers, husks, drowned or zombified piglins. Example:
/summon minecraft:zombified_piglin ~ ~ ~ {Attributes:[{Base:1.0,Name:"zombie.spawn_reinforcements"}]}
Go into survival mode
Damage the mobs for a while
→ ❌ Zombie reinforcements are spawning
Expected behavior
Regular zombie reinforcements would not be spawned when entities that aren't zombies with the minecraft:zombie.spawn_reinforcements
attribute are attacked. Instead, for example, if a zombified piglin with this attribute were to be attacked, it would summon zombified piglin reinforcements and not zombie reinforcements.
Code analysis
Code analysis by @unknown can be found in this comment.
Linked issues
is duplicated by 47
relates to 1
Attachments
Comments 113
I've retested, and it appears to only happen when pigmen are shot by ghasts (probably other non-player damage aswell). Also, zombies seem to spawn a lot more frequently as you increase the difficulty setting.
I can confirm this for 13w18b. It happened to me when I was smashing some zombie pigmen.
Can confirm, when I was hitting zombie pigmen, a zombie spawned nearby. Will upload pics
Can confirm with 13218c, happens when damage is dealt to pigmen
Happened to me in 13w19a
I can confirm this bug happens with the latest snapshot.
Unable to reproduce in 13w21b.
Was able to reproduce in 13w25a.
I've noticed this as well as of 1.6.2.
it seems to be caused by the fact that zombiepigman and zombie's share some of the same coding so that whenever you hurt/kill a pigman
a extra zombie will spawn, this also is the reason why villagers run from both types of zombies and combust in the sun (though zombiepigman have a coding to keep them from dying from lava and fire)
It happened to me in 1.7.2.
Tested, appears to be fixed in 14w29b.
If anyone can confirm this issue in 14w29b, I would be happy to reopen this ticket.
I can confirm this is happening on our 14w32d server.
Confirmed in 14w33c
Confirm in 1.8
Is there possibly a portal nearby through which the zombies could have come to the nether?
@unknown No because I was about 500 blocks from my portal in a nether fortress when I discovered this bug. They would spawn ~25 blocks from where I was.
Can confirm it's still in 1.8 release - here's a video of it happening: http://gfycat.com/FluffyHilariousHartebeest (huge filesize, couldn't attach, sorry)
Confirm in 1.8.4 : http://postimg.org/image/r0br3eyap/
Confirm in 15w47a
Confirm for 15w50a
Confirmed for 16w03a
Confirmed for 16w04a.
Confirmed for 16w05a.
Confirmed 16w05b.
Confirm for 1.9-pre1
Please link to this comment in the description
The following is based on decompiled version of Minecraft 1.8 using MCP. All method and class names are the names used in the decompiled version.
The reason why this happens is that the public boolean attackEntityFrom(DamageSource source, float amount)
method of the net.minecraft.entity.monster.EntityPigZombie
class calls the public boolean attackEntityFrom(DamageSource source, float amount)
method of its parent class, the net.minecraft.entity.monster.EntityZombie
class, which spawns Zombies as reinforcement. The following shows one way how this could be solved for the net.minecraft.entity.monster.EntityZombie
class.
/**
* Called when the entity is attacked.
*/
public boolean attackEntityFrom(DamageSource source, float amount)
{
if (super.attackEntityFrom(source, amount))
{
EntityLivingBase var3 = this.getAttackTarget();
if (var3 == null && source.getEntity() instanceof EntityLivingBase)
{
var3 = (EntityLivingBase)source.getEntity();
}
if (var3 != null && this.worldObj.getDifficulty() == EnumDifficulty.HARD && (double)this.rand.nextFloat() < this.getEntityAttribute(field_110186_bp).getAttributeValue())
{
int var4 = MathHelper.floor_double(this.posX);
int var5 = MathHelper.floor_double(this.posY);
int var6 = MathHelper.floor_double(this.posZ);
// Replaced this
//EntityZombie var7 = new EntityZombie(this.worldObj);
EntityZombie var7 = null;
try
{
var7 = (EntityZombie) this.getClass().getConstructor(new Class[] {World.class}).newInstance(new Object[] {this.worldObj});
}
catch (Exception exception)
{
LogManager.getLogger().error("Failed spawning reinforcement Zombie", exception);
}
//...
}
return true;
}
else
{
return false;
}
}
@Marcono, if I'm reading it right, this code change would just not spawn anything, rather than changing to a sociable zombie pigman?
It would spawn for all subclasses of the net.minecraft.entity.monster.EntityZombie
class an entity of the same type. This means for zombies, it spawns zombies, for pigmen it spawns pigmen
Oh good. That sounds like expected behavior. I guess that's what the EntityZombie.getClass() call is about. Perfect, thanks for explaining!
In other news, confirmed for 1.9-pre2
If you want a little bit more information, the getClass()
method is actually called for this
which is the object that has this method. As this entity is always a subclass of the Zombie the object received is cast to the Zombie class. I took this part from method spawning mobs in chunks. It would be better however to have some kind of factory method instead of relying on every entity having a constructor with only a world as parameter.
Confirm for 1.9-pre3
Confirm for 1.9-pre4
Still a problem in 1.9.1-pre3.
Confirm for 16w14a
Confirm for 16w15a
Confirm for 1.9.4
Confirm 16w20a.
Confirm 1.10.2
Is this still an issue in 16w32a?
Confirm for 1.11
Confirmed for 1.11.2.
Confirmed for 1.11.2, and for overworld!
Building a goldfarm in overworld (like this one: https://www.youtube.com/watch?v=A85yJTV6J4E ), waiting that many⚠️ pigman spawn and walking around portals.
Then, when hitting one (or more) to do them cry, results in some or many normal zombies to spawn outside the constructed square around portals (i built a room beneath the construction, they don't spawn inside that cellar but outside while daytime - in my construction they have 1 block of roof around that cellar).
Affects 1.12-pre2
@unknown, ticket is yours now.
Confirmed for 1.12.1
@unknown, 1.12.1 is already marked as affected.
This occurred for me the other day in 18w22c
confirm for 18w31a
Confirmed in 1.13.1.
Does still occur in 19w09a
Can reproduce in release 1.14
Affects 1.14.1 Pre-Release 1
Affects 1.14.2 pre-releases
can confirm 1.14.2, in nether roof gold farm
Affects 1.14.3
Got loads spawning in my nether roof gold farm in the latest snapshot 19w40a. It made me drop to about 5fps when I afkd for a few hours
This apply to any mobs that have the ability to spawn reinforcement, including drowned. The problem is that it probably doesn't check for entity type.
Affects 1.14.4
Still happening in 1.15 pre1. Breaks zombie pigman gold farms. Zombies also pickup gold swords and cause lag. Zombies shouldn't appear in the nether in the first place. Added two more screenshots.
Added other types of zombies to the ticket as well.
I would remove Zombie Pigmen from the list of mobs. I spent a good thirty minutes trying to recreate the bug but no zombies spawned. Only regular pigmen reinforcements.
I attempted this on 1.14.4
I tested this with zombie pigmen too, and they're definitely affected. This ticket was originally only about zombie pigmen.
Can confirm still happening in 1.15 final release.
This is WAI. Zombies were intended to have a social aspect and could spawn in others when damaged. This was explicitly stated as a feature back in 1.8 timeframe.
Yes, it's obvious that zombies are supposed to spawn reinforcements. But is it intended that zombie villagers, husks, drowned and zombie pigmen also summon zombies when damaged? It seems like they either should spawn new mobs of their kind, or not have any reinforcements mechanics at all. That's the issue.
I clarified the title a little bit to make that more clear, and removed the "nether" label, as this issue is not exclusive to that dimension.
I don't think this issue should concern zombie villagers, because people will start making farms based on reinforcements, zombie villagers should only call regular zombie as reinforcements
Been noticing this bug a lot recently due to zombified piglins. They spawn zombie reinforcements which means random zombie spawns in the nether.
It seems like this might have been fixed for zombified piglins in one of the 1.16 snapshots, can anyone confirm?
20w18a - still happens
[media]They also spawn on glass and magma blocks which they shouldn't although I believe this is another issue.
@@unknown, yes that is MC-153787.
Can confirm still a problem in 20w20a.
My partner has been seeing these zombies constantly for the past week. We're on 1.15.2 multiplayer, playing on Hard Difficulty. They spawn frequently when pigman are attacked.
The zombie villagers, drowned and husks have this behavior as intended as they are considered to just be zombie variants. However with the zombified piglin this is a bug as they should not spawn reinforcements.
Can confirm this still happening a lot in 1.16.1 in multiplayer on hard. A massive pack of pigmen was outside our nether portal and an iron golem attacked them. It spawned about 20 zombies over the course of the fight.
In 20w29a
I can confirm.
[media]Can confirm in 20w51a.
Confirm in 1.16.5
Can confirm in 21w05b. The best way to reproduce this issue, is to run the following commands, attack the summoned mob a few times, and observe that regular zombie reinforcements are spawned.
/summon minecraft:zombie_villager ~ ~ ~ {Attributes:[{Base:1.0,Name:"zombie.spawn_reinforcements"}]}
/summon minecraft:husk ~ ~ ~ {Attributes:[{Base:1.0,Name:"zombie.spawn_reinforcements"}]}
/summon minecraft:drowned ~ ~ ~ {Attributes:[{Base:1.0,Name:"zombie.spawn_reinforcements"}]}
/summon minecraft:zombified_piglin ~ ~ ~ {Attributes:[{Base:1.0,Name:"zombie.spawn_reinforcements"}]}
Can confirm in 21w06a.
Tried it in 21w10a. No Zombie called for reinforcements. Tried the method from @Avoma 2 comments above. Can someone relate?
Can confirm in 21w17a that this is still an issue. @unknown, are you sure that the difficulty was set to hard
when attempting to reproduce this?
Confirm in 1.17 Pre-release 1
Confirm in 1.17 Pre-release 2
Confirm in 1.17 Pre-release 3
Confirm in 1.17
Confirm in 1.17.1 Pre-release 1
Can confirm in 1.17.1 Release Candidate 1.
Please add the label reinforcement
to this ticket.
Confirm in 21w37a
Can confirm this behavior in 21w39a. Here are some more reliable steps on how to go about reproducing this issue along with some extra details regarding this problem.
The Bug:
Regular zombie reinforcements are always spawned when entities with the "minecraft:zombie.spawn_reinforcements" attribute are attacked.
Steps to Reproduce:
Ensure that the "doMobSpawning" gamerule is set to "true", the difficulty is set to "hard", and the time is set to "night".
/gamerule doMobSpawning true
/difficulty hard
/time set night
Summon a zombified piglin that is able to summon reinforcements upon being harmed.
/summon minecraft:zombified_piglin ~ ~ ~ {Attributes:[{Base:1.0,Name:"zombie.spawn_reinforcements"}]}
Attack the zombified piglin multiple times.
Take note of the type of entities that it summoned as reinforcements, upon being attacked.
Observed Behavior:
Regular zombie reinforcements are always spawned when entities with the "minecraft:zombie.spawn_reinforcements" attribute are attacked. For example, in this particular scenario above, when a zombified piglin with this attribute was attacked, it spawned regular zombie reinforcements.
Expected Behavior:
Regular zombie reinforcements would not be always spawned when entities with the "minecraft:zombie.spawn_reinforcements" attribute are attacked. Instead, if a zombified piglin with this attribute were to be attacked, it would summon zombified piglin reinforcements and not zombie reinforcements.
Can confirm in releases 1.16.5 and 1.17.1. Provoking zombified piglins still causes regular overworld zombies to spawn in the nether
Confirm in 21w42a
Can confirm in 21w44a.
Confirm in 1.18 Pre-release 5
Confirm in 1.18 Release Candidate 1
Can confirm in 1.18.1.
Can confirm in 1.18.2.
Can confirm in 1.19.
Can confirm in 1.19.2.
Zombified piglins appear to spawn no reinforcements in the overworld, in a copper farm where both zombified villagers and zombies do.
Not all of those mob types can spawn reinforcements. Zombified piglins can absolutely spawn zombie reinforcements in the overworld.
Confirm in 1.19.4 Pre-release 3
Can confirm in 1.19.4 and 23w18a
Confirmed in 1.20.1
Still confirmed in Java 1.20.1
Can confirm in 1.21
Unable to reproduce.