當前位置: 首頁>>代碼示例>>Java>>正文


Java MathHelper.wrapAngleTo180_double方法代碼示例

本文整理匯總了Java中net.minecraft.util.MathHelper.wrapAngleTo180_double方法的典型用法代碼示例。如果您正苦於以下問題:Java MathHelper.wrapAngleTo180_double方法的具體用法?Java MathHelper.wrapAngleTo180_double怎麽用?Java MathHelper.wrapAngleTo180_double使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.util.MathHelper的用法示例。


在下文中一共展示了MathHelper.wrapAngleTo180_double方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getMovementOffsets

import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
/**
 * Returns a double[3] array with movement offsets, used to calculate trailing tail/neck positions. [0] = yaw
 * offset, [1] = y offset, [2] = unused, always 0. Parameters: buffer index offset, partial ticks.
 */
public double[] getMovementOffsets(int p_70974_1_, float p_70974_2_)
{
    if (this.getHealth() <= 0.0F)
    {
        p_70974_2_ = 0.0F;
    }

    p_70974_2_ = 1.0F - p_70974_2_;
    int i = this.ringBufferIndex - p_70974_1_ * 1 & 63;
    int j = this.ringBufferIndex - p_70974_1_ * 1 - 1 & 63;
    double[] adouble = new double[3];
    double d0 = this.ringBuffer[i][0];
    double d1 = MathHelper.wrapAngleTo180_double(this.ringBuffer[j][0] - d0);
    adouble[0] = d0 + d1 * (double)p_70974_2_;
    d0 = this.ringBuffer[i][1];
    d1 = this.ringBuffer[j][1] - d0;
    adouble[1] = d0 + d1 * (double)p_70974_2_;
    adouble[2] = this.ringBuffer[i][2] + (this.ringBuffer[j][2] - this.ringBuffer[i][2]) * (double)p_70974_2_;
    return adouble;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:25,代碼來源:EntityDragon.java

示例2: adjustAim

import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
public static void adjustAim(Entity_AA turret, boolean secondRail, double posX, double posY, double posZ)
{
	_WeaponBase currentWeapon = turret.firstWeapon;
	if (secondRail) { currentWeapon = turret.secondWeapon; }
	
	if (currentWeapon == null) { return; }	// Has no weapon, so no point in adjusting anything
	
	if (currentWeapon instanceof LightningRed) { }	// Laser
	else if (currentWeapon instanceof MediGun) { }
	else if (currentWeapon instanceof Sunray) { }
	else if (currentWeapon instanceof ERA) { }
	else if (currentWeapon instanceof Endernymous) { }
	else
	{
		double distance = getDistanceSqToTarget(turret, posX, posY, posZ);
		double angleMod = (0.045 * distance) / (currentWeapon.Speed * currentWeapon.Speed);	// 0.05
		
		if (currentWeapon instanceof FrostLancer) { angleMod /= 2; }		// Half gravity
		else if (currentWeapon instanceof EnderRifle) { angleMod /= 2; }	// Half gravity
		
		turret.rotationPitch -= MathHelper.wrapAngleTo180_double(angleMod);
	}
}
 
開發者ID:Domochevsky,項目名稱:minecraft-quiverbow,代碼行數:24,代碼來源:AI_Targeting.java

示例3: simplifyAngle

import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
/**
 * Simplifies the value of a number by adding/subtracting 180 to the point that the number is between -180 and 180.
 */
private float simplifyAngle(double p_70973_1_)
{
    return (float)MathHelper.wrapAngleTo180_double(p_70973_1_);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:8,代碼來源:EntityDragon.java

示例4: wrapDegrees

import net.minecraft.util.MathHelper; //導入方法依賴的package包/類
public static double wrapDegrees(double p_wrapDegrees_0_)
{
    return MathHelper.wrapAngleTo180_double(p_wrapDegrees_0_);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:5,代碼來源:RealmsMth.java


注:本文中的net.minecraft.util.MathHelper.wrapAngleTo180_double方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。