本文整理汇总了Java中net.minecraft.entity.player.EntityPlayer.setPositionAndRotation方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayer.setPositionAndRotation方法的具体用法?Java EntityPlayer.setPositionAndRotation怎么用?Java EntityPlayer.setPositionAndRotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.player.EntityPlayer
的用法示例。
在下文中一共展示了EntityPlayer.setPositionAndRotation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handlePlayerPosLook
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
* Handles changes in player positioning and rotation such as when travelling to a new dimension, (re)spawning,
* mounting horses etc. Seems to immediately reply to the server with the clients post-processing perspective on the
* player positioning
*/
public void handlePlayerPosLook(S08PacketPlayerPosLook packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
EntityPlayer entityplayer = this.gameController.thePlayer;
double d0 = packetIn.getX();
double d1 = packetIn.getY();
double d2 = packetIn.getZ();
float f = packetIn.getYaw();
float f1 = packetIn.getPitch();
if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.X))
{
d0 += entityplayer.posX;
}
else
{
entityplayer.motionX = 0.0D;
}
if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.Y))
{
d1 += entityplayer.posY;
}
else
{
entityplayer.motionY = 0.0D;
}
if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.Z))
{
d2 += entityplayer.posZ;
}
else
{
entityplayer.motionZ = 0.0D;
}
if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.X_ROT))
{
f1 += entityplayer.rotationPitch;
}
if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.Y_ROT))
{
f += entityplayer.rotationYaw;
}
entityplayer.setPositionAndRotation(d0, d1, d2, f, f1);
this.netManager.sendPacket(new C03PacketPlayer.C06PacketPlayerPosLook(entityplayer.posX, entityplayer.getEntityBoundingBox().minY, entityplayer.posZ, entityplayer.rotationYaw, entityplayer.rotationPitch, false));
if (!this.doneLoadingTerrain)
{
this.gameController.thePlayer.prevPosX = this.gameController.thePlayer.posX;
this.gameController.thePlayer.prevPosY = this.gameController.thePlayer.posY;
this.gameController.thePlayer.prevPosZ = this.gameController.thePlayer.posZ;
this.doneLoadingTerrain = true;
this.gameController.displayGuiScreen((GuiScreen)null);
}
}
示例2: handlePlayerPosLook
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
* Handles changes in player positioning and rotation such as when travelling to
* a new dimension, (re)spawning, mounting horses etc. Seems to immediately
* reply to the server with the clients post-processing perspective on the
* player positioning
*/
public void handlePlayerPosLook(S08PacketPlayerPosLook packetIn) {
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
EntityPlayer entityplayer = this.gameController.thePlayer;
double d0 = packetIn.getX();
double d1 = packetIn.getY();
double d2 = packetIn.getZ();
float f = packetIn.getYaw();
float f1 = packetIn.getPitch();
if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.X)) {
d0 += entityplayer.posX;
} else {
entityplayer.motionX = 0.0D;
}
if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.Y)) {
d1 += entityplayer.posY;
} else {
entityplayer.motionY = 0.0D;
}
if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.Z)) {
d2 += entityplayer.posZ;
} else {
entityplayer.motionZ = 0.0D;
}
if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.X_ROT)) {
f1 += entityplayer.rotationPitch;
}
if (packetIn.func_179834_f().contains(S08PacketPlayerPosLook.EnumFlags.Y_ROT)) {
f += entityplayer.rotationYaw;
}
entityplayer.setPositionAndRotation(d0, d1, d2, f, f1);
this.netManager.sendPacket(
new C03PacketPlayer.C06PacketPlayerPosLook(entityplayer.posX, entityplayer.getEntityBoundingBox().minY,
entityplayer.posZ, entityplayer.rotationYaw, entityplayer.rotationPitch, false));
if (!this.doneLoadingTerrain) {
this.gameController.thePlayer.prevPosX = this.gameController.thePlayer.posX;
this.gameController.thePlayer.prevPosY = this.gameController.thePlayer.posY;
this.gameController.thePlayer.prevPosZ = this.gameController.thePlayer.posZ;
this.doneLoadingTerrain = true;
this.gameController.displayGuiScreen((GuiScreen) null);
}
}
示例3: handlePlayerPosLook
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public void handlePlayerPosLook(SPacketPlayerPosLook packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
EntityPlayer entityplayer = this.gameController.player;
double d0 = packetIn.getX();
double d1 = packetIn.getY();
double d2 = packetIn.getZ();
float f = packetIn.getYaw();
float f1 = packetIn.getPitch();
if (packetIn.getFlags().contains(SPacketPlayerPosLook.EnumFlags.X))
{
d0 += entityplayer.posX;
}
else
{
entityplayer.motionX = 0.0D;
}
if (packetIn.getFlags().contains(SPacketPlayerPosLook.EnumFlags.Y))
{
d1 += entityplayer.posY;
}
else
{
entityplayer.motionY = 0.0D;
}
if (packetIn.getFlags().contains(SPacketPlayerPosLook.EnumFlags.Z))
{
d2 += entityplayer.posZ;
}
else
{
entityplayer.motionZ = 0.0D;
}
if (packetIn.getFlags().contains(SPacketPlayerPosLook.EnumFlags.X_ROT))
{
f1 += entityplayer.rotationPitch;
}
if (packetIn.getFlags().contains(SPacketPlayerPosLook.EnumFlags.Y_ROT))
{
f += entityplayer.rotationYaw;
}
entityplayer.setPositionAndRotation(d0, d1, d2, f, f1);
this.netManager.sendPacket(new CPacketConfirmTeleport(packetIn.getTeleportId()));
this.netManager.sendPacket(new CPacketPlayer.PositionRotation(entityplayer.posX, entityplayer.getEntityBoundingBox().minY, entityplayer.posZ, entityplayer.rotationYaw, entityplayer.rotationPitch, false));
if (!this.doneLoadingTerrain)
{
this.gameController.player.prevPosX = this.gameController.player.posX;
this.gameController.player.prevPosY = this.gameController.player.posY;
this.gameController.player.prevPosZ = this.gameController.player.posZ;
this.doneLoadingTerrain = true;
this.gameController.displayGuiScreen((GuiScreen)null);
}
}
示例4: handlePlayerPosLook
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public void handlePlayerPosLook(SPacketPlayerPosLook packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
EntityPlayer entityplayer = this.gameController.thePlayer;
double d0 = packetIn.getX();
double d1 = packetIn.getY();
double d2 = packetIn.getZ();
float f = packetIn.getYaw();
float f1 = packetIn.getPitch();
if (packetIn.getFlags().contains(SPacketPlayerPosLook.EnumFlags.X))
{
d0 += entityplayer.posX;
}
else
{
entityplayer.motionX = 0.0D;
}
if (packetIn.getFlags().contains(SPacketPlayerPosLook.EnumFlags.Y))
{
d1 += entityplayer.posY;
}
else
{
entityplayer.motionY = 0.0D;
}
if (packetIn.getFlags().contains(SPacketPlayerPosLook.EnumFlags.Z))
{
d2 += entityplayer.posZ;
}
else
{
entityplayer.motionZ = 0.0D;
}
if (packetIn.getFlags().contains(SPacketPlayerPosLook.EnumFlags.X_ROT))
{
f1 += entityplayer.rotationPitch;
}
if (packetIn.getFlags().contains(SPacketPlayerPosLook.EnumFlags.Y_ROT))
{
f += entityplayer.rotationYaw;
}
entityplayer.setPositionAndRotation(d0, d1, d2, f, f1);
this.netManager.sendPacket(new CPacketConfirmTeleport(packetIn.getTeleportId()));
this.netManager.sendPacket(new CPacketPlayer.PositionRotation(entityplayer.posX, entityplayer.getEntityBoundingBox().minY, entityplayer.posZ, entityplayer.rotationYaw, entityplayer.rotationPitch, false));
if (!this.doneLoadingTerrain)
{
this.gameController.thePlayer.prevPosX = this.gameController.thePlayer.posX;
this.gameController.thePlayer.prevPosY = this.gameController.thePlayer.posY;
this.gameController.thePlayer.prevPosZ = this.gameController.thePlayer.posZ;
this.doneLoadingTerrain = true;
this.gameController.displayGuiScreen((GuiScreen)null);
}
}