Only looking at their torso will make them become aggressive at you.
Step to reproduce:
Go in a Survival world
Find an enderman
Stare at him.
Linked issues
is duplicated by 4
Comments 17
Weird! I did try to spawn a few and I looked at them for at least 5 seconds without getting any reaction.
Please link to this comment in the description
The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.
It looks like the method net.minecraft.entity.monster.EntityEnderman.shouldAttackPlayer(EntityPlayer)
is defining the area, which counts as looking at an Enderman as the middle of its height.
The following changes it so the Enderman becomes only aggressive when you look at its head.
/**
* Checks to see if this enderman should be attacking this player
*/
private boolean shouldAttackPlayer(EntityPlayer player)
{
ItemStack itemstack = player.inventory.armorInventory[3];
if (itemstack != null && itemstack.getItem() == Item.getItemFromBlock(Blocks.pumpkin))
{
return false;
}
else
{
Vec3d vec3d = player.getLook(1.0F).normalize();
// Replaced this
//Vec3d vec3d1 = new Vec3d(this.posX - player.posX, this.getEntityBoundingBox().minY + (double)(this.height / 2.0F) - (player.posY + (double)player.getEyeHeight()), this.posZ - player.posZ);
Vec3d vec3d1 = new Vec3d(this.posX - player.posX, this.getEntityBoundingBox().minY + (double)this.getEyeHeight() - (player.posY + (double)player.getEyeHeight()), this.posZ - player.posZ);
double d0 = vec3d1.lengthVector();
vec3d1 = vec3d1.normalize();
double d1 = vec3d.dotProduct(vec3d1);
return d1 > 1.0D - 0.025D / d0 ? player.canEntityBeSeen(this) : false;
}
}
This ticket is incomplete. Please review the guidelines before reporting issues.
For technical support please use the Mojang Support Center.
--- This action was performed automagically. If you believe this was done erroneously, please :light_bulb_on: raise an issue.