Как сделать так, чтобы когда игрок смотрит на моба,то моб загорался

Версия Minecraft
1.7.10
Попробовал проделать такие же манипуляции, как в классе эндермена на своем мобе, но ничего не получается.
Класс моба:
public void onEntityUpdate() {
    super.onEntityUpdate();
    EntityPlayer par1 = this.worldObj.getClosestVulnerablePlayerToEntity(this, 64.0D);
    if (par1 != null && isPlayerLooking(par1)) {
        setFire(2);
    }
}

private boolean isPlayerLooking(EntityPlayer p_70821_1_) {
    Vec3 vec3 = p_70821_1_.getLook(1.0F).normalize();
    Vec3 vec31 = Vec3.createVectorHelper(this.posX - p_70821_1_.posX, this.boundingBox.minY + (double)(this.height / 2.0F) - (p_70821_1_.posY + (double)p_70821_1_.getEyeHeight()), this.posZ - p_70821_1_.posZ);
    double d0 = vec31.lengthVector();
    vec31 = vec31.normalize();
    double d1 = vec3.dotProduct(vec31);
    return d1 > 1.0D - 0.025D / d0 && p_70821_1_.canEntityBeSeen(this);
}
 
372
0
Попробуй так

Java:
EntityLivingBase cameraEntity = mc.renderViewEntity;
Vec3 renderingVector = cameraEntity.getPosition(event.partialTicks);
Frustrum frustrum = new Frustrum();

double viewX = cameraEntity.lastTickPosX + (cameraEntity.posX - cameraEntity.lastTickPosX) * event.partialTicks;
double viewY = cameraEntity.lastTickPosY + (cameraEntity.posY - cameraEntity.lastTickPosY) * event.partialTicks;
double viewZ = cameraEntity.lastTickPosZ + (cameraEntity.posZ - cameraEntity.lastTickPosZ) * event.partialTicks;
frustrum.setPosition(viewX, viewY, viewZ);

WorldClient client = mc.theWorld;
Set<Entity> entities = ReflectionHelper.getPrivateValue(WorldClient.class, client, new String[] { "entityList", "field_73032_d", "J" });

for(Entity entity : entities)
    if(entity != null && entity instanceof EntityLivingBase && entity.isInRangeToRender3d(renderingVector.xCoord, renderingVector.yCoord, renderingVector.zCoord)
       && (entity.ignoreFrustumCheck || frustrum.isBoundingBoxInFrustum(entity.boundingBox)) && entity.isEntityAlive())
        if (entity != mc.thePlayer && !mc.isGamePaused())
            doSomething();
 
Нашел немного костыльное, но все же решение проблемы, т к мне нужно было чтобы моб горел когда на него светили фонариком, я просто в блоке света который спавнится от фонарика, в методе onEntityCollidedWithBlock сделал проверку на нужного мне моба и заставлял его гореть. Но все же спасибо за ответы
 
Сверху