本文整理匯總了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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}