Entity и точка появления.

Версия Minecraft
1.7.10

deleted.user

Мошенник
321
43
Привет всем, у меня есть "вспышка", которую я спавню передавая ей размер и дистанцию от глаз игрока.
Суть в том, что при РОВНЫХ углах\направлениях взгляда она спавнится как надо, а вот при смещенных, т.е. косых - аналогично косо, с отклонением. Как это исправить? Вызываю первый конструктор, конечно же. Естественно код прилагается.


Код:
public EntityGunFlash(EntityPlayer shooter, float size, float distance) {
    super(shooter.worldObj);

    super.renderDistanceWeight = 100.0D;
    this.setSize(0.5F, 0.5F);
    if(FMLClientHandler.instance().getClientPlayerEntity().inventory.getCurrentItem() != null && FMLClientHandler.instance().getClientPlayerEntity().inventory.getCurrentItem().getItem() instanceof TestItemWeapon && Mouse.isButtonDown(1) && FMLClientHandler.instance().getClient().currentScreen == null) {
        //this.setLocationAndAngles(shooter.posX + 0.1, shooter.posY + (double)shooter.getEyeHeight() - (shooter.isSneaking()?0.29D:0.2D) + 0.15, shooter.posZ + 0.4, shooter.rotationYaw, shooter.rotationPitch);
        aiming = true;
        this.setLocationAndAngles(shooter.posX + 0.1, shooter.posY + (double)shooter.getEyeHeight() - (shooter.isSneaking()?0.29D:0.2D) + 0.18, shooter.posZ + 0.15, shooter.rotationYaw, shooter.rotationPitch);
    } else {
        aiming = false;
        this.setLocationAndAngles(shooter.posX, shooter.posY + (double)shooter.getEyeHeight() - (shooter.isSneaking()?0.29D:0.2D) + 0.1, shooter.posZ, shooter.rotationYaw, shooter.rotationPitch);
    }

    super.posX += (double)(-MathHelper.sin(super.rotationYaw / 180.0F * 3.1415927F) * MathHelper.cos(super.rotationPitch / 180.0F * 3.1415927F) * distance);
    super.posZ += (double)(MathHelper.cos(super.rotationYaw / 180.0F * 3.1415927F) * MathHelper.cos(super.rotationPitch / 180.0F * 3.1415927F) * distance);
    super.posY += (double)(-MathHelper.sin(super.rotationPitch / 180.0F * 3.1415927F) * distance);
    if(shooter != Minecraft.getMinecraft().thePlayer) {
        super.posX -= (double)MathHelper.cos(super.rotationYaw / 180.0F * 3.1415927F) * 0.16D;
        super.posZ -= (double)MathHelper.sin(super.rotationYaw / 180.0F * 3.1415927F) * 0.16D;
    }

    this.size = size;
    this.setPosition(super.posX, super.posY, super.posZ);
    this.rotationRoll = (float)Math.random() * 360.0F;
}

public EntityGunFlash(World w, double posX, double posY, double posZ, float yaw, float pitch, float size, float distance) {
    super(w);
    super.renderDistanceWeight = 100.0D;
    this.setSize(0.5F, 0.5F);
    this.setLocationAndAngles(posX, posY, posZ, yaw, pitch);
    super.posX += (double)(-MathHelper.sin(super.rotationYaw / 180.0F * 3.1415927F) * MathHelper.cos(super.rotationPitch / 180.0F * 3.1415927F) * distance);
    super.posZ += (double)(MathHelper.cos(super.rotationYaw / 180.0F * 3.1415927F) * MathHelper.cos(super.rotationPitch / 180.0F * 3.1415927F) * distance);
    super.posY += (double)(-MathHelper.sin(super.rotationPitch / 180.0F * 3.1415927F) * distance);
    this.size = size;
    this.setPosition(super.posX, super.posY, super.posZ);
    this.rotationRoll = (float)Math.random() * 360.0F;
}

Вот пара скриншотов. Угол взгляда одинаковый. Разные стороны только.
https://vk.com/doc336513582_438487256
https://vk.com/doc336513582_438487252
 
Сверху