Java 类net.minecraft.network.play.server.SPacketEntityTeleport 实例源码

项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
/**
 * Updates an entity's position and rotation as specified by the packet
 */
public void handleEntityTeleport(SPacketEntityTeleport packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

    if (entity != null)
    {
        double d0 = packetIn.getX();
        double d1 = packetIn.getY();
        double d2 = packetIn.getZ();
        EntityTracker.updateServerPosition(entity, d0, d1, d2);

        if (!entity.canPassengerSteer())
        {
            float f = (float)(packetIn.getYaw() * 360) / 256.0F;
            float f1 = (float)(packetIn.getPitch() * 360) / 256.0F;

            if (Math.abs(entity.posX - d0) < 0.03125D && Math.abs(entity.posY - d1) < 0.015625D && Math.abs(entity.posZ - d2) < 0.03125D)
            {
                entity.setPositionAndRotationDirect(entity.posX, entity.posY, entity.posZ, f, f1, 0, true);
            }
            else
            {
                entity.setPositionAndRotationDirect(d0, d1, d2, f, f1, 3, true);
            }

            entity.onGround = packetIn.getOnGround();
        }
    }
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
/**
 * Updates an entity's position and rotation as specified by the packet
 */
public void handleEntityTeleport(SPacketEntityTeleport packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

    if (entity != null)
    {
        double d0 = packetIn.getX();
        double d1 = packetIn.getY();
        double d2 = packetIn.getZ();
        EntityTracker.updateServerPosition(entity, d0, d1, d2);

        if (!entity.canPassengerSteer())
        {
            float f = (float)(packetIn.getYaw() * 360) / 256.0F;
            float f1 = (float)(packetIn.getPitch() * 360) / 256.0F;

            if (Math.abs(entity.posX - d0) < 0.03125D && Math.abs(entity.posY - d1) < 0.015625D && Math.abs(entity.posZ - d2) < 0.03125D)
            {
                entity.setPositionAndRotationDirect(entity.posX, entity.posY, entity.posZ, f, f1, 0, true);
            }
            else
            {
                entity.setPositionAndRotationDirect(d0, d1, d2, f, f1, 3, true);
            }

            entity.onGround = packetIn.getOnGround();
        }
    }
}
项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
/**
 * Updates an entity's position and rotation as specified by the packet
 */
public void handleEntityTeleport(SPacketEntityTeleport packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

    if (entity != null)
    {
        double d0 = packetIn.getX();
        double d1 = packetIn.getY();
        double d2 = packetIn.getZ();
        EntityTracker.updateServerPosition(entity, d0, d1, d2);

        if (!entity.canPassengerSteer())
        {
            float f = (float)(packetIn.getYaw() * 360) / 256.0F;
            float f1 = (float)(packetIn.getPitch() * 360) / 256.0F;

            if (Math.abs(entity.posX - d0) < 0.03125D && Math.abs(entity.posY - d1) < 0.015625D && Math.abs(entity.posZ - d2) < 0.03125D)
            {
                entity.setPositionAndRotationDirect(entity.posX, entity.posY, entity.posZ, f, f1, 0, true);
            }
            else
            {
                entity.setPositionAndRotationDirect(d0, d1, d2, f, f1, 3, true);
            }

            entity.onGround = packetIn.getOnGround();
        }
    }
}
项目:Kingdom-Keys-Re-Coded    文件:TeleporterOrgPortal.java   
public void teleport(EntityPlayer player, BlockPos pos, int dimension) {
    EntityPlayerMP playerMP = (EntityPlayerMP) player;
    playerMP.setPositionAndUpdate(pos.getX()+0.5, pos.getY(), pos.getZ()+0.5);
    playerMP.motionX = playerMP.motionY = playerMP.motionZ = 0;
    playerMP.setPositionAndUpdate(pos.getX()+0.5, pos.getY(), pos.getZ()+0.5);
    if (player.world.provider.getDimension() != dimension)
        playerMP.mcServer.getPlayerList().transferPlayerToDimension(playerMP, dimension, this);
    playerMP.setPositionAndUpdate(pos.getX()+0.5, pos.getY(), pos.getZ()+0.5);
    playerMP.connection.sendPacket(new SPacketEntityTeleport(playerMP));
    playerMP.connection.sendPacket(new SPacketEntity(playerMP.getEntityId()));
}
项目:ExpandedRailsMod    文件:NetHandlerPlayClient.java   
/**
 * Updates an entity's position and rotation as specified by the packet
 */
public void handleEntityTeleport(SPacketEntityTeleport packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());

    if (entity != null)
    {
        double d0 = packetIn.getX();
        double d1 = packetIn.getY();
        double d2 = packetIn.getZ();
        EntityTracker.updateServerPosition(entity, d0, d1, d2);

        if (!entity.canPassengerSteer())
        {
            float f = (float)(packetIn.getYaw() * 360) / 256.0F;
            float f1 = (float)(packetIn.getPitch() * 360) / 256.0F;

            if (Math.abs(entity.posX - d0) < 0.03125D && Math.abs(entity.posY - d1) < 0.015625D && Math.abs(entity.posZ - d2) < 0.03125D)
            {
                entity.setPositionAndRotationDirect(entity.posX, entity.posY, entity.posZ, f, f1, 0, true);
            }
            else
            {
                entity.setPositionAndRotationDirect(d0, d1, d2, f, f1, 3, true);
            }

            entity.onGround = packetIn.getOnGround();
        }
    }
}
项目:Backmemed    文件:INetHandlerPlayClient.java   
/**
 * Updates an entity's position and rotation as specified by the packet
 */
void handleEntityTeleport(SPacketEntityTeleport packetIn);
项目:CustomWorldGen    文件:INetHandlerPlayClient.java   
/**
 * Updates an entity's position and rotation as specified by the packet
 */
void handleEntityTeleport(SPacketEntityTeleport packetIn);