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


Java Entity.setRotationYawHead方法代碼示例

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


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

示例1: handleEntityHeadLook

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Updates the direction in which the specified entity is looking, normally this head rotation is independent of the
 * rotation of the entity itself
 */
public void handleEntityHeadLook(S19PacketEntityHeadLook packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = packetIn.getEntity(this.clientWorldController);

    if (entity != null)
    {
        float f = (float)(packetIn.getYaw() * 360) / 256.0F;
        entity.setRotationYawHead(f);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:16,代碼來源:NetHandlerPlayClient.java

示例2: handleEntityHeadLook

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Updates the direction in which the specified entity is looking, normally this
 * head rotation is independent of the rotation of the entity itself
 */
public void handleEntityHeadLook(S19PacketEntityHeadLook packetIn) {
	PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
	Entity entity = packetIn.getEntity(this.clientWorldController);

	if (entity != null) {
		float f = (float) (packetIn.getYaw() * 360) / 256.0F;
		entity.setRotationYawHead(f);
	}
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:14,代碼來源:NetHandlerPlayClient.java

示例3: handleEntityHeadLook

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Updates the direction in which the specified entity is looking, normally this head rotation is independent of the
 * rotation of the entity itself
 */
public void handleEntityHeadLook(SPacketEntityHeadLook packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = packetIn.getEntity(this.clientWorldController);

    if (entity != null)
    {
        float f = (float)(packetIn.getYaw() * 360) / 256.0F;
        entity.setRotationYawHead(f);
    }
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:16,代碼來源:NetHandlerPlayClient.java

示例4: updatePassenger

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public void updatePassenger(Entity passenger)
{
    if (this.isPassenger(passenger))
    {
        float f = 0.0F;
        float f1 = (float)((this.isDead ? 0.009999999776482582D : this.getMountedYOffset()) + passenger.getYOffset());

        if (this.getPassengers().size() > 1)
        {
            int i = this.getPassengers().indexOf(passenger);

            if (i == 0)
            {
                f = 0.2F;
            }
            else
            {
                f = -0.6F;
            }

            if (passenger instanceof EntityAnimal)
            {
                f = (float)((double)f + 0.2D);
            }
        }

        Vec3d vec3d = (new Vec3d((double)f, 0.0D, 0.0D)).rotateYaw(-this.rotationYaw * 0.017453292F - ((float)Math.PI / 2F));
        passenger.setPosition(this.posX + vec3d.xCoord, this.posY + (double)f1, this.posZ + vec3d.zCoord);
        passenger.rotationYaw += this.deltaRotation;
        passenger.setRotationYawHead(passenger.getRotationYawHead() + this.deltaRotation);
        this.applyYawToEntity(passenger);

        if (passenger instanceof EntityAnimal && this.getPassengers().size() > 1)
        {
            int j = passenger.getEntityId() % 2 == 0 ? 90 : 270;
            passenger.setRenderYawOffset(((EntityAnimal)passenger).renderYawOffset + (float)j);
            passenger.setRotationYawHead(passenger.getRotationYawHead() + (float)j);
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:41,代碼來源:EntityBoat.java

示例5: applyYawToEntity

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Applies this boat's yaw to the given entity. Used to update the orientation of its passenger.
 */
protected void applyYawToEntity(Entity entityToUpdate)
{
    entityToUpdate.setRenderYawOffset(this.rotationYaw);
    float f = MathHelper.wrapDegrees(entityToUpdate.rotationYaw - this.rotationYaw);
    float f1 = MathHelper.clamp(f, -105.0F, 105.0F);
    entityToUpdate.prevRotationYaw += f1 - f;
    entityToUpdate.rotationYaw += f1 - f;
    entityToUpdate.setRotationYawHead(entityToUpdate.rotationYaw);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:13,代碼來源:EntityBoat.java

示例6: applyYawToEntity

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Applies this boat's yaw to the given entity. Used to update the orientation of its passenger.
 */
protected void applyYawToEntity(Entity entityToUpdate)
{
    entityToUpdate.setRenderYawOffset(this.rotationYaw);
    float f = MathHelper.wrapDegrees(entityToUpdate.rotationYaw - this.rotationYaw);
    float f1 = MathHelper.clamp_float(f, -105.0F, 105.0F);
    entityToUpdate.prevRotationYaw += f1 - f;
    entityToUpdate.rotationYaw += f1 - f;
    entityToUpdate.setRotationYawHead(entityToUpdate.rotationYaw);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:13,代碼來源:EntityBoat.java

示例7: doTeleport

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Perform the actual teleport
 */
private static void doTeleport(Entity p_189862_0_, CommandBase.CoordinateArg p_189862_1_, CommandBase.CoordinateArg p_189862_2_, CommandBase.CoordinateArg p_189862_3_, CommandBase.CoordinateArg p_189862_4_, CommandBase.CoordinateArg p_189862_5_)
{
    if (p_189862_0_ instanceof EntityPlayerMP)
    {
        Set<SPacketPlayerPosLook.EnumFlags> set = EnumSet.<SPacketPlayerPosLook.EnumFlags>noneOf(SPacketPlayerPosLook.EnumFlags.class);
        float f = (float)p_189862_4_.getAmount();

        if (p_189862_4_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.Y_ROT);
        }
        else
        {
            f = MathHelper.wrapDegrees(f);
        }

        float f1 = (float)p_189862_5_.getAmount();

        if (p_189862_5_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.X_ROT);
        }
        else
        {
            f1 = MathHelper.wrapDegrees(f1);
        }

        p_189862_0_.dismountRidingEntity();
        ((EntityPlayerMP)p_189862_0_).connection.setPlayerLocation(p_189862_1_.getResult(), p_189862_2_.getResult(), p_189862_3_.getResult(), f, f1, set);
        p_189862_0_.setRotationYawHead(f);
    }
    else
    {
        float f2 = (float)MathHelper.wrapDegrees(p_189862_4_.getResult());
        float f3 = (float)MathHelper.wrapDegrees(p_189862_5_.getResult());
        f3 = MathHelper.clamp(f3, -90.0F, 90.0F);
        p_189862_0_.setLocationAndAngles(p_189862_1_.getResult(), p_189862_2_.getResult(), p_189862_3_.getResult(), f2, f3);
        p_189862_0_.setRotationYawHead(f2);
    }

    if (!(p_189862_0_ instanceof EntityLivingBase) || !((EntityLivingBase)p_189862_0_).isElytraFlying())
    {
        p_189862_0_.motionY = 0.0D;
        p_189862_0_.onGround = true;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:50,代碼來源:CommandTeleport.java

示例8: teleportEntityToCoordinates

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Teleports an entity to the specified coordinates
 */
private static void teleportEntityToCoordinates(Entity p_189863_0_, CommandBase.CoordinateArg p_189863_1_, CommandBase.CoordinateArg p_189863_2_, CommandBase.CoordinateArg p_189863_3_, CommandBase.CoordinateArg p_189863_4_, CommandBase.CoordinateArg p_189863_5_)
{
    if (p_189863_0_ instanceof EntityPlayerMP)
    {
        Set<SPacketPlayerPosLook.EnumFlags> set = EnumSet.<SPacketPlayerPosLook.EnumFlags>noneOf(SPacketPlayerPosLook.EnumFlags.class);

        if (p_189863_1_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.X);
        }

        if (p_189863_2_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.Y);
        }

        if (p_189863_3_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.Z);
        }

        if (p_189863_5_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.X_ROT);
        }

        if (p_189863_4_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.Y_ROT);
        }

        float f = (float)p_189863_4_.getAmount();

        if (!p_189863_4_.isRelative())
        {
            f = MathHelper.wrapDegrees(f);
        }

        float f1 = (float)p_189863_5_.getAmount();

        if (!p_189863_5_.isRelative())
        {
            f1 = MathHelper.wrapDegrees(f1);
        }

        p_189863_0_.dismountRidingEntity();
        ((EntityPlayerMP)p_189863_0_).connection.setPlayerLocation(p_189863_1_.getAmount(), p_189863_2_.getAmount(), p_189863_3_.getAmount(), f, f1, set);
        p_189863_0_.setRotationYawHead(f);
    }
    else
    {
        float f2 = (float)MathHelper.wrapDegrees(p_189863_4_.getResult());
        float f3 = (float)MathHelper.wrapDegrees(p_189863_5_.getResult());
        f3 = MathHelper.clamp(f3, -90.0F, 90.0F);
        p_189863_0_.setLocationAndAngles(p_189863_1_.getResult(), p_189863_2_.getResult(), p_189863_3_.getResult(), f2, f3);
        p_189863_0_.setRotationYawHead(f2);
    }

    if (!(p_189863_0_ instanceof EntityLivingBase) || !((EntityLivingBase)p_189863_0_).isElytraFlying())
    {
        p_189863_0_.motionY = 0.0D;
        p_189863_0_.onGround = true;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:68,代碼來源:CommandTP.java

示例9: doTeleport

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Perform the actual teleport
 */
private static void doTeleport(Entity p_189862_0_, CommandBase.CoordinateArg p_189862_1_, CommandBase.CoordinateArg p_189862_2_, CommandBase.CoordinateArg p_189862_3_, CommandBase.CoordinateArg p_189862_4_, CommandBase.CoordinateArg p_189862_5_)
{
    if (p_189862_0_ instanceof EntityPlayerMP)
    {
        Set<SPacketPlayerPosLook.EnumFlags> set = EnumSet.<SPacketPlayerPosLook.EnumFlags>noneOf(SPacketPlayerPosLook.EnumFlags.class);
        float f = (float)p_189862_4_.getAmount();

        if (p_189862_4_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.Y_ROT);
        }
        else
        {
            f = MathHelper.wrapDegrees(f);
        }

        float f1 = (float)p_189862_5_.getAmount();

        if (p_189862_5_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.X_ROT);
        }
        else
        {
            f1 = MathHelper.wrapDegrees(f1);
        }

        p_189862_0_.dismountRidingEntity();
        ((EntityPlayerMP)p_189862_0_).connection.setPlayerLocation(p_189862_1_.getResult(), p_189862_2_.getResult(), p_189862_3_.getResult(), f, f1, set);
        p_189862_0_.setRotationYawHead(f);
    }
    else
    {
        float f2 = (float)MathHelper.wrapDegrees(p_189862_4_.getResult());
        float f3 = (float)MathHelper.wrapDegrees(p_189862_5_.getResult());
        f3 = MathHelper.clamp_float(f3, -90.0F, 90.0F);
        p_189862_0_.setLocationAndAngles(p_189862_1_.getResult(), p_189862_2_.getResult(), p_189862_3_.getResult(), f2, f3);
        p_189862_0_.setRotationYawHead(f2);
    }

    if (!(p_189862_0_ instanceof EntityLivingBase) || !((EntityLivingBase)p_189862_0_).isElytraFlying())
    {
        p_189862_0_.motionY = 0.0D;
        p_189862_0_.onGround = true;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:50,代碼來源:CommandTeleport.java

示例10: teleportEntityToCoordinates

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Teleports an entity to the specified coordinates
 */
private static void teleportEntityToCoordinates(Entity p_189863_0_, CommandBase.CoordinateArg p_189863_1_, CommandBase.CoordinateArg p_189863_2_, CommandBase.CoordinateArg p_189863_3_, CommandBase.CoordinateArg p_189863_4_, CommandBase.CoordinateArg p_189863_5_)
{
    if (p_189863_0_ instanceof EntityPlayerMP)
    {
        Set<SPacketPlayerPosLook.EnumFlags> set = EnumSet.<SPacketPlayerPosLook.EnumFlags>noneOf(SPacketPlayerPosLook.EnumFlags.class);

        if (p_189863_1_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.X);
        }

        if (p_189863_2_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.Y);
        }

        if (p_189863_3_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.Z);
        }

        if (p_189863_5_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.X_ROT);
        }

        if (p_189863_4_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.Y_ROT);
        }

        float f = (float)p_189863_4_.getAmount();

        if (!p_189863_4_.isRelative())
        {
            f = MathHelper.wrapDegrees(f);
        }

        float f1 = (float)p_189863_5_.getAmount();

        if (!p_189863_5_.isRelative())
        {
            f1 = MathHelper.wrapDegrees(f1);
        }

        p_189863_0_.dismountRidingEntity();
        ((EntityPlayerMP)p_189863_0_).connection.setPlayerLocation(p_189863_1_.getAmount(), p_189863_2_.getAmount(), p_189863_3_.getAmount(), f, f1, set);
        p_189863_0_.setRotationYawHead(f);
    }
    else
    {
        float f2 = (float)MathHelper.wrapDegrees(p_189863_4_.getResult());
        float f3 = (float)MathHelper.wrapDegrees(p_189863_5_.getResult());
        f3 = MathHelper.clamp_float(f3, -90.0F, 90.0F);
        p_189863_0_.setLocationAndAngles(p_189863_1_.getResult(), p_189863_2_.getResult(), p_189863_3_.getResult(), f2, f3);
        p_189863_0_.setRotationYawHead(f2);
    }

    if (!(p_189863_0_ instanceof EntityLivingBase) || !((EntityLivingBase)p_189863_0_).isElytraFlying())
    {
        p_189863_0_.motionY = 0.0D;
        p_189863_0_.onGround = true;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:68,代碼來源:CommandTP.java


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