What I expected to happen
Reinforcement zombies to not be hostile towards players in creative mode.
What actually happened
Reinforcement zombies try to attack the player who attacked the zombie spawning the reinforcement zombies even if the player is in creative mode.
Steps to reproduce
Spawn 3 or more zombies close to each other, while in creative mode;
Walk back a little, and switch to survival mode;
Hit one zombie, and make sure they DON'T hurt you (important);
Quickly switch to creative mode;
Some zombies will be chasing you.
Steps to reproduce with commands
Set your gamemode to Creative
Set the difficulty to "Hard"
/difficulty hard
Set the gamerule
doMobSpawning
totrue
if it is not already/gamerule doMobSpawning true
Set the time to "midnight" or make sure there is no light in the area around you
/time set midnight
Summon a zombie using the following command
/summon minecraft:zombie ~ ~ ~ {Attributes:[{Base:1.0,Name:"zombie.spawn_reinforcements"}]}
Hit the zombie a few times
Search for the spawned reinforcement zombies, if there are no other zombies you can use the following command
/execute as @e[type=zombie,sort=nearest,distance=..40] run data merge entity @s {Glowing:1b}
Code analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
Either the method net.minecraft.entity.EntityLiving.setAttackTarget(EntityLivingBase)
should not set players in Creative or Spectator mode as target or the method net.minecraft.entity.monster.EntityZombie.attackEntityFrom(DamageSource, float)
should test if the player is in Creative mode.
Linked issues
is duplicated by 13
Attachments
Comments 28
Regressed in 1.8 release. To reproduce (I think):
Spawn zombies behind you (20-30 blocks away)
Spawn zombies in front of you, go into survival and quickly punch them, and go back into Creative.
Hitting the zombie/other zombies or going into Spectator does not fix the issue, but logging out/back in does.
Relates to MC-94389.
Cannot reproduce.