private void updateFacingDirection(Entity entity) {
		if (entity.tickEnd == tick
				|| entity.animation == -1
				|| entity.animationDelay != 0
				|| entity.currentAnimationDuration + 1 > AnimationSequence.animations[entity.animation]
						.getFrameLength(entity.currentAnimationFrame)) {
			int duration = entity.tickEnd - entity.tickStart;
			int timePassed = tick - entity.tickStart;
			int differenceStartX = entity.startX * 128
					+ entity.boundaryDimension * 64;
			int differenceStartY = entity.startY * 128
					+ entity.boundaryDimension * 64;
			int differenceEndX = entity.endX * 128 + entity.boundaryDimension
					* 64;
			int differenceEndY = entity.endY * 128 + entity.boundaryDimension
					* 64;
			entity.x = (differenceStartX * (duration - timePassed) + differenceEndX
					* timePassed)
					/ duration;
			entity.y = (differenceStartY * (duration - timePassed) + differenceEndY
					* timePassed)
					/ duration;
		}
		entity.stepsDelayed = 0;
		if (entity.direction == 0)
			entity.turnDirection = 1024;
		if (entity.direction == 1)
			entity.turnDirection = 1536;
		if (entity.direction == 2)
			entity.turnDirection = 0;
		if (entity.direction == 3)
			entity.turnDirection = 512;
		entity.currentRotation = entity.turnDirection;
	}