Java Code Examples for net.minecraft.entity.player.EntityPlayer.setPositionAndRotation()

The following are Jave code examples for showing how to use setPositionAndRotation() of the net.minecraft.entity.player.EntityPlayer class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: DecompiledMinecraft   File: NetHandlerPlayClient.java   View Source Code Vote up 4 votes
/**
 * 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);
    }
}
 
Example 2
Project: BaseClient   File: NetHandlerPlayClient.java   View Source Code Vote up 4 votes
/**
 * 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);
    }
}
 
Example 3
Project: BaseClient   File: NetHandlerPlayClient.java   View Source Code Vote up 4 votes
/**
 * 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);
	}
}
 
Example 4
Project: Zombe-Modpack   File: NetHandlerPlayClient.java   View Source Code Vote up 4 votes
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);
    }
}
 
Example 5
Project: Backmemed   File: NetHandlerPlayClient.java   View Source Code Vote up 4 votes
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);
    }
}
 
Example 6
Project: CustomWorldGen   File: NetHandlerPlayClient.java   View Source Code Vote up 4 votes
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);
    }
}